diff options
Diffstat (limited to 'plugins/org.eclipse.net4j.tcp/src/org')
4 files changed, 12 insertions, 12 deletions
diff --git a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/ControlChannel.java b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/ControlChannel.java index a1f62d868a..4297b91353 100644 --- a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/ControlChannel.java +++ b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/ControlChannel.java @@ -31,10 +31,8 @@ import java.nio.ByteBuffer; /** * @author Eike Stepper */ -public final class ControlChannel extends Channel +public class ControlChannel extends Channel { - public static final long REGISTRATION_TIMEOUT = OM.PROTOCOL_REGISTRATION_TIMEOUT; - public static final short CONTROL_CHANNEL_INDEX = -1; public static final byte OPCODE_NEGOTIATION = 1; @@ -66,7 +64,7 @@ public final class ControlChannel extends Channel return (TCPConnector)getChannelMultiplexer(); } - public boolean registerChannel(int channelID, short channelIndex, IProtocol protocol) + public boolean registerChannel(int channelID, short channelIndex, IProtocol protocol, long timeout) { if (TRACER.isEnabled()) { @@ -84,10 +82,10 @@ public final class ControlChannel extends Channel BufferUtil.putUTF8(byteBuffer, protocol == null ? null : protocol.getType()); handleBuffer(buffer); - Boolean acknowledged = registration.get(REGISTRATION_TIMEOUT); + Boolean acknowledged = registration.get(timeout); if (acknowledged == null) { - throw new TimeoutRuntimeException("Registration timeout after " + REGISTRATION_TIMEOUT + " milliseconds"); + throw new TimeoutRuntimeException("Registration timeout after " + timeout + " milliseconds"); } return acknowledged; diff --git a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPAcceptor.java b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPAcceptor.java index 9f82528b38..235e7356c2 100644 --- a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPAcceptor.java +++ b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPAcceptor.java @@ -180,7 +180,7 @@ public class TCPAcceptor extends Acceptor implements ITCPAcceptor, ITCPPassiveSe // socketChannel.socket().setKeepAlive(true); socketChannel.configureBlocking(false); - TCPServerConnector connector = new TCPServerConnector(this); + TCPServerConnector connector = createConnector(); prepareConnector(connector); connector.setSocketChannel(socketChannel); connector.setSelector(selector); @@ -248,4 +248,9 @@ public class TCPAcceptor extends Acceptor implements ITCPAcceptor, ITCPPassiveSe serverSocketChannel.close(); super.doDeactivate(); } + + protected TCPServerConnector createConnector() + { + return new TCPServerConnector(this); + } } diff --git a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPConnector.java b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPConnector.java index 1ef7eebed4..525141b85a 100644 --- a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPConnector.java +++ b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPConnector.java @@ -276,12 +276,12 @@ public abstract class TCPConnector extends Connector implements ITCPConnector, I } @Override - protected void registerChannelWithPeer(int channelID, short channelIndex, IProtocol protocol) + protected void registerChannelWithPeer(int channelID, short channelIndex, IProtocol protocol, long timeout) throws ConnectorException { try { - if (!controlChannel.registerChannel(channelID, channelIndex, protocol)) + if (!controlChannel.registerChannel(channelID, channelIndex, protocol, timeout)) { throw new ConnectorException("Failed to register channel with peer"); //$NON-NLS-1$ } diff --git a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/bundle/OM.java b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/bundle/OM.java index 7600c05df5..0cafb3545f 100644 --- a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/bundle/OM.java +++ b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/bundle/OM.java @@ -29,9 +29,6 @@ public abstract class OM public static final OMTracer DEBUG = BUNDLE.tracer("debug"); //$NON-NLS-1$ - public static final int PROTOCOL_REGISTRATION_TIMEOUT = BUNDLE.getDebugSupport().getDebugOption( - "protocol.registration.timeout", 10000); //$NON-NLS-1$ - public static final OMLogger LOG = BUNDLE.logger(); /** |