summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-12-31 05:33:23 (EST)
committerEike Stepper2007-12-31 05:33:23 (EST)
commit15fdbf45b21b5fd9fc768a8962e0f188593ea9d5 (patch)
treee46fe31a64b6c5e3d457405a7a146da32252989e
parentefff29073462f19307ba658fd7c3c10ef382671f (diff)
downloadcdo-15fdbf45b21b5fd9fc768a8962e0f188593ea9d5.zip
cdo-15fdbf45b21b5fd9fc768a8962e0f188593ea9d5.tar.gz
cdo-15fdbf45b21b5fd9fc768a8962e0f188593ea9d5.tar.bz2
[214034] Fix JVM Connector
https://bugs.eclipse.org/bugs/show_bug.cgi?id=214034
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Repository.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/net4j/org/eclipse/net4j/tests/AbstractTransportTest.java52
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AbstractCDOTest.java8
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/TDD.java4
-rw-r--r--plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMAcceptor.java7
-rw-r--r--plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMClientConnector.java11
-rw-r--r--plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMConnector.java46
-rw-r--r--plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMConnectorFactory.java2
-rw-r--r--plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/jvm/JVMUtil.java42
-rw-r--r--plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPConnector.java12
-rw-r--r--plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPServerConnector.java8
-rw-r--r--plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/AbstractTransportTest.java52
-rw-r--r--plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/FailOverTest.java5
-rw-r--r--plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/SignalTest.java2
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/buffer/Buffer.java8
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/connector/Connector.java12
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/stream/BufferInputStream.java2
18 files changed, 210 insertions, 72 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Repository.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Repository.java
index a287433..4463d40 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Repository.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Repository.java
@@ -240,6 +240,12 @@ public class Repository extends Container<IRepositoryElement> implements IReposi
{
return "TypeManager-" + name;
}
+
+ @Override
+ public String toString()
+ {
+ return getThreadName();
+ }
};
}
diff --git a/plugins/org.eclipse.emf.cdo.tests/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.tests/META-INF/MANIFEST.MF
index 5556ab3..1ae9d66 100644
--- a/plugins/org.eclipse.emf.cdo.tests/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo.tests/META-INF/MANIFEST.MF
@@ -10,7 +10,8 @@ Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.3.0,4.0.0)",
org.eclipse.emf.ecore.xmi;bundle-version="[2.3.0,3.0.0)",
- org.eclipse.net4j.tcp;bundle-version="[0.8.0,0.9.0)",
+ org.eclipse.net4j.jvm;bundle-version="0.8.0";resolution:=optional,
+ org.eclipse.net4j.tcp;bundle-version="[0.8.0,0.9.0)";resolution:=optional,
org.eclipse.emf.cdo.server;bundle-version="[0.8.0,0.9.0)",
org.eclipse.emf.cdo;bundle-version="[0.8.0,0.9.0)",
org.eclipse.emf.cdo.tests.model1;bundle-version="[0.8.0,0.9.0)",
diff --git a/plugins/org.eclipse.emf.cdo.tests/net4j/org/eclipse/net4j/tests/AbstractTransportTest.java b/plugins/org.eclipse.emf.cdo.tests/net4j/org/eclipse/net4j/tests/AbstractTransportTest.java
index 9d5802d..05c0051 100644
--- a/plugins/org.eclipse.emf.cdo.tests/net4j/org/eclipse/net4j/tests/AbstractTransportTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/net4j/org/eclipse/net4j/tests/AbstractTransportTest.java
@@ -11,7 +11,10 @@
package org.eclipse.net4j.tests;
import org.eclipse.net4j.Net4jUtil;
+import org.eclipse.net4j.acceptor.IAcceptor;
+import org.eclipse.net4j.connector.IConnector;
import org.eclipse.net4j.internal.util.container.ManagedContainer;
+import org.eclipse.net4j.jvm.JVMUtil;
import org.eclipse.net4j.tcp.TCPUtil;
import org.eclipse.net4j.util.container.IManagedContainer;
import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
@@ -28,9 +31,9 @@ public abstract class AbstractTransportTest extends AbstractOMTest
protected IManagedContainer container;
- private Acceptor acceptor;
+ private IAcceptor acceptor;
- private Connector connector;
+ private IConnector connector;
@Override
protected void doSetUp() throws Exception
@@ -57,29 +60,56 @@ public abstract class AbstractTransportTest extends AbstractOMTest
}
}
+ protected boolean useJVMTransport()
+ {
+ return false;
+ }
+
protected IManagedContainer createContainer()
{
IManagedContainer container = new ManagedContainer();
Net4jUtil.prepareContainer(container);
- TCPUtil.prepareContainer(container);
+ if (useJVMTransport())
+ {
+ JVMUtil.prepareContainer(container);
+ }
+ else
+ {
+ TCPUtil.prepareContainer(container);
+ }
+
return container;
}
- protected Acceptor getAcceptor()
+ protected IAcceptor getAcceptor()
{
if (acceptor == null)
{
- acceptor = (Acceptor)TCPUtil.getAcceptor(container, null);
+ if (useJVMTransport())
+ {
+ acceptor = (Acceptor)JVMUtil.getAcceptor(container, "default");
+ }
+ else
+ {
+ acceptor = (Acceptor)TCPUtil.getAcceptor(container, null);
+ }
}
return acceptor;
}
- protected Connector getConnector()
+ protected IConnector getConnector()
{
if (connector == null)
{
- connector = (Connector)TCPUtil.getConnector(container, HOST);
+ if (useJVMTransport())
+ {
+ connector = (Connector)JVMUtil.getConnector(container, "default");
+ }
+ else
+ {
+ connector = (Connector)TCPUtil.getConnector(container, HOST);
+ }
}
return connector;
@@ -89,11 +119,11 @@ public abstract class AbstractTransportTest extends AbstractOMTest
{
if (container != null)
{
- Acceptor acceptor = getAcceptor();
- acceptor.activate();
+ IAcceptor acceptor = getAcceptor();
+ LifecycleUtil.activate(acceptor);
- Connector connector = getConnector();
- connector.activate();
+ IConnector connector = getConnector();
+ LifecycleUtil.activate(connector);
}
}
}
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AbstractCDOTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AbstractCDOTest.java
index 99f97e9..faf4548 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AbstractCDOTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AbstractCDOTest.java
@@ -41,6 +41,12 @@ public abstract class AbstractCDOTest extends AbstractTransportTest
public static final String REPOSITORY_NAME = "repo1";
@Override
+ protected boolean useJVMTransport()
+ {
+ return true;
+ }
+
+ @Override
protected IManagedContainer createContainer()
{
IManagedContainer container = super.createContainer();
@@ -98,7 +104,7 @@ public abstract class AbstractCDOTest extends AbstractTransportTest
protected CDOSession openModel1Session()
{
- CDOSession session = CDOUtil.openSession(getConnector(), REPOSITORY_NAME);
+ CDOSession session = CDOUtil.openSession(getConnector(), REPOSITORY_NAME, true);
session.getPackageRegistry().putEPackage(Model1Package.eINSTANCE);
return session;
}
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/TDD.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/TDD.java
index 5138c9a..2d3723e 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/TDD.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/TDD.java
@@ -21,9 +21,9 @@ import java.lang.reflect.Method;
*/
public class TDD
{
- private static final AbstractOMTest test = new TransactionDeadLockTest();
+ private static final AbstractOMTest test = new InitialTest();
- private static final String METHOD_NAME = "_testCreateManyTransaction";
+ private static final String METHOD_NAME = "testOpenSession";
public static void main(String[] args) throws Throwable
{
diff --git a/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMAcceptor.java b/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMAcceptor.java
index a2fac0f..2a0f677 100644
--- a/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMAcceptor.java
+++ b/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMAcceptor.java
@@ -12,6 +12,7 @@ package org.eclipse.net4j.internal.jvm;
import org.eclipse.net4j.jvm.IJVMAcceptor;
import org.eclipse.net4j.util.StringUtil;
+import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
import org.eclipse.internal.net4j.acceptor.Acceptor;
@@ -41,6 +42,12 @@ public class JVMAcceptor extends Acceptor implements IJVMAcceptor
public JVMServerConnector handleAccept(JVMClientConnector client)
{
JVMServerConnector connector = new JVMServerConnector(client);
+ connector.setName(client.getName());
+ connector.setBufferProvider(client.getBufferProvider());
+ connector.setReceiveExecutor(client.getReceiveExecutor());
+ connector.setProtocolFactoryRegistry(client.getProtocolFactoryRegistry());
+ connector.setProtocolPostProcessors(client.getProtocolPostProcessors());
+ LifecycleUtil.activate(connector);
addConnector(connector);
return connector;
}
diff --git a/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMClientConnector.java b/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMClientConnector.java
index 90902c4..23901b8 100644
--- a/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMClientConnector.java
+++ b/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMClientConnector.java
@@ -63,6 +63,7 @@ public class JVMClientConnector extends JVMConnector
{
super.doActivate();
JVMConnector peer = acceptor.handleAccept(this);
+ peer.addListener(peerLifecycleListener);
setPeer(peer);
}
@@ -72,14 +73,4 @@ public class JVMClientConnector extends JVMConnector
LifecycleUtil.deactivateNoisy(getPeer());
super.doDeactivate();
}
-
- protected JVMConnector createServerPeer() throws Exception
- {
- JVMServerConnector server = new JVMServerConnector(this);
- server.setBufferProvider(getBufferProvider());
- server.setReceiveExecutor(getReceiveExecutor());
- server.addListener(peerLifecycleListener);
- server.activate();
- return server;
- }
}
diff --git a/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMConnector.java b/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMConnector.java
index 03a9637..a3e9fe6 100644
--- a/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMConnector.java
+++ b/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMConnector.java
@@ -13,9 +13,15 @@ package org.eclipse.net4j.internal.jvm;
import org.eclipse.net4j.buffer.IBuffer;
import org.eclipse.net4j.channel.IChannel;
import org.eclipse.net4j.connector.ConnectorException;
+import org.eclipse.net4j.connector.ConnectorLocation;
+import org.eclipse.net4j.connector.ConnectorState;
+import org.eclipse.net4j.internal.jvm.bundle.OM;
+import org.eclipse.net4j.internal.util.om.trace.ContextTracer;
+import org.eclipse.net4j.jvm.IJVMConnector;
import org.eclipse.net4j.protocol.IProtocol;
import org.eclipse.net4j.util.security.INegotiationContext;
+import org.eclipse.internal.net4j.buffer.Buffer;
import org.eclipse.internal.net4j.channel.InternalChannel;
import org.eclipse.internal.net4j.connector.Connector;
@@ -26,8 +32,10 @@ import java.util.Queue;
*
* @author Eike Stepper
*/
-public abstract class JVMConnector extends Connector
+public abstract class JVMConnector extends Connector implements IJVMConnector
{
+ private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG, JVMConnector.class);
+
private JVMConnector peer;
private String name;
@@ -61,6 +69,23 @@ public abstract class JVMConnector extends Connector
return "jvm://" + name;
}
+ public ConnectorLocation getLocation()
+ {
+ return null;
+ }
+
+ @Override
+ public void setState(ConnectorState newState) throws ConnectorException
+ {
+ super.setState(newState);
+ }
+
+ @Override
+ public boolean waitForConnection(long timeout) throws ConnectorException
+ {
+ return super.waitForConnection(timeout);
+ }
+
public void multiplexChannel(IChannel localChannel)
{
short channelIndex = localChannel.getChannelIndex();
@@ -72,6 +97,11 @@ public abstract class JVMConnector extends Connector
Queue<IBuffer> localQueue = ((InternalChannel)localChannel).getSendQueue();
IBuffer buffer = localQueue.poll();
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace("Multiplexing " + ((Buffer)buffer).formatContent(true));
+ }
+
buffer.flip();
peerChannel.handleBufferFromMultiplexer(buffer);
}
@@ -88,7 +118,7 @@ public abstract class JVMConnector extends Connector
{
try
{
- InternalChannel channel = getPeer().createChannel(channelID, channelIndex, protocol);
+ InternalChannel channel = getPeer().createChannel(channelID, channelIndex, protocol.getType());
if (channel == null)
{
throw new ConnectorException("Failed to register channel with peer");
@@ -110,9 +140,13 @@ public abstract class JVMConnector extends Connector
protected void doBeforeActivate() throws Exception
{
super.doBeforeActivate();
- if (name == null)
- {
- throw new IllegalStateException("name == null");
- }
+ checkState(name, "name");
+ }
+
+ @Override
+ protected void doActivate() throws Exception
+ {
+ super.doActivate();
+ leaveConnecting();
}
}
diff --git a/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMConnectorFactory.java b/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMConnectorFactory.java
index 5510833..51b72b2 100644
--- a/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMConnectorFactory.java
+++ b/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMConnectorFactory.java
@@ -22,7 +22,7 @@ public class JVMConnectorFactory extends ConnectorFactory
{
public static final String TYPE = "jvm";
- public JVMConnectorFactory(String type)
+ public JVMConnectorFactory()
{
super(TYPE);
}
diff --git a/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/jvm/JVMUtil.java b/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/jvm/JVMUtil.java
new file mode 100644
index 0000000..69c8410
--- /dev/null
+++ b/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/jvm/JVMUtil.java
@@ -0,0 +1,42 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.net4j.jvm;
+
+import org.eclipse.net4j.internal.jvm.JVMAcceptorFactory;
+import org.eclipse.net4j.internal.jvm.JVMConnectorFactory;
+import org.eclipse.net4j.util.container.IManagedContainer;
+
+/**
+ * @author Eike Stepper
+ */
+public final class JVMUtil
+{
+ private JVMUtil()
+ {
+ }
+
+ public static void prepareContainer(IManagedContainer container)
+ {
+ container.registerFactory(new JVMAcceptorFactory());
+ container.registerFactory(new JVMConnectorFactory());
+ }
+
+ public static IJVMAcceptor getAcceptor(IManagedContainer container, String description)
+ {
+ return (IJVMAcceptor)container.getElement(JVMAcceptorFactory.PRODUCT_GROUP, JVMAcceptorFactory.TYPE, description);
+ }
+
+ public static IJVMConnector getConnector(IManagedContainer container, String description)
+ {
+ return (IJVMConnector)container
+ .getElement(JVMConnectorFactory.PRODUCT_GROUP, JVMConnectorFactory.TYPE, description);
+ }
+}
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 f42056f..0463922 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
@@ -373,18 +373,6 @@ public abstract class TCPConnector extends Connector implements ITCPConnector, I
}
}
- private void leaveConnecting()
- {
- if (getNegotiator() == null)
- {
- setState(ConnectorState.CONNECTED);
- }
- else
- {
- setState(ConnectorState.NEGOTIATING);
- }
- }
-
/**
* @author Eike Stepper
*/
diff --git a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPServerConnector.java b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPServerConnector.java
index 439941c..e0608c1 100644
--- a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPServerConnector.java
+++ b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPServerConnector.java
@@ -10,9 +10,7 @@
**************************************************************************/
package org.eclipse.net4j.internal.tcp;
-import org.eclipse.net4j.connector.ConnectorException;
import org.eclipse.net4j.connector.ConnectorLocation;
-import org.eclipse.net4j.connector.ConnectorState;
import java.nio.channels.SelectionKey;
import java.text.MessageFormat;
@@ -40,12 +38,6 @@ public class TCPServerConnector extends TCPConnector
}
@Override
- public void setState(ConnectorState newState) throws ConnectorException
- {
- super.setState(newState);
- }
-
- @Override
public String getHost()
{
try
diff --git a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/AbstractTransportTest.java b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/AbstractTransportTest.java
index ba59016..2850dbe 100644
--- a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/AbstractTransportTest.java
+++ b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/AbstractTransportTest.java
@@ -11,7 +11,10 @@
package org.eclipse.net4j.tests;
import org.eclipse.net4j.Net4jUtil;
+import org.eclipse.net4j.acceptor.IAcceptor;
+import org.eclipse.net4j.connector.IConnector;
import org.eclipse.net4j.internal.util.container.ManagedContainer;
+import org.eclipse.net4j.jvm.JVMUtil;
import org.eclipse.net4j.tcp.TCPUtil;
import org.eclipse.net4j.util.container.IManagedContainer;
import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
@@ -29,9 +32,9 @@ public abstract class AbstractTransportTest extends AbstractOMTest
protected IManagedContainer container;
- private Acceptor acceptor;
+ private IAcceptor acceptor;
- private Connector connector;
+ private IConnector connector;
@Override
protected void doSetUp() throws Exception
@@ -58,29 +61,56 @@ public abstract class AbstractTransportTest extends AbstractOMTest
}
}
+ protected boolean useJVMTransport()
+ {
+ return false;
+ }
+
protected IManagedContainer createContainer()
{
IManagedContainer container = new ManagedContainer();
Net4jUtil.prepareContainer(container);
- TCPUtil.prepareContainer(container);
+ if (useJVMTransport())
+ {
+ JVMUtil.prepareContainer(container);
+ }
+ else
+ {
+ TCPUtil.prepareContainer(container);
+ }
+
return container;
}
- protected Acceptor getAcceptor()
+ protected IAcceptor getAcceptor()
{
if (acceptor == null)
{
- acceptor = (Acceptor)TCPUtil.getAcceptor(container, null);
+ if (useJVMTransport())
+ {
+ acceptor = (Acceptor)JVMUtil.getAcceptor(container, "default");
+ }
+ else
+ {
+ acceptor = (Acceptor)TCPUtil.getAcceptor(container, null);
+ }
}
return acceptor;
}
- protected Connector getConnector()
+ protected IConnector getConnector()
{
if (connector == null)
{
- connector = (Connector)TCPUtil.getConnector(container, HOST);
+ if (useJVMTransport())
+ {
+ connector = (Connector)JVMUtil.getConnector(container, "default");
+ }
+ else
+ {
+ connector = (Connector)TCPUtil.getConnector(container, HOST);
+ }
}
return connector;
@@ -90,11 +120,11 @@ public abstract class AbstractTransportTest extends AbstractOMTest
{
if (container != null)
{
- Acceptor acceptor = getAcceptor();
- acceptor.activate();
+ IAcceptor acceptor = getAcceptor();
+ LifecycleUtil.activate(acceptor);
- Connector connector = getConnector();
- connector.activate();
+ IConnector connector = getConnector();
+ LifecycleUtil.activate(connector);
}
}
}
diff --git a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/FailOverTest.java b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/FailOverTest.java
index 215fde7..5d3f9d8 100644
--- a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/FailOverTest.java
+++ b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/FailOverTest.java
@@ -18,6 +18,7 @@ import org.eclipse.net4j.tests.signal.IntRequest;
import org.eclipse.net4j.tests.signal.TestSignalClientProtocolFactory;
import org.eclipse.net4j.tests.signal.TestSignalServerProtocolFactory;
import org.eclipse.net4j.util.container.IManagedContainer;
+import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
/**
* @author Eike Stepper
@@ -39,7 +40,7 @@ public class FailOverTest extends AbstractTransportTest
IChannel channel = getConnector().openChannel(TestSignalClientProtocolFactory.TYPE, null);
// Simulate a disconnect from the server.
- getAcceptor().deactivate();
+ LifecycleUtil.deactivate(getAcceptor());
int data = 0x0a;
IFailOverStrategy failOverStrategy = new RetryFailOverStrategy(getConnector());
@@ -63,7 +64,7 @@ public class FailOverTest extends AbstractTransportTest
IntRequest request = new IntRequest(channel, data);
// Simulate a disconnect from the server.
- getAcceptor().deactivate();
+ LifecycleUtil.deactivate(getAcceptor());
int result = failOverStrategy.send(request);
assertEquals(data, result);
diff --git a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/SignalTest.java b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/SignalTest.java
index a26ad87..f9fd894 100644
--- a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/SignalTest.java
+++ b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/SignalTest.java
@@ -55,7 +55,7 @@ public class SignalTest extends AbstractTransportTest
assertTrue(Arrays.equals(data, result));
}
- public void _testAsync() throws Exception
+ public void testAsync() throws Exception
{
startTransport();
OMPlatform.INSTANCE.setDebugging(false);
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/buffer/Buffer.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/buffer/Buffer.java
index 67084b4..5732770 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/buffer/Buffer.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/buffer/Buffer.java
@@ -183,7 +183,7 @@ public class Buffer implements IBuffer
if (TRACER.isEnabled())
{
TRACER.trace("Read " + byteBuffer.limit() + " bytes" //$NON-NLS-1$ //$NON-NLS-2$
- + (eos ? " (EOS)" : "") + StringUtil.NL + formatContent()); //$NON-NLS-1$ //$NON-NLS-2$
+ + (eos ? " (EOS)" : "") + StringUtil.NL + formatContent(false)); //$NON-NLS-1$ //$NON-NLS-2$
}
byteBuffer.flip();
@@ -242,7 +242,7 @@ public class Buffer implements IBuffer
if (TRACER.isEnabled())
{
TRACER.trace("Writing " + (Math.abs(payloadSize) - 1) + " bytes" //$NON-NLS-1$ //$NON-NLS-2$
- + (eos ? " (EOS)" : "") + StringUtil.NL + formatContent()); //$NON-NLS-1$ //$NON-NLS-2$
+ + (eos ? " (EOS)" : "") + StringUtil.NL + formatContent(false)); //$NON-NLS-1$ //$NON-NLS-2$
}
byteBuffer.flip();
@@ -286,7 +286,7 @@ public class Buffer implements IBuffer
}
@SuppressWarnings("deprecation")
- public String formatContent()
+ public String formatContent(boolean showHeader)
{
final int oldPosition = byteBuffer.position();
final int oldLimit = byteBuffer.limit();
@@ -298,7 +298,7 @@ public class Buffer implements IBuffer
byteBuffer.flip();
}
- if (state == BufferState.PUTTING)
+ if (state == BufferState.PUTTING && !showHeader)
{
byteBuffer.position(HEADER_SIZE);
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/connector/Connector.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/connector/Connector.java
index e1ef6d7..12972e6 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/connector/Connector.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/connector/Connector.java
@@ -605,6 +605,18 @@ public abstract class Connector extends Container<IChannel> implements IConnecto
}
}
+ protected void leaveConnecting()
+ {
+ if (getNegotiator() == null)
+ {
+ setState(ConnectorState.CONNECTED);
+ }
+ else
+ {
+ setState(ConnectorState.NEGOTIATING);
+ }
+ }
+
protected abstract INegotiationContext createNegotiationContext();
/**
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/stream/BufferInputStream.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/stream/BufferInputStream.java
index d3937be..54cea73 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/stream/BufferInputStream.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/stream/BufferInputStream.java
@@ -109,7 +109,6 @@ public class BufferInputStream extends InputStream implements IBufferHandler
{
if (timeout == NO_TIMEOUT)
{
- // System.out.println("while (currentBuffer == null)");
while (currentBuffer == null)
{
if (buffers == null)
@@ -118,7 +117,6 @@ public class BufferInputStream extends InputStream implements IBufferHandler
return false;
}
- // System.out.println("buffers.poll");
currentBuffer = buffers.poll(check, TimeUnit.MILLISECONDS);
}
}