Cleanup transport-native-epoll code.
Motivation: The code of transport-native-epoll missed some things in terms of static keywords, @deprecated annotations and other minor things. Modifications: - Add missing @deprecated annotation - Not using FQCN in javadocs - Add static keyword where possible - Use final fields when possible - Remove throws IOException from method where it is not needed. Result: Cleaner code. Conflicts: transport-native-epoll/src/main/java/io/netty/channel/epoll/AbstractEpollChannel.java transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollDatagramChannel.java transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollRecvByteAllocatorHandle.java
This commit is contained in:
parent
f5fab38988
commit
2308f1703b
@ -34,6 +34,7 @@ public abstract class AbstractEpollServerChannel extends AbstractEpollChannel im
|
|||||||
/**
|
/**
|
||||||
* @deprecated Use {@link #AbstractEpollServerChannel(Socket, boolean)}.
|
* @deprecated Use {@link #AbstractEpollServerChannel(Socket, boolean)}.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
protected AbstractEpollServerChannel(int fd) {
|
protected AbstractEpollServerChannel(int fd) {
|
||||||
this(new Socket(fd), false);
|
this(new Socket(fd), false);
|
||||||
}
|
}
|
||||||
|
@ -640,7 +640,7 @@ public abstract class AbstractEpollStreamChannel extends AbstractEpollChannel im
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void safeClosePipe(FileDescriptor fd) {
|
private static void safeClosePipe(FileDescriptor fd) {
|
||||||
if (fd != null) {
|
if (fd != null) {
|
||||||
try {
|
try {
|
||||||
fd.close();
|
fd.close();
|
||||||
@ -969,7 +969,7 @@ public abstract class AbstractEpollStreamChannel extends AbstractEpollChannel im
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract boolean spliceIn(RecvByteBufAllocator.Handle handle) throws IOException;
|
abstract boolean spliceIn(RecvByteBufAllocator.Handle handle);
|
||||||
|
|
||||||
protected final int spliceIn(FileDescriptor pipeOut, RecvByteBufAllocator.Handle handle) throws IOException {
|
protected final int spliceIn(FileDescriptor pipeOut, RecvByteBufAllocator.Handle handle) throws IOException {
|
||||||
// calculate the maximum amount of data we are allowed to splice
|
// calculate the maximum amount of data we are allowed to splice
|
||||||
@ -1008,7 +1008,7 @@ public abstract class AbstractEpollStreamChannel extends AbstractEpollChannel im
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean spliceIn(RecvByteBufAllocator.Handle handle) throws IOException {
|
public boolean spliceIn(RecvByteBufAllocator.Handle handle) {
|
||||||
assert ch.eventLoop().inEventLoop();
|
assert ch.eventLoop().inEventLoop();
|
||||||
if (len == 0) {
|
if (len == 0) {
|
||||||
promise.setSuccess();
|
promise.setSuccess();
|
||||||
@ -1102,7 +1102,7 @@ public abstract class AbstractEpollStreamChannel extends AbstractEpollChannel im
|
|||||||
private final class SpliceFdTask extends SpliceInTask {
|
private final class SpliceFdTask extends SpliceInTask {
|
||||||
private final FileDescriptor fd;
|
private final FileDescriptor fd;
|
||||||
private final ChannelPromise promise;
|
private final ChannelPromise promise;
|
||||||
private int offset;
|
private final int offset;
|
||||||
|
|
||||||
SpliceFdTask(FileDescriptor fd, int offset, int len, ChannelPromise promise) {
|
SpliceFdTask(FileDescriptor fd, int offset, int len, ChannelPromise promise) {
|
||||||
super(len, promise);
|
super(len, promise);
|
||||||
@ -1117,7 +1117,7 @@ public abstract class AbstractEpollStreamChannel extends AbstractEpollChannel im
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean spliceIn(RecvByteBufAllocator.Handle handle) throws IOException {
|
public boolean spliceIn(RecvByteBufAllocator.Handle handle) {
|
||||||
assert eventLoop().inEventLoop();
|
assert eventLoop().inEventLoop();
|
||||||
if (len == 0) {
|
if (len == 0) {
|
||||||
promise.setSuccess();
|
promise.setSuccess();
|
||||||
|
@ -127,6 +127,6 @@ public final class EpollServerSocketChannel extends AbstractEpollServerChannel i
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setTcpMd5Sig(Map<InetAddress, byte[]> keys) throws IOException {
|
void setTcpMd5Sig(Map<InetAddress, byte[]> keys) throws IOException {
|
||||||
this.tcpMd5SigAddresses = TcpMd5Util.newTcpMd5Sigs(this, tcpMd5SigAddresses, keys);
|
tcpMd5SigAddresses = TcpMd5Util.newTcpMd5Sigs(this, tcpMd5SigAddresses, keys);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user