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:
Norman Maurer 2016-03-22 14:42:11 +01:00
parent f5fab38988
commit 2308f1703b
3 changed files with 7 additions and 6 deletions

View File

@ -34,6 +34,7 @@ public abstract class AbstractEpollServerChannel extends AbstractEpollChannel im
/**
* @deprecated Use {@link #AbstractEpollServerChannel(Socket, boolean)}.
*/
@Deprecated
protected AbstractEpollServerChannel(int fd) {
this(new Socket(fd), false);
}

View File

@ -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) {
try {
fd.close();
@ -969,7 +969,7 @@ public abstract class AbstractEpollStreamChannel extends AbstractEpollChannel im
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 {
// calculate the maximum amount of data we are allowed to splice
@ -1008,7 +1008,7 @@ public abstract class AbstractEpollStreamChannel extends AbstractEpollChannel im
}
@Override
public boolean spliceIn(RecvByteBufAllocator.Handle handle) throws IOException {
public boolean spliceIn(RecvByteBufAllocator.Handle handle) {
assert ch.eventLoop().inEventLoop();
if (len == 0) {
promise.setSuccess();
@ -1102,7 +1102,7 @@ public abstract class AbstractEpollStreamChannel extends AbstractEpollChannel im
private final class SpliceFdTask extends SpliceInTask {
private final FileDescriptor fd;
private final ChannelPromise promise;
private int offset;
private final int offset;
SpliceFdTask(FileDescriptor fd, int offset, int len, ChannelPromise promise) {
super(len, promise);
@ -1117,7 +1117,7 @@ public abstract class AbstractEpollStreamChannel extends AbstractEpollChannel im
}
@Override
public boolean spliceIn(RecvByteBufAllocator.Handle handle) throws IOException {
public boolean spliceIn(RecvByteBufAllocator.Handle handle) {
assert eventLoop().inEventLoop();
if (len == 0) {
promise.setSuccess();

View File

@ -127,6 +127,6 @@ public final class EpollServerSocketChannel extends AbstractEpollServerChannel i
}
void setTcpMd5Sig(Map<InetAddress, byte[]> keys) throws IOException {
this.tcpMd5SigAddresses = TcpMd5Util.newTcpMd5Sigs(this, tcpMd5SigAddresses, keys);
tcpMd5SigAddresses = TcpMd5Util.newTcpMd5Sigs(this, tcpMd5SigAddresses, keys);
}
}