summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2008-05-26 03:04:40 (EDT)
committerEike Stepper2008-05-26 03:04:40 (EDT)
commit4dac74512359d1fa2e9dff585004eb6a58d9d915 (patch)
tree4da928a1454bf9d2b8d1cbac60ff4a4d797c8667
parentaf248df935fefa09d4347b661e607b8ad985a3cf (diff)
downloadcdo-4dac74512359d1fa2e9dff585004eb6a58d9d915.zip
cdo-4dac74512359d1fa2e9dff585004eb6a58d9d915.tar.gz
cdo-4dac74512359d1fa2e9dff585004eb6a58d9d915.tar.bz2
[232648] Provide an HTTPConnector
https://bugs.eclipse.org/bugs/show_bug.cgi?id=232648
-rw-r--r--plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/HTTPAcceptor.java1
-rw-r--r--plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/HTTPServerConnector.java7
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/acceptor/Acceptor.java20
3 files changed, 15 insertions, 13 deletions
diff --git a/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/HTTPAcceptor.java b/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/HTTPAcceptor.java
index 4f0aaa3..63d4d01 100644
--- a/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/HTTPAcceptor.java
+++ b/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/HTTPAcceptor.java
@@ -204,6 +204,7 @@ public class HTTPAcceptor extends Acceptor implements IHTTPAcceptor, INet4jTrans
super.doBeforeActivate();
checkState(randomizer, "randomizer");
checkState(connectorIDLength > 0, "Constraint violated: connectorIDLength > 0");
+ checkState(maxIdleTime >= 100, "Constraint violated: maxIdleTime >= 100");
}
@Override
diff --git a/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/HTTPServerConnector.java b/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/HTTPServerConnector.java
index 1e3e3a0..7541c68 100644
--- a/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/HTTPServerConnector.java
+++ b/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/HTTPServerConnector.java
@@ -110,4 +110,11 @@ public class HTTPServerConnector extends HTTPConnector
{
throw new UnsupportedOperationException();
}
+
+ @Override
+ protected void doActivate() throws Exception
+ {
+ super.doActivate();
+ leaveConnecting();
+ }
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/acceptor/Acceptor.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/acceptor/Acceptor.java
index 088d754..0b9aef7 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/acceptor/Acceptor.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/acceptor/Acceptor.java
@@ -14,15 +14,13 @@ import org.eclipse.net4j.acceptor.IAcceptor;
import org.eclipse.net4j.buffer.IBufferProvider;
import org.eclipse.net4j.connector.IConnector;
import org.eclipse.net4j.internal.util.container.Container;
-import org.eclipse.net4j.internal.util.container.LifecycleEventConverter;
+import org.eclipse.net4j.internal.util.lifecycle.LifecycleEventAdapter;
import org.eclipse.net4j.internal.util.om.trace.ContextTracer;
-import org.eclipse.net4j.util.container.IContainer;
-import org.eclipse.net4j.util.container.IContainerEvent;
import org.eclipse.net4j.util.container.IElementProcessor;
-import org.eclipse.net4j.util.container.IContainerDelta.Kind;
import org.eclipse.net4j.util.event.IListener;
import org.eclipse.net4j.util.factory.IFactory;
import org.eclipse.net4j.util.factory.IFactoryKey;
+import org.eclipse.net4j.util.lifecycle.ILifecycle;
import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
import org.eclipse.net4j.util.registry.IRegistry;
import org.eclipse.net4j.util.security.INegotiator;
@@ -52,16 +50,12 @@ public abstract class Acceptor extends Container<IConnector> implements IAccepto
private ExecutorService receiveExecutor;
- /**
- * Is registered with each {@link IConnector} of this {@link IAcceptor}.
- */
- private transient IListener lifecycleEventConverter = new LifecycleEventConverter<IConnector>(this)
+ private transient IListener connectorListener = new LifecycleEventAdapter()
{
@Override
- protected IContainerEvent<IConnector> createContainerEvent(IContainer<IConnector> container, IConnector element,
- Kind kind)
+ protected void onDeactivated(ILifecycle lifecycle)
{
- return newContainerEvent(element, kind);
+ removeConnector((IConnector)lifecycle);
}
};
@@ -156,7 +150,7 @@ public abstract class Acceptor extends Container<IConnector> implements IAccepto
acceptedConnectors.add(connector);
}
- connector.addListener(lifecycleEventConverter);
+ connector.addListener(connectorListener);
if (TRACER.isEnabled())
{
TRACER.trace("Added connector " + connector); //$NON-NLS-1$
@@ -167,7 +161,7 @@ public abstract class Acceptor extends Container<IConnector> implements IAccepto
public void removeConnector(IConnector connector)
{
- connector.removeListener(lifecycleEventConverter);
+ connector.removeListener(connectorListener);
synchronized (acceptedConnectors)
{
acceptedConnectors.remove(connector);