Revert java6 NIO compatibility. Netty requires java7 because the

classloader cannot load certain classes (because of recursion issues)
This commit is contained in:
nathan 2016-03-18 01:21:12 +01:00
parent 64df20fcdf
commit ca28a7d908
3 changed files with 73 additions and 20 deletions

View File

@ -11,6 +11,7 @@ import com.barchart.udt.SocketUDT;
import com.barchart.udt.TypeUDT;
import java.io.IOException;
import java.net.ProtocolFamily;
import java.nio.channels.DatagramChannel;
import java.nio.channels.Pipe;
import java.nio.channels.spi.SelectorProvider;
@ -79,6 +80,11 @@ public class SelectorProviderUDT extends SelectorProvider {
throw new UnsupportedOperationException("feature not available");
}
@Override
public DatagramChannel openDatagramChannel(final ProtocolFamily family) throws IOException {
throw new UnsupportedOperationException("feature not available");
}
/**
* Not supported.
*/

View File

@ -14,7 +14,10 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.net.SocketAddress;
import java.net.SocketOption;
import java.nio.channels.ServerSocketChannel;
import java.util.Set;
/**
* {@link ServerSocketChannel}-like wrapper for {@link SocketUDT} can be either
@ -25,7 +28,7 @@ import java.nio.channels.ServerSocketChannel;
* {@link ServerSocketChannel#open()};
* <p>
* example:
*
*
* <pre>
* SelectorProvider provider = SelectorProviderUDT.DATAGRAM;
* ServerSocketChannel acceptChannel = provider.openServerSocketChannel();
@ -109,6 +112,26 @@ public class ServerSocketChannelUDT extends ServerSocketChannel implements Chann
return (SelectorProviderUDT) super.provider();
}
@Override
public ServerSocketChannel bind(final SocketAddress local, final int backlog) throws IOException {
throw new UnsupportedOperationException("feature not available");
}
@Override
public <T> ServerSocketChannel setOption(final SocketOption<T> name, final T value) throws IOException {
throw new UnsupportedOperationException("feature not available");
}
@Override
public <T> T getOption(final SocketOption<T> name) throws IOException {
throw new UnsupportedOperationException("feature not available");
}
@Override
public Set<SocketOption<?>> supportedOptions() {
throw new UnsupportedOperationException("feature not available");
}
@Override
public synchronized NioServerSocketUDT socket() {
if (socketAdapter == null) {
@ -136,4 +159,9 @@ public class ServerSocketChannelUDT extends ServerSocketChannel implements Chann
public TypeUDT typeUDT() {
return providerUDT().type();
}
@Override
public SocketAddress getLocalAddress() throws IOException {
throw new UnsupportedOperationException("feature not available");
}
}

View File

@ -17,12 +17,14 @@ import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.net.SocketOption;
import java.nio.ByteBuffer;
import java.nio.channels.ClosedChannelException;
import java.nio.channels.ConnectionPendingException;
import java.nio.channels.IllegalBlockingModeException;
import java.nio.channels.SocketChannel;
import java.nio.channels.UnresolvedAddressException;
import java.util.Set;
/**
* {@link SocketChannel}-like wrapper for {@link SocketUDT}, can be either
@ -38,7 +40,7 @@ import java.nio.channels.UnresolvedAddressException;
* {@link SocketChannel#open()};
* <p>
* example:
*
*
* <pre>
* SelectorProvider provider = SelectorProviderUDT.DATAGRAM;
* SocketChannel clientChannel = provider.openSocketChannel();
@ -74,8 +76,6 @@ public class SocketChannelUDT extends SocketChannel implements ChannelUDT {
protected final SocketUDT socketUDT;
private SocketAddress localAddress;
private InetSocketAddress remoteSocket;
protected SocketChannelUDT( //
@ -242,13 +242,10 @@ public class SocketChannelUDT extends SocketChannel implements ChannelUDT {
}
// @Override
// public SocketAddress getRemoteAddress() throws IOException {
// if(this.isConnectFinished()) {
// return remoteSocket;
// }
// return null;
// }
@Override
public SocketAddress getRemoteAddress() throws IOException {
throw new UnsupportedOperationException("feature not available");
}
@Override
protected void implCloseSelectableChannel() throws IOException {
@ -292,7 +289,7 @@ public class SocketChannelUDT extends SocketChannel implements ChannelUDT {
/**
* See {@link SocketChannel#read(ByteBuffer)} contract;
* note: this method does not return (-1) as EOS (end of stream flag)
*
*
* @return <code><0</code> should not happen<br>
* <code>=0</code> blocking mode: timeout occurred on receive<br>
* <code>=0</code> non-blocking mode: nothing is received by the
@ -396,7 +393,7 @@ public class SocketChannelUDT extends SocketChannel implements ChannelUDT {
/**
* See {@link SocketChannel#write(ByteBuffer)} contract;
*
*
* @return <code><0</code> should not happen<br>
* <code>=0</code> blocking mode: timeout occurred on send<br>
* <code>=0</code> non-blocking mode: buffer is full in the
@ -533,11 +530,33 @@ public class SocketChannelUDT extends SocketChannel implements ChannelUDT {
}
// @Override
// public SocketAddress getLocalAddress() throws IOException {
// if(this.isConnected()) {
// return localAddress;
// }
// return null;
// }
@Override
public <T> SocketChannel setOption(final SocketOption<T> name, final T value) throws IOException {
throw new UnsupportedOperationException("feature not available");
}
@Override
public <T> T getOption(final SocketOption<T> name) throws IOException {
throw new UnsupportedOperationException("feature not available");
}
@Override
public Set<SocketOption<?>> supportedOptions() {
throw new UnsupportedOperationException("feature not available");
}
@Override
public SocketChannel shutdownInput() throws IOException {
throw new UnsupportedOperationException("feature not available");
}
@Override
public SocketChannel shutdownOutput() throws IOException {
throw new UnsupportedOperationException("feature not available");
}
@Override
public SocketAddress getLocalAddress() throws IOException {
throw new UnsupportedOperationException("feature not available");
}
}