Revert java 7 changes
This commit is contained in:
parent
d39f3ea289
commit
6080c4fd4d
|
@ -8,7 +8,6 @@
|
|||
package com.barchart.udt.nio;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.ProtocolFamily;
|
||||
import java.nio.channels.DatagramChannel;
|
||||
import java.nio.channels.Pipe;
|
||||
import java.nio.channels.spi.SelectorProvider;
|
||||
|
@ -27,12 +26,14 @@ public class SelectorProviderUDT extends SelectorProvider {
|
|||
/**
|
||||
* system-wide provider instance, for {@link TypeUDT#DATAGRAM} UDT sockets
|
||||
*/
|
||||
public static final SelectorProviderUDT DATAGRAM = new SelectorProviderUDT(TypeUDT.DATAGRAM);
|
||||
public static final SelectorProviderUDT DATAGRAM = //
|
||||
new SelectorProviderUDT(TypeUDT.DATAGRAM);
|
||||
|
||||
/**
|
||||
* system-wide provider instance, for {@link TypeUDT#STREAM} UDT sockets
|
||||
*/
|
||||
public static final SelectorProviderUDT STREAM = new SelectorProviderUDT(TypeUDT.STREAM);
|
||||
public static final SelectorProviderUDT STREAM = //
|
||||
new SelectorProviderUDT(TypeUDT.STREAM);
|
||||
|
||||
public static SelectorProviderUDT from(final TypeUDT type) {
|
||||
switch (type) {
|
||||
|
@ -78,15 +79,6 @@ public class SelectorProviderUDT extends SelectorProvider {
|
|||
throw new UnsupportedOperationException("feature not available");
|
||||
}
|
||||
|
||||
/**
|
||||
* java 7
|
||||
*/
|
||||
@Override
|
||||
public
|
||||
DatagramChannel openDatagramChannel(final ProtocolFamily family) throws IOException {
|
||||
throw new UnsupportedOperationException("feature not available");
|
||||
}
|
||||
|
||||
/**
|
||||
* Not supported.
|
||||
*/
|
||||
|
|
|
@ -7,18 +7,14 @@
|
|||
*/
|
||||
package com.barchart.udt.nio;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.SocketAddress;
|
||||
import java.net.SocketOption;
|
||||
import java.nio.channels.ServerSocketChannel;
|
||||
import java.util.Set;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.barchart.udt.SocketUDT;
|
||||
import com.barchart.udt.TypeUDT;
|
||||
import com.barchart.udt.anno.ThreadSafe;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.channels.ServerSocketChannel;
|
||||
|
||||
/**
|
||||
* {@link ServerSocketChannel}-like wrapper for {@link SocketUDT} can be either
|
||||
|
@ -43,16 +39,22 @@ import com.barchart.udt.anno.ThreadSafe;
|
|||
*/
|
||||
public class ServerSocketChannelUDT extends ServerSocketChannel implements ChannelUDT {
|
||||
|
||||
protected static final Logger log = LoggerFactory.getLogger(ServerSocketChannelUDT.class);
|
||||
protected static final Logger log = LoggerFactory
|
||||
.getLogger(ServerSocketChannelUDT.class);
|
||||
|
||||
@ThreadSafe("this")
|
||||
protected NioServerSocketUDT socketAdapter;
|
||||
|
||||
protected final SocketUDT socketUDT;
|
||||
|
||||
protected ServerSocketChannelUDT(final SelectorProviderUDT provider, final SocketUDT socketUDT) {
|
||||
protected ServerSocketChannelUDT( //
|
||||
final SelectorProviderUDT provider, //
|
||||
final SocketUDT socketUDT //
|
||||
) {
|
||||
|
||||
super(provider);
|
||||
this.socketUDT = socketUDT;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -81,22 +83,14 @@ public class ServerSocketChannelUDT extends ServerSocketChannel implements Chann
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* java 7
|
||||
*/
|
||||
@Override
|
||||
public
|
||||
SocketAddress getLocalAddress() throws IOException {
|
||||
throw new UnsupportedOperationException("feature not available");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void implCloseSelectableChannel() throws IOException {
|
||||
socketUDT.close();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void implConfigureBlocking(final boolean block) throws IOException {
|
||||
protected void implConfigureBlocking(final boolean block)
|
||||
throws IOException {
|
||||
socketUDT.setBlocking(block);
|
||||
}
|
||||
|
||||
|
@ -115,42 +109,6 @@ public class ServerSocketChannelUDT extends ServerSocketChannel implements Chann
|
|||
return (SelectorProviderUDT) super.provider();
|
||||
}
|
||||
|
||||
/**
|
||||
* java 7
|
||||
*/
|
||||
@Override
|
||||
public
|
||||
ServerSocketChannel bind(final SocketAddress local, final int backlog) throws IOException {
|
||||
throw new UnsupportedOperationException("feature not available");
|
||||
}
|
||||
|
||||
/**
|
||||
* java 7
|
||||
*/
|
||||
@Override
|
||||
public
|
||||
<T> ServerSocketChannel setOption(final SocketOption<T> name, final T value) throws IOException {
|
||||
throw new UnsupportedOperationException("feature not available");
|
||||
}
|
||||
|
||||
/**
|
||||
* java 7
|
||||
*/
|
||||
@Override
|
||||
public
|
||||
<T> T getOption(final SocketOption<T> name) throws IOException {
|
||||
throw new UnsupportedOperationException("feature not available");
|
||||
}
|
||||
|
||||
/**
|
||||
* java 7
|
||||
*/
|
||||
@Override
|
||||
public
|
||||
Set<SocketOption<?>> supportedOptions() {
|
||||
throw new UnsupportedOperationException("feature not available");
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized NioServerSocketUDT socket() {
|
||||
if (socketAdapter == null) {
|
||||
|
|
|
@ -7,25 +7,22 @@
|
|||
*/
|
||||
package com.barchart.udt.nio;
|
||||
|
||||
import com.barchart.udt.ExceptionUDT;
|
||||
import com.barchart.udt.SocketUDT;
|
||||
import com.barchart.udt.TypeUDT;
|
||||
import com.barchart.udt.anno.ThreadSafe;
|
||||
import org.slf4j.Logger;
|
||||
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;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.barchart.udt.ExceptionUDT;
|
||||
import com.barchart.udt.SocketUDT;
|
||||
import com.barchart.udt.TypeUDT;
|
||||
import com.barchart.udt.anno.ThreadSafe;
|
||||
|
||||
/**
|
||||
* {@link SocketChannel}-like wrapper for {@link SocketUDT}, can be either
|
||||
|
@ -57,7 +54,8 @@ import com.barchart.udt.anno.ThreadSafe;
|
|||
*/
|
||||
public class SocketChannelUDT extends SocketChannel implements ChannelUDT {
|
||||
|
||||
protected static final Logger log = LoggerFactory.getLogger(SocketChannelUDT.class);
|
||||
protected static final Logger log = LoggerFactory
|
||||
.getLogger(SocketChannelUDT.class);
|
||||
|
||||
protected final Object connectLock = new Object();
|
||||
|
||||
|
@ -78,13 +76,22 @@ public class SocketChannelUDT extends SocketChannel implements ChannelUDT {
|
|||
|
||||
private InetSocketAddress remoteSocket;
|
||||
|
||||
protected SocketChannelUDT(final SelectorProviderUDT provider, final SocketUDT socketUDT) throws ExceptionUDT {
|
||||
protected SocketChannelUDT( //
|
||||
final SelectorProviderUDT provider, //
|
||||
final SocketUDT socketUDT //
|
||||
) throws ExceptionUDT {
|
||||
|
||||
super(provider);
|
||||
this.socketUDT = socketUDT;
|
||||
this.socketUDT.setBlocking(true);
|
||||
}
|
||||
|
||||
protected SocketChannelUDT(final SelectorProviderUDT provider, final SocketUDT socketUDT, final boolean isConnected) throws ExceptionUDT {
|
||||
protected SocketChannelUDT( //
|
||||
final SelectorProviderUDT provider, //
|
||||
final SocketUDT socketUDT, //
|
||||
final boolean isConnected //
|
||||
) throws ExceptionUDT {
|
||||
|
||||
this(provider, socketUDT);
|
||||
|
||||
if (isConnected) {
|
||||
|
@ -94,6 +101,7 @@ public class SocketChannelUDT extends SocketChannel implements ChannelUDT {
|
|||
isConnectFinished = false;
|
||||
isConnectionPending = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -232,15 +240,6 @@ public class SocketChannelUDT extends SocketChannel implements ChannelUDT {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* java 7
|
||||
*/
|
||||
@Override
|
||||
public
|
||||
SocketAddress getRemoteAddress() throws IOException {
|
||||
throw new UnsupportedOperationException("feature not available");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void implCloseSelectableChannel() throws IOException {
|
||||
socketUDT.close();
|
||||
|
@ -358,7 +357,8 @@ public class SocketChannelUDT extends SocketChannel implements ChannelUDT {
|
|||
}
|
||||
|
||||
@Override
|
||||
public long read(final ByteBuffer[] dsts, final int offset, final int length) throws IOException {
|
||||
public long read(final ByteBuffer[] dsts, final int offset, final int length)
|
||||
throws IOException {
|
||||
throw new RuntimeException("feature not available");
|
||||
}
|
||||
|
||||
|
@ -477,9 +477,11 @@ public class SocketChannelUDT extends SocketChannel implements ChannelUDT {
|
|||
}
|
||||
|
||||
@Override
|
||||
public long write(final ByteBuffer[] bufferArray, final int offset, final int length) throws IOException {
|
||||
public long write(final ByteBuffer[] bufferArray, final int offset,
|
||||
final int length) throws IOException {
|
||||
|
||||
try {
|
||||
|
||||
long total = 0;
|
||||
|
||||
for (int index = offset; index < offset + length; index++) {
|
||||
|
@ -503,15 +505,7 @@ public class SocketChannelUDT extends SocketChannel implements ChannelUDT {
|
|||
} catch (final Throwable e) {
|
||||
throw new IOException("failed to write buffer array", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* java 7
|
||||
*/
|
||||
@Override
|
||||
public
|
||||
SocketAddress getLocalAddress() throws IOException {
|
||||
throw new UnsupportedOperationException("feature not available");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -520,54 +514,12 @@ public class SocketChannelUDT extends SocketChannel implements ChannelUDT {
|
|||
}
|
||||
|
||||
/** java 7 */
|
||||
@Override
|
||||
public SocketChannelUDT bind(final SocketAddress localAddress) throws IOException {
|
||||
public SocketChannelUDT bind(final SocketAddress localAddress)
|
||||
throws IOException {
|
||||
|
||||
socketUDT.bind((InetSocketAddress) localAddress);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* java 7
|
||||
*/
|
||||
@Override
|
||||
public
|
||||
<T> SocketChannel setOption(final SocketOption<T> option, final T value) throws IOException {
|
||||
throw new UnsupportedOperationException("feature not available");
|
||||
}
|
||||
|
||||
/**
|
||||
* java 7
|
||||
*/
|
||||
@Override
|
||||
public
|
||||
<T> T getOption(final SocketOption<T> name) throws IOException {
|
||||
throw new UnsupportedOperationException("feature not available");
|
||||
}
|
||||
|
||||
/**
|
||||
* java 7
|
||||
*/
|
||||
@Override
|
||||
public
|
||||
Set<SocketOption<?>> supportedOptions() {
|
||||
throw new UnsupportedOperationException("feature not available");
|
||||
}
|
||||
|
||||
/**
|
||||
* java 7
|
||||
*/
|
||||
@Override
|
||||
public
|
||||
SocketChannel shutdownInput() throws IOException {
|
||||
throw new UnsupportedOperationException("feature not available");
|
||||
}
|
||||
|
||||
/**
|
||||
* java 7
|
||||
*/
|
||||
@Override
|
||||
public
|
||||
SocketChannel shutdownOutput() throws IOException {
|
||||
throw new UnsupportedOperationException("feature not available");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user