JBoss Remoting SVN: r3665 - remoting2/branches/2.x.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-03-19 03:40:40 -0400 (Wed, 19 Mar 2008)
New Revision: 3665
Modified:
remoting2/branches/2.x/build.xml
Log:
JBREM-923: Added 2.2.2.SP5 compatibility test.
Modified: remoting2/branches/2.x/build.xml
===================================================================
--- remoting2/branches/2.x/build.xml 2008-03-19 06:28:50 UTC (rev 3664)
+++ remoting2/branches/2.x/build.xml 2008-03-19 07:40:40 UTC (rev 3665)
@@ -1404,6 +1404,30 @@
</antcall>
<!-- ******************************************************************************** -->
+ <!-- Current <- -> 2.2.2.SP5 -->
+ <antcall target="tests.versioning.all_transports" inheritrefs="true">
+ <param name="jboss-junit-configuration" value="2_2_2_SP5-client"/>
+ <param name="client.classpath" value="${etc.dir}/lib/remoting_2_2_2_SP5/jboss-remoting.jar"/>
+ <param name="server.classpath" value="${output.lib.dir}/jboss-remoting.jar"/>
+ <param name="client.pre_2_0_compatible" value=""/>
+ <param name="server.pre_2_0_compatible" value=""/>
+ <param name="client.version" value=""/>
+ <param name="server.version" value="2"/>
+ <param name="check_connection" value="false"/>
+ </antcall>
+ <antcall target="tests.versioning.all_transports" inheritrefs="true">
+ <param name="jboss-junit-configuration" value="2_2_2_SP5-server"/>
+ <param name="server.classpath" value="${etc.dir}/lib/remoting_2_2_2_SP5/jboss-remoting.jar"/>
+ <param name="client.classpath" value="${output.lib.dir}/jboss-remoting.jar"/>
+ <param name="client.pre_2_0_compatible" value=""/>
+ <param name="server.pre_2_0_compatible" value=""/>
+ <param name="client.version" value="2"/>
+ <param name="server.version" value=""/>
+ <param name="check_connection" value="false"/>
+ <param name="check_content_type" value="true"/>
+ </antcall>
+
+ <!-- ******************************************************************************** -->
<!-- Current <- -> 2.2.2.SP4 -->
<antcall target="tests.versioning.all_transports" inheritrefs="true">
<param name="jboss-junit-configuration" value="2_2_2_SP4-client"/>
16 years, 2 months
JBoss Remoting SVN: r3664 - in remoting2/branches/2.x/src/etc/lib: remoting_2_2_2_SP5 and 1 other directory.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-03-19 02:28:50 -0400 (Wed, 19 Mar 2008)
New Revision: 3664
Added:
remoting2/branches/2.x/src/etc/lib/remoting_2_2_2_SP5/
remoting2/branches/2.x/src/etc/lib/remoting_2_2_2_SP5/jboss-remoting.jar
Log:
JBREM-923: Added 2.2.2.SP5 jboss-remoting.jar.
Added: remoting2/branches/2.x/src/etc/lib/remoting_2_2_2_SP5/jboss-remoting.jar
===================================================================
(Binary files differ)
Property changes on: remoting2/branches/2.x/src/etc/lib/remoting_2_2_2_SP5/jboss-remoting.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
16 years, 2 months
JBoss Remoting SVN: r3663 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-03-18 23:13:04 -0400 (Tue, 18 Mar 2008)
New Revision: 3663
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/RMIServerInvoker.java
Log:
JBREM-933: Tests if client socket factory is null before clearing it.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/RMIServerInvoker.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/RMIServerInvoker.java 2008-03-19 03:04:07 UTC (rev 3662)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/RMIServerInvoker.java 2008-03-19 03:13:04 UTC (rev 3663)
@@ -314,7 +314,8 @@
}
- csf.clear();
+ if (csf != null)
+ csf.clear();
if (isPrimaryServer)
{
16 years, 2 months
JBoss Remoting SVN: r3662 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-03-18 23:04:07 -0400 (Tue, 18 Mar 2008)
New Revision: 3662
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/RMIClientInvoker.java
Log:
JBREM-933: Fixed handleConnect() for multihome case.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/RMIClientInvoker.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/RMIClientInvoker.java 2008-03-18 03:22:11 UTC (rev 3661)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/RMIClientInvoker.java 2008-03-19 03:04:07 UTC (rev 3662)
@@ -210,7 +210,6 @@
protected void handleConnect()
throws ConnectionFailedException
{
- storeLocalConfig(configuration);
int registryPort = getRegistryPort(locator);
Home home = null;
Exception savedException = null;
@@ -226,6 +225,7 @@
String host = home.host;
int port = home.port;
locator.setHomeInUse(home);
+ storeLocalConfig(configuration);
log.debug(this + " looking up registry: " + host + "," + port);
Registry registry = LocateRegistry.getRegistry(host, registryPort);
log.debug(this + " trying to connect to: " + home);
@@ -239,6 +239,7 @@
{
savedException = e;
connected = false;
+ RemotingRMIClientSocketFactory.removeLocalConfiguration(locator);
log.trace("Unable to connect RMI invoker client to " + home, e);
}
16 years, 2 months
JBoss Remoting SVN: r3661 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport/sslrmi.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-03-17 23:22:11 -0400 (Mon, 17 Mar 2008)
New Revision: 3661
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/sslrmi/SSLRMIServerInvoker.java
Log:
JBREM-933: Updated return type of getRMIClientSocketFactory().
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/sslrmi/SSLRMIServerInvoker.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/sslrmi/SSLRMIServerInvoker.java 2008-03-17 21:59:58 UTC (rev 3660)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/sslrmi/SSLRMIServerInvoker.java 2008-03-18 03:22:11 UTC (rev 3661)
@@ -26,11 +26,11 @@
import org.jboss.remoting.Remoting;
import org.jboss.remoting.security.SSLSocketBuilder;
import org.jboss.remoting.transport.rmi.RMIServerInvoker;
+import org.jboss.remoting.transport.rmi.RemotingRMIClientSocketFactory;
import javax.net.ServerSocketFactory;
import javax.net.SocketFactory;
import java.io.IOException;
-import java.rmi.server.RMIClientSocketFactory;
import java.util.HashMap;
import java.util.Map;
@@ -55,7 +55,7 @@
super(locator, configuration);
}
- protected RMIClientSocketFactory getRMIClientSocketFactory(String ignored)
+ protected RemotingRMIClientSocketFactory getRMIClientSocketFactory(String ignored)
{
// Remove from config map any properties relating to keystore and truststore.
HashMap remoteConfig = new HashMap(configuration);
16 years, 2 months
JBoss Remoting SVN: r3660 - in remoting3/trunk: api/src/main/java/org/jboss/cx/remoting/spi/protocol and 7 other directories.
by jboss-remoting-commits@lists.jboss.org
Author: david.lloyd(a)jboss.com
Date: 2008-03-17 17:59:58 -0400 (Mon, 17 Mar 2008)
New Revision: 3660
Added:
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/protocol/LocalProtocolHandler.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/protocol/LocalProtocolHandlerFactory.java
Removed:
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/protocol/ProtocolRegistration.java
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/protocol/ProtocolRegistrationSpec.java
Modified:
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/Endpoint.java
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/wrapper/EndpointWrapper.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreEndpoint.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreSession.java
remoting3/trunk/http/src/main/java/org/jboss/cx/remoting/http/HttpProtocolSupport.java
remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/JrppProtocolSupport.java
remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/JrppServer.java
remoting3/trunk/standalone/src/main/java/org/jboss/cx/remoting/Remoting.java
remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/CollectionUtil.java
Log:
Start off a new local protocol handler using the new "system" - need to work out the best way to supply a root context to an incoming session
Modified: remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/Endpoint.java
===================================================================
--- remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/Endpoint.java 2008-03-17 08:17:37 UTC (rev 3659)
+++ remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/Endpoint.java 2008-03-17 21:59:58 UTC (rev 3660)
@@ -3,8 +3,10 @@
import java.net.URI;
import java.util.concurrent.ConcurrentMap;
import org.jboss.cx.remoting.util.AttributeMap;
-import org.jboss.cx.remoting.spi.protocol.ProtocolRegistration;
-import org.jboss.cx.remoting.spi.protocol.ProtocolRegistrationSpec;
+import org.jboss.cx.remoting.spi.protocol.ProtocolContext;
+import org.jboss.cx.remoting.spi.protocol.ProtocolHandler;
+import org.jboss.cx.remoting.spi.protocol.ProtocolHandlerFactory;
+import org.jboss.cx.remoting.spi.Registration;
/**
* A potential participant in a JBoss Remoting communications relationship.
@@ -14,19 +16,23 @@
* Get the endpoint attribute map. This is a storage area for any data associated with this endpoint, including
* (but not limited to) connection and protocol information, and application information.
*
+ * You must have the TODO permission to invoke this method.
+ *
* @return the endpoint map
*/
ConcurrentMap<Object, Object> getAttributes();
/**
- * Open a session with another endpoint. The protocol used is determined by the URI scheme. The URI user-info part
+ * Open an outbound session to another endpoint. The protocol used is determined by the URI scheme. The URI user-info part
* must be {@code null} unless the specific protocol has an additional authentication scheme (e.g. HTTP BASIC). The
* authority is used to locate the server (the exact interpretation is dependent upon the protocol). The path may be
* relative to a protocol-specific deployment path.
*
+ * You must have the TODO permission to invoke this method.
+ *
* @param remoteUri the URI of the server to connect to
* @param attributeMap the attribute map to use to configure this session
- * @param rootContext the root context for the new session
+ * @param rootContext the (local side of the) root context for the new session
* @return a new session
*
* @throws RemotingException if there is a problem creating the session, or if the request or reply type does not
@@ -35,6 +41,17 @@
<I, O> Session openSession(URI remoteUri, AttributeMap attributeMap, Context<I, O> rootContext) throws RemotingException;
/**
+ * Open an inbound session from another endpoint. Used by protocol handlers.
+ *
+ * You must have the TODO permission to invoke this method.
+ *
+ * @param handler the protocol handler to use
+ * @param rootContext the (local side of the) root context for this session
+ * @return the protocol context
+ */
+ <I, O> ProtocolContext openIncomingSession(ProtocolHandler handler, Context<I, O> rootContext) throws RemotingException;
+
+ /**
* Get the name of this endpoint.
*
* @return the endpoint name, or {@code null} if there is no name
@@ -44,19 +61,23 @@
/**
* Register a protocol specification for this endpoint.
*
- * @param spec the protocol specification
+ * You must have the TODO permission to invoke this method.
*
+ * @param scheme the URI scheme
+ * @param protocolHandlerFactory the protocol handler factory
* @return a registration that may be used to control this deployment
*
* @throws RemotingException if the protocol registration failed
* @throws IllegalArgumentException if the specification failed validation
*/
- ProtocolRegistration registerProtocol(ProtocolRegistrationSpec spec) throws RemotingException, IllegalArgumentException;
+ Registration registerProtocol(String scheme, ProtocolHandlerFactory protocolHandlerFactory) throws RemotingException, IllegalArgumentException;
/**
* Create a context that can be used to invoke a request listener on this endpoint. The context may be passed to a
* remote endpoint as part of a request or a reply, or it may be used locally.
*
+ * You must have the TODO permission to invoke this method.
+ *
* @param requestListener the request listener
* @return the context
*/
@@ -67,6 +88,8 @@
* The context source may be passed to a remote endpoint as part of a request or a reply, or it may be used locally.
* The objects that are produced by this method may be used to mass-produce {@code Context} instances.
*
+ * You must have the TODO permission to invoke this method.
+ *
* @param requestListener the request listener
* @return the context source
*/
Deleted: remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/protocol/ProtocolRegistration.java
===================================================================
--- remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/protocol/ProtocolRegistration.java 2008-03-17 08:17:37 UTC (rev 3659)
+++ remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/protocol/ProtocolRegistration.java 2008-03-17 21:59:58 UTC (rev 3660)
@@ -1,10 +0,0 @@
-package org.jboss.cx.remoting.spi.protocol;
-
-import org.jboss.cx.remoting.spi.Registration;
-
-/**
- *
- */
-public interface ProtocolRegistration extends Registration {
- ProtocolServerContext getProtocolServerContext();
-}
Deleted: remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/protocol/ProtocolRegistrationSpec.java
===================================================================
--- remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/protocol/ProtocolRegistrationSpec.java 2008-03-17 08:17:37 UTC (rev 3659)
+++ remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/protocol/ProtocolRegistrationSpec.java 2008-03-17 21:59:58 UTC (rev 3660)
@@ -1,33 +0,0 @@
-package org.jboss.cx.remoting.spi.protocol;
-
-/**
- *
- */
-public final class ProtocolRegistrationSpec {
- private final String scheme;
- private final ProtocolHandlerFactory protocolHandlerFactory;
-
- public static final ProtocolRegistrationSpec DEFAULT = new ProtocolRegistrationSpec(null, null);
-
- private ProtocolRegistrationSpec(final String scheme, final ProtocolHandlerFactory protocolHandlerFactory) {
- this.scheme = scheme;
- this.protocolHandlerFactory = protocolHandlerFactory;
- }
-
- public String getScheme() {
- return scheme;
- }
-
- public ProtocolHandlerFactory getProtocolHandlerFactory() {
- return protocolHandlerFactory;
- }
-
- public ProtocolRegistrationSpec setScheme(String scheme) {
- return new ProtocolRegistrationSpec(scheme, protocolHandlerFactory);
- }
-
- public ProtocolRegistrationSpec setProtocolHandlerFactory(ProtocolHandlerFactory protocolHandlerFactory) {
- return new ProtocolRegistrationSpec(scheme, protocolHandlerFactory);
- }
-}
-
Modified: remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/wrapper/EndpointWrapper.java
===================================================================
--- remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/wrapper/EndpointWrapper.java 2008-03-17 08:17:37 UTC (rev 3659)
+++ remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/wrapper/EndpointWrapper.java 2008-03-17 21:59:58 UTC (rev 3660)
@@ -10,8 +10,10 @@
import org.jboss.cx.remoting.ContextSource;
import org.jboss.cx.remoting.CloseHandler;
import org.jboss.cx.remoting.util.AttributeMap;
-import org.jboss.cx.remoting.spi.protocol.ProtocolRegistration;
-import org.jboss.cx.remoting.spi.protocol.ProtocolRegistrationSpec;
+import org.jboss.cx.remoting.spi.protocol.ProtocolContext;
+import org.jboss.cx.remoting.spi.protocol.ProtocolHandler;
+import org.jboss.cx.remoting.spi.protocol.ProtocolHandlerFactory;
+import org.jboss.cx.remoting.spi.Registration;
/**
*
@@ -31,12 +33,16 @@
return delegate.openSession(remoteUri, attributeMap, rootContext);
}
+ public <I, O> ProtocolContext openIncomingSession(final ProtocolHandler handler, final Context<I, O> rootContext) throws RemotingException {
+ return delegate.openIncomingSession(handler, rootContext);
+ }
+
public String getName() {
return delegate.getName();
}
- public ProtocolRegistration registerProtocol(final ProtocolRegistrationSpec spec) throws RemotingException, IllegalArgumentException {
- return delegate.registerProtocol(spec);
+ public Registration registerProtocol(String scheme, ProtocolHandlerFactory protocolHandlerFactory) throws RemotingException, IllegalArgumentException {
+ return delegate.registerProtocol(scheme, protocolHandlerFactory);
}
public <I, O> Context<I, O> createContext(final RequestListener<I, O> requestListener) {
Modified: remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreEndpoint.java
===================================================================
--- remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreEndpoint.java 2008-03-17 08:17:37 UTC (rev 3659)
+++ remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreEndpoint.java 2008-03-17 21:59:58 UTC (rev 3660)
@@ -7,7 +7,6 @@
import java.util.Iterator;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.Executor;
-import java.util.concurrent.Executors;
import org.jboss.cx.remoting.Endpoint;
import org.jboss.cx.remoting.RemotingException;
import org.jboss.cx.remoting.Session;
@@ -24,9 +23,8 @@
import org.jboss.cx.remoting.spi.protocol.ProtocolContext;
import org.jboss.cx.remoting.spi.protocol.ProtocolHandler;
import org.jboss.cx.remoting.spi.protocol.ProtocolHandlerFactory;
-import org.jboss.cx.remoting.spi.protocol.ProtocolRegistration;
-import org.jboss.cx.remoting.spi.protocol.ProtocolRegistrationSpec;
import org.jboss.cx.remoting.spi.protocol.ProtocolServerContext;
+import org.jboss.cx.remoting.spi.Registration;
import javax.security.auth.callback.Callback;
import javax.security.auth.callback.CallbackHandler;
@@ -88,6 +86,10 @@
state.requireTransition(State.INITIAL, State.UP);
}
+ public void stop() {
+ // todo
+ }
+
Executor getOrderedExecutor() {
return orderedExecutorFactory.getOrderedExecutor();
}
@@ -103,7 +105,7 @@
}
}
- public final class CoreProtocolRegistration implements ProtocolRegistration {
+ public final class CoreProtocolRegistration implements Registration {
private final CoreProtocolServerContext protocolServerContext = new CoreProtocolServerContext();
private final ProtocolHandlerFactory protocolHandlerFactory;
@@ -120,13 +122,9 @@
public void unregister() {
}
- public ProtocolHandlerFactory getProtocolHandlerFactory() {
+ private ProtocolHandlerFactory getProtocolHandlerFactory() {
return protocolHandlerFactory;
}
-
- public ProtocolServerContext getProtocolServerContext() {
- return protocolServerContext;
- }
}
public static final class SimpleClientCallbackHandler implements CallbackHandler {
@@ -184,21 +182,25 @@
}
}
+ public <I, O> ProtocolContext openIncomingSession(final ProtocolHandler handler, final Context<I, O> rootContext) throws RemotingException {
+ return null;
+ }
+
public String getName() {
return name;
}
- public ProtocolRegistration registerProtocol(ProtocolRegistrationSpec spec) throws RemotingException, IllegalArgumentException {
- if (spec.getScheme() == null) {
- throw new NullPointerException("spec.getScheme() is null");
+ public Registration registerProtocol(final String scheme, final ProtocolHandlerFactory protocolHandlerFactory) throws RemotingException, IllegalArgumentException {
+ if (scheme == null) {
+ throw new NullPointerException("scheme is null");
}
- if (spec.getProtocolHandlerFactory() == null) {
- throw new NullPointerException("spec.getProtocolHandlerFactory() is null");
+ if (protocolHandlerFactory == null) {
+ throw new NullPointerException("protocolHandlerFactory is null");
}
state.requireHold(State.UP);
try {
- final CoreProtocolRegistration registration = new CoreProtocolRegistration(spec.getProtocolHandlerFactory());
- protocolMap.put(spec.getScheme(), registration);
+ final CoreProtocolRegistration registration = new CoreProtocolRegistration(protocolHandlerFactory);
+ protocolMap.put(scheme, registration);
return registration;
} finally {
state.release();
Modified: remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreSession.java
===================================================================
--- remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreSession.java 2008-03-17 08:17:37 UTC (rev 3659)
+++ remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreSession.java 2008-03-17 21:59:58 UTC (rev 3660)
@@ -115,6 +115,9 @@
final ContextIdentifier remoteIdentifier = protocolHandler.getRemoteRootContextIdentifier();
final ProtocolContextServerImpl<I, O> contextServer = new ProtocolContextServerImpl<I,O>(remoteIdentifier);
clientContexts.put(remoteIdentifier, new WeakReference<ServerContextPair>(new ServerContextPair<I, O>(new BaseContextClient(), contextServer)));
+ final CoreOutboundContext<I, O> coreOutboundContext = new CoreOutboundContext<I, O>(executor);
+ coreOutboundContext.initialize(contextServer);
+ this.rootContext = coreOutboundContext.getUserContext();
}
<I, O> void initializeServer(final ProtocolHandler protocolHandler, final Context<I, O> rootContext) {
Added: remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/protocol/LocalProtocolHandler.java
===================================================================
--- remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/protocol/LocalProtocolHandler.java (rev 0)
+++ remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/protocol/LocalProtocolHandler.java 2008-03-17 21:59:58 UTC (rev 3660)
@@ -0,0 +1,92 @@
+package org.jboss.cx.remoting.core.protocol;
+
+import org.jboss.cx.remoting.spi.protocol.ProtocolHandler;
+import org.jboss.cx.remoting.spi.protocol.ProtocolContext;
+import org.jboss.cx.remoting.spi.protocol.ContextIdentifier;
+import org.jboss.cx.remoting.spi.protocol.RequestIdentifier;
+import org.jboss.cx.remoting.spi.protocol.ServiceIdentifier;
+import org.jboss.cx.remoting.spi.protocol.StreamIdentifier;
+import org.jboss.cx.remoting.spi.ObjectMessageOutput;
+import org.jboss.cx.remoting.util.AttributeMap;
+import org.jboss.cx.remoting.RemoteExecutionException;
+import java.net.URI;
+import java.io.IOException;
+import java.util.concurrent.Executor;
+
+/**
+ *
+ */
+public final class LocalProtocolHandler implements ProtocolHandler {
+ public LocalProtocolHandler(final ProtocolContext context, final URI remoteUri, final AttributeMap attributeMap) {
+
+ }
+
+ public void sendReply(final ContextIdentifier remoteContextIdentifier, final RequestIdentifier requestIdentifier, final Object reply) throws IOException {
+ }
+
+ public void sendException(final ContextIdentifier remoteContextIdentifier, final RequestIdentifier requestIdentifier, final RemoteExecutionException exception) throws IOException {
+ }
+
+ public void sendCancelAcknowledge(final ContextIdentifier remoteContextIdentifier, final RequestIdentifier requestIdentifier) throws IOException {
+ }
+
+ public void sendServiceClosing(final ServiceIdentifier remoteServiceIdentifier) throws IOException {
+ }
+
+ public void sendContextClosing(final ContextIdentifier remoteContextIdentifier, final boolean done) throws IOException {
+ }
+
+ public ContextIdentifier getLocalRootContextIdentifier() {
+ return null;
+ }
+
+ public ContextIdentifier getRemoteRootContextIdentifier() {
+ return null;
+ }
+
+ public ContextIdentifier openContext(final ServiceIdentifier serviceIdentifier) throws IOException {
+ return null;
+ }
+
+ public void sendContextClose(final ContextIdentifier contextIdentifier, final boolean immediate, final boolean cancel, final boolean interrupt) throws IOException {
+ }
+
+ public RequestIdentifier openRequest(final ContextIdentifier contextIdentifier) throws IOException {
+ return null;
+ }
+
+ public void sendServiceClose(final ServiceIdentifier serviceIdentifier) throws IOException {
+ }
+
+ public void sendRequest(final ContextIdentifier contextIdentifier, final RequestIdentifier requestIdentifier, final Object request, final Executor streamExecutor) throws IOException {
+ }
+
+ public void sendCancelRequest(final ContextIdentifier contextIdentifier, final RequestIdentifier requestIdentifier, final boolean mayInterrupt) throws IOException {
+ }
+
+ public ContextIdentifier openContext() throws IOException {
+ return null;
+ }
+
+ public ServiceIdentifier openService() throws IOException {
+ return null;
+ }
+
+ public StreamIdentifier openStream() throws IOException {
+ return null;
+ }
+
+ public void closeStream(final StreamIdentifier streamIdentifier) throws IOException {
+ }
+
+ public ObjectMessageOutput sendStreamData(final StreamIdentifier streamIdentifier, final Executor streamExecutor) throws IOException {
+ return null;
+ }
+
+ public void closeSession() throws IOException {
+ }
+
+ public String getRemoteEndpointName() {
+ return null;
+ }
+}
Added: remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/protocol/LocalProtocolHandlerFactory.java
===================================================================
--- remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/protocol/LocalProtocolHandlerFactory.java (rev 0)
+++ remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/protocol/LocalProtocolHandlerFactory.java 2008-03-17 21:59:58 UTC (rev 3660)
@@ -0,0 +1,48 @@
+package org.jboss.cx.remoting.core.protocol;
+
+import org.jboss.cx.remoting.spi.protocol.ProtocolHandlerFactory;
+import org.jboss.cx.remoting.spi.protocol.ProtocolHandler;
+import org.jboss.cx.remoting.spi.protocol.ProtocolContext;
+import org.jboss.cx.remoting.spi.Registration;
+import org.jboss.cx.remoting.util.AttributeMap;
+import org.jboss.cx.remoting.util.CollectionUtil;
+import org.jboss.cx.remoting.Endpoint;
+import org.jboss.cx.remoting.RemotingException;
+import java.net.URI;
+import java.io.IOException;
+import java.util.concurrent.ConcurrentMap;
+
+/**
+ *
+ */
+public final class LocalProtocolHandlerFactory implements ProtocolHandlerFactory {
+ @SuppressWarnings ({"UnusedDeclaration"})
+ private final Endpoint endpoint;
+
+ public LocalProtocolHandlerFactory(final Endpoint endpoint) {
+ this.endpoint = endpoint;
+ }
+
+ private static final ConcurrentMap<String, LocalProtocolHandlerFactory> endpoints = CollectionUtil.concurrentMap();
+
+ public boolean isLocal(final URI uri) {
+ return true;
+ }
+
+ public ProtocolHandler createHandler(final ProtocolContext context, final URI remoteUri, final AttributeMap attributeMap) throws IOException {
+
+ return new LocalProtocolHandler(context, remoteUri, attributeMap);
+ }
+
+ public void close() {
+
+ }
+
+ public static void addTo(final Endpoint endpoint) throws RemotingException {
+ final String name = endpoint.getName();
+ final LocalProtocolHandlerFactory handlerFactory = new LocalProtocolHandlerFactory(endpoint);
+ final Registration registration = endpoint.registerProtocol("local", handlerFactory);
+ registration.start();
+ endpoints.putIfAbsent(name, handlerFactory);
+ }
+}
Modified: remoting3/trunk/http/src/main/java/org/jboss/cx/remoting/http/HttpProtocolSupport.java
===================================================================
--- remoting3/trunk/http/src/main/java/org/jboss/cx/remoting/http/HttpProtocolSupport.java 2008-03-17 08:17:37 UTC (rev 3659)
+++ remoting3/trunk/http/src/main/java/org/jboss/cx/remoting/http/HttpProtocolSupport.java 2008-03-17 21:59:58 UTC (rev 3660)
@@ -15,9 +15,6 @@
import org.jboss.cx.remoting.spi.protocol.ProtocolContext;
import org.jboss.cx.remoting.spi.protocol.ProtocolHandler;
import org.jboss.cx.remoting.spi.protocol.ProtocolHandlerFactory;
-import org.jboss.cx.remoting.spi.protocol.ProtocolRegistration;
-import org.jboss.cx.remoting.spi.protocol.ProtocolRegistrationSpec;
-import org.jboss.cx.remoting.spi.protocol.ProtocolServerContext;
/**
*
@@ -27,8 +24,6 @@
private HttpTransporter httpTransporter;
private final Endpoint endpoint;
- private final ProtocolRegistration registration;
- private final ProtocolServerContext serverContext;
// todo - need secure random?
private final Random random = new Random();
@@ -36,9 +31,7 @@
public HttpProtocolSupport(final Endpoint endpoint) throws RemotingException {
this.endpoint = endpoint;
- ProtocolRegistrationSpec spec = ProtocolRegistrationSpec.DEFAULT.setScheme("http").setProtocolHandlerFactory(protocolHandlerFactory);
- registration = endpoint.registerProtocol(spec);
- serverContext = registration.getProtocolServerContext();
+ endpoint.registerProtocol("http", protocolHandlerFactory);
}
public void setHttpTransporter(final HttpTransporter httpTransporter) {
Modified: remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/JrppProtocolSupport.java
===================================================================
--- remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/JrppProtocolSupport.java 2008-03-17 08:17:37 UTC (rev 3659)
+++ remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/JrppProtocolSupport.java 2008-03-17 21:59:58 UTC (rev 3660)
@@ -25,9 +25,7 @@
import org.jboss.cx.remoting.spi.protocol.ProtocolContext;
import org.jboss.cx.remoting.spi.protocol.ProtocolHandler;
import org.jboss.cx.remoting.spi.protocol.ProtocolHandlerFactory;
-import org.jboss.cx.remoting.spi.protocol.ProtocolRegistration;
-import org.jboss.cx.remoting.spi.protocol.ProtocolRegistrationSpec;
-import org.jboss.cx.remoting.spi.protocol.ProtocolServerContext;
+import org.jboss.cx.remoting.spi.Registration;
/**
*
@@ -42,10 +40,8 @@
/** The NIO processor. Set upon {@code create}. */
private IoProcessor ioProcessor;
- /** Protocol server context. Set upon {@code create}. */
- private ProtocolServerContext serverContext;
/** Protocol registration. Set upon {@code create}. */
- private ProtocolRegistration registration;
+ private Registration registration;
public JrppProtocolSupport() {
}
@@ -74,18 +70,12 @@
return ioProcessor;
}
- ProtocolServerContext getServerContext() {
- return serverContext;
- }
-
// Lifecycle
public void create() throws RemotingException {
ioProcessor = new NioProcessor(executor);
protocolHandlerFactory = new ProtocolHandlerFactoryImpl();
- final ProtocolRegistrationSpec spec = ProtocolRegistrationSpec.DEFAULT.setScheme("jrpp").setProtocolHandlerFactory(protocolHandlerFactory);
- final ProtocolRegistration registration = endpoint.registerProtocol(spec);
- serverContext = registration.getProtocolServerContext();
+ final Registration registration = endpoint.registerProtocol("jrpp", protocolHandlerFactory);
this.registration = registration;
}
@@ -106,7 +96,6 @@
registration = null;
}
protocolHandlerFactory = null;
- serverContext = null;
}
// Utilities
Modified: remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/JrppServer.java
===================================================================
--- remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/JrppServer.java 2008-03-17 08:17:37 UTC (rev 3659)
+++ remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/JrppServer.java 2008-03-17 21:59:58 UTC (rev 3660)
@@ -74,7 +74,6 @@
@SuppressWarnings ({"unchecked"})
public void create() {
- serverContext = protocolSupport.getServerContext();
executor = protocolSupport.getExecutor();
ioProcessor = protocolSupport.getIoProcessor();
ioAcceptor = new NioSocketAcceptor(executor, ioProcessor);
Modified: remoting3/trunk/standalone/src/main/java/org/jboss/cx/remoting/Remoting.java
===================================================================
--- remoting3/trunk/standalone/src/main/java/org/jboss/cx/remoting/Remoting.java 2008-03-17 08:17:37 UTC (rev 3659)
+++ remoting3/trunk/standalone/src/main/java/org/jboss/cx/remoting/Remoting.java 2008-03-17 21:59:58 UTC (rev 3660)
@@ -1,41 +1,38 @@
package org.jboss.cx.remoting;
-import java.io.IOException;
import java.net.URI;
import java.util.concurrent.Executors;
import java.util.concurrent.ExecutorService;
-import org.jboss.cx.remoting.util.AttributeHashMap;
-import org.jboss.cx.remoting.util.AttributeMap;
import org.jboss.cx.remoting.log.Logger;
-import org.jboss.cx.remoting.spi.wrapper.ContextSourceWrapper;
-import org.jboss.cx.remoting.spi.wrapper.SessionWrapper;
-import org.jboss.cx.remoting.spi.wrapper.EndpointWrapper;
import org.jboss.cx.remoting.core.CoreEndpoint;
+import org.jboss.cx.remoting.core.protocol.LocalProtocolHandlerFactory;
-import javax.security.auth.callback.Callback;
-import javax.security.auth.callback.CallbackHandler;
-import javax.security.auth.callback.NameCallback;
-import javax.security.auth.callback.PasswordCallback;
-import javax.security.auth.callback.UnsupportedCallbackException;
-
/**
*
*/
public final class Remoting {
private static final Logger log = Logger.getLogger(Remoting.class);
- public static Endpoint createEndpoint(String name) {
+ public static Endpoint createEndpoint(String name) throws RemotingException {
final CoreEndpoint coreEndpoint = new CoreEndpoint(name);
final ExecutorService executorService = Executors.newCachedThreadPool();
coreEndpoint.setExecutor(executorService);
coreEndpoint.start();
- final Endpoint userEndpoint = coreEndpoint.getUserEndpoint();
- userEndpoint.addCloseHandler(new CloseHandler<Endpoint>() {
- public void handleClose(final Endpoint closed) {
- executorService.shutdown();
+ boolean ok = false;
+ try {
+ final Endpoint userEndpoint = coreEndpoint.getUserEndpoint();
+ LocalProtocolHandlerFactory.addTo(userEndpoint);
+ userEndpoint.addCloseHandler(new CloseHandler<Endpoint>() {
+ public void handleClose(final Endpoint closed) {
+ executorService.shutdown();
+ }
+ });
+ return userEndpoint;
+ } finally {
+ if (! ok) {
+ coreEndpoint.stop();
}
- });
- return userEndpoint;
+ }
}
public static Session createEndpointAndSession(String endpointName, URI remoteUri, final String userName, final char[] password) throws RemotingException {
Modified: remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/CollectionUtil.java
===================================================================
--- remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/CollectionUtil.java 2008-03-17 08:17:37 UTC (rev 3659)
+++ remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/CollectionUtil.java 2008-03-17 21:59:58 UTC (rev 3660)
@@ -12,6 +12,7 @@
import java.util.Set;
import java.util.WeakHashMap;
import java.util.Collections;
+import java.util.Collection;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ConcurrentHashMap;
@@ -344,4 +345,105 @@
}
};
}
+
+ public static AttributeMap emptyAttributeMap() {
+ return EMPTY_ATTRIBUTE_MAP;
+ }
+
+ private static final AttributeMap EMPTY_ATTRIBUTE_MAP = new EmptyAttributeMap();
+
+ private static final class EmptyAttributeMap implements AttributeMap {
+
+ public <T> T get(final AttributeKey<T> key) {
+ return null;
+ }
+
+ public <T> T put(final AttributeKey<T> key, final T value) {
+ throw new UnsupportedOperationException("put()");
+ }
+
+ public <T> T remove(final AttributeKey<T> key) {
+ return null;
+ }
+
+ public <T> boolean remove(final AttributeKey<T> key, final T value) {
+ return false;
+ }
+
+ public <T> T putIfAbsent(final AttributeKey<T> key, final T value) {
+ throw new UnsupportedOperationException("putIfAbsent()");
+ }
+
+ public <T> boolean replace(final AttributeKey<T> key, final T oldValue, final T newValue) {
+ return false;
+ }
+
+ public <T> boolean containsKey(final AttributeKey<T> key) {
+ return false;
+ }
+
+ public <T> boolean containsValue(final T value) {
+ return false;
+ }
+
+ public Iterable<Entry<?>> entries() {
+ return emptyIterable();
+ }
+
+ public Set<AttributeKey<?>> keySet() {
+ return Collections.emptySet();
+ }
+
+ public Collection<?> values() {
+ return Collections.emptySet();
+ }
+
+ public boolean isEmpty() {
+ return true;
+ }
+
+ public int size() {
+ return 0;
+ }
+
+ public void clear() {
+ // might as well let it succeed
+ }
+ }
+
+ @SuppressWarnings ({"unchecked"})
+ public static <T> Iterable<T> emptyIterable() {
+ return (Iterable<T>) EMPTY_ITERABLE;
+ }
+
+ private static final Iterable<?> EMPTY_ITERABLE = new EmptyIterable();
+
+ private static class EmptyIterable implements Iterable<Object> {
+ public Iterator<Object> iterator() {
+ return emptyIterator();
+ }
+ }
+
+ @SuppressWarnings ({"unchecked"})
+ public static <T> Iterator<T> emptyIterator() {
+ return (Iterator<T>) EMPTY_ITERATOR;
+ }
+
+ private static final Iterator<?> EMPTY_ITERATOR = new EmptyIterator();
+
+ private static final class EmptyIterator implements Iterator {
+
+ public boolean hasNext() {
+ return false;
+ }
+
+ public Object next() {
+ throw new NoSuchElementException("next() past end of iterator");
+ }
+
+ public void remove() {
+ throw new IllegalStateException("next() has not yet been called");
+ }
+
+ }
}
16 years, 2 months
JBoss Remoting SVN: r3659 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/rmi/ssl/socketfactory.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-03-17 04:17:37 -0400 (Mon, 17 Mar 2008)
New Revision: 3659
Added:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/rmi/ssl/socketfactory/SSLRMIClientSocketFactoryMemoryLeakTestCase.java
Log:
JBREM-933: New unit test.
Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/rmi/ssl/socketfactory/SSLRMIClientSocketFactoryMemoryLeakTestCase.java
===================================================================
--- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/rmi/ssl/socketfactory/SSLRMIClientSocketFactoryMemoryLeakTestCase.java (rev 0)
+++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/rmi/ssl/socketfactory/SSLRMIClientSocketFactoryMemoryLeakTestCase.java 2008-03-17 08:17:37 UTC (rev 3659)
@@ -0,0 +1,63 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.remoting.transport.rmi.ssl.socketfactory;
+
+import java.util.Map;
+
+import org.jboss.remoting.security.SSLSocketBuilder;
+import org.jboss.test.remoting.transport.rmi.socketfactory.RMIClientSocketFactoryMemoryLeakTestCase;
+
+import junit.framework.TestCase;
+
+
+/**
+ * @author <a href="ron.sigal(a)jboss.com">Ron Sigal</a>
+ * @version $Revision: 1846 $
+ * <p>
+ * Copyright March 16, 2008
+ * </p>
+ */
+public class SSLRMIClientSocketFactoryMemoryLeakTestCase extends RMIClientSocketFactoryMemoryLeakTestCase
+{
+ protected String getTransport()
+ {
+ return "sslrmi";
+ }
+
+ protected void addExtraServerConfig(Map config)
+ {
+ super.addExtraServerConfig(config);
+ config.put(SSLSocketBuilder.REMOTING_KEY_STORE_TYPE, "JKS");
+ String keyStoreFilePath = this.getClass().getResource("../.keystore").getFile();
+ config.put(SSLSocketBuilder.REMOTING_KEY_STORE_FILE_PATH, keyStoreFilePath);
+ config.put(SSLSocketBuilder.REMOTING_KEY_STORE_PASSWORD, "unit-tests-server");
+ }
+
+ protected void addExtraClientConfig(Map config)
+ {
+ super.addExtraClientConfig(config);
+ config.put(SSLSocketBuilder.REMOTING_TRUST_STORE_TYPE, "JKS");
+ String trustStoreFilePath = this.getClass().getResource("../.truststore").getFile();
+ config.put(SSLSocketBuilder.REMOTING_TRUST_STORE_FILE_PATH, trustStoreFilePath);
+ config.put(SSLSocketBuilder.REMOTING_TRUST_STORE_PASSWORD, "unit-tests-client");
+ }
+}
\ No newline at end of file
16 years, 2 months
JBoss Remoting SVN: r3658 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/soak.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-03-17 03:47:12 -0400 (Mon, 17 Mar 2008)
New Revision: 3658
Modified:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/soak/ServerLauncher.java
Log:
JBREM-931: Updated SpinThread.
Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/soak/ServerLauncher.java
===================================================================
--- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/soak/ServerLauncher.java 2008-03-17 07:46:10 UTC (rev 3657)
+++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/soak/ServerLauncher.java 2008-03-17 07:47:12 UTC (rev 3658)
@@ -164,8 +164,8 @@
if (callbackHandler == null)
{
- log.info("sessionId: " + id);
- log.info("listeners: " + listeners);
+ log.debug("sessionId: " + id);
+ log.debug("listeners: " + listeners);
}
Callback callback = new Callback("callback");
for (int i = 0; i < callbacks; i++)
@@ -193,18 +193,30 @@
static class SpinThread extends Thread
{
boolean stop;
+ static int counter;
+ static Object lock = new Object();
+ public SpinThread()
+ {
+ synchronized (lock)
+ {
+ setName("spinThread:" + counter++);
+ }
+ }
public void setStop()
{
stop = true;
+ log.debug(this + " stop = " + stop);
}
public void run()
{
+ int n = 0;
while (!stop)
{
- int n = 2 + 2;
- n = n * n;
+ n++;
+ if ((n + 1) % 10000 == 0)
+ log.debug(this + "stop = " + stop);
}
log.debug("SpinThread done");
}
16 years, 2 months
JBoss Remoting SVN: r3657 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/soak.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-03-17 03:46:10 -0400 (Mon, 17 Mar 2008)
New Revision: 3657
Modified:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/soak/ClientLauncher.java
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/soak/HeavyComputeClient.java
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/soak/MockEJBClient.java
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/soak/MockJBMClient.java
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/soak/SoakConstants.java
Log:
JBREM-931: Better reporting.
Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/soak/ClientLauncher.java
===================================================================
--- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/soak/ClientLauncher.java 2008-03-17 07:36:49 UTC (rev 3656)
+++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/soak/ClientLauncher.java 2008-03-17 07:46:10 UTC (rev 3657)
@@ -22,9 +22,13 @@
package org.jboss.test.remoting.soak;
import java.net.InetAddress;
+import java.util.Collections;
import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
import java.util.Map;
import java.util.Random;
+import java.util.Set;
import java.util.Timer;
import java.util.TimerTask;
@@ -47,9 +51,9 @@
{
private static Logger log = Logger.getLogger(ClientLauncher.class);
- private static Counter mockEJBClientCurrentCounter = new Counter();
- private static Counter mockJBMClientCurrentCounter = new Counter();
- private static Counter heavyComputeClientCurrentCounter = new Counter();
+ private static Set mockEJBClientsInUse = Collections.synchronizedSet(new HashSet());
+ private static Set mockJBMClientsInUse = Collections.synchronizedSet(new HashSet());
+ private static Set heavyComputeClientsInUse = Collections.synchronizedSet(new HashSet());
private static Counter mockEJBClientCounter = new Counter();
private static Counter mockJBMClientCounter = new Counter();
@@ -66,9 +70,18 @@
private static String host;
private static boolean creationDone;
- private static long DURATION = 3600000;
- private static int MAX_CLIENTS = 20;
+ // Configuration parameters.
+// private static long DURATION = 12 * 60 * 60 * 1000;
+// private static long DURATION = 1 * 60 * 60 * 1000;
+ private static long DURATION = 30000;
+ private static int MAX_CLIENTS = 30;
+ private static int NUMBER_OF_EJB_CALLS = 4000;
+ private static int NUMBER_OF_JBM_CALLS = 2000;
+ private static int NUMBER_OF_JBM_CALLBACKS = 4;
+ private static int NUMBER_OF_HEAVY_COMPUTE_CALLS = 5;
+ private static String HEAVY_COMPUTE_SPIN_TIME = "4000";
+
public static void main(String[] args)
{
try
@@ -88,14 +101,14 @@
while (System.currentTimeMillis() - start < DURATION)
{
- if (mockEJBClientCurrentCounter.getCount() +
- mockJBMClientCurrentCounter.getCount() +
- heavyComputeClientCurrentCounter.getCount() < MAX_CLIENTS)
+ if (mockEJBClientsInUse.size() +
+ mockJBMClientsInUse.size() +
+ heavyComputeClientsInUse.size() < MAX_CLIENTS)
{
createClient();
}
- int n = random.nextInt(80) * 100;
+ int n = random.nextInt(40) * 100;
log.debug("waiting " + n + " ms");
Thread.sleep(n);
}
@@ -113,7 +126,6 @@
protected static void createClient() throws Throwable
{
int k = random.nextInt(4);
- k = 3;
String transport = transports[k];
int port = ports[k];
transportCounters[k]++;
@@ -139,9 +151,9 @@
String locatorURI = transport + "://" + host + ":" + port + "/?timeout=0";
Map metadata = new HashMap();
metadata.put(NAME, "MockEJBClient" + mockEJBClientCounter.increment() + "[" + transport + "]");
- metadata.put(COUNTER, mockEJBClientCurrentCounter);
+ metadata.put(IN_USE_SET, mockEJBClientsInUse);
metadata.put(FAILURE_COUNTER, mockEJBClientFailureCounter);
- metadata.put(NUMBER_OF_CALLS, Integer.toString(random.nextInt(2000)));
+ metadata.put(NUMBER_OF_CALLS, Integer.toString(random.nextInt(NUMBER_OF_EJB_CALLS)));
MockEJBClient c = new MockEJBClient(locatorURI, metadata);
Thread t = new Thread(c);
t.start();
@@ -153,10 +165,10 @@
String locatorURI = transport + "://" + host + ":" + port + "/?timeout=0";
Map metadata = new HashMap();
metadata.put(NAME, "MockJBMClient" + mockJBMClientCounter.increment() + "[" + transport + "]");
- metadata.put(COUNTER, mockJBMClientCurrentCounter);
+ metadata.put(IN_USE_SET, mockJBMClientsInUse);
metadata.put(FAILURE_COUNTER, mockJBMClientFailureCounter);
- metadata.put(NUMBER_OF_CALLS, Integer.toString(random.nextInt(1000)));
- metadata.put(NUMBER_OF_CALLBACKS, Integer.toString(random.nextInt(3)));
+ metadata.put(NUMBER_OF_CALLS, Integer.toString(random.nextInt(NUMBER_OF_JBM_CALLS)));
+ metadata.put(NUMBER_OF_CALLBACKS, Integer.toString(random.nextInt(NUMBER_OF_JBM_CALLBACKS)));
MockJBMClient c = new MockJBMClient(locatorURI, metadata);
Thread t = new Thread(c);
t.start();
@@ -168,10 +180,10 @@
String locatorURI = transport + "://" + host + ":" + port + "/?timeout=0";
Map metadata = new HashMap();
metadata.put(NAME, "HeavyComputeClient" + heavyComputeClientCounter.increment() + "[" + transport + "]");
- metadata.put(COUNTER, heavyComputeClientCurrentCounter);
+ metadata.put(IN_USE_SET, heavyComputeClientsInUse);
metadata.put(FAILURE_COUNTER, heavyComputeClientFailureCounter);
- metadata.put(NUMBER_OF_CALLS, Integer.toString(random.nextInt(5)));
- metadata.put(SPIN_TIME, "4000");
+ metadata.put(NUMBER_OF_CALLS, Integer.toString(random.nextInt(NUMBER_OF_HEAVY_COMPUTE_CALLS)));
+ metadata.put(SPIN_TIME, HEAVY_COMPUTE_SPIN_TIME);
HeavyComputeClient c = new HeavyComputeClient(locatorURI, metadata);
heavyComputeClientCounter.increment();
Thread t = new Thread(c);
@@ -194,9 +206,9 @@
{
System.out.println("");
System.out.println("=========================================");
- System.out.println("current MockEJBCLients: " + mockEJBClientCurrentCounter.getCount());
- System.out.println("current MockJBMClients: " + mockJBMClientCurrentCounter.getCount());
- System.out.println("current HeavyComputeClients: " + heavyComputeClientCurrentCounter.getCount());
+ System.out.println("current MockEJBCLients: " + mockEJBClientsInUse.size());
+ System.out.println("current MockJBMClients: " + mockJBMClientsInUse.size());
+ System.out.println("current HeavyComputeClients: " + heavyComputeClientsInUse.size());
System.out.println("-----------------------------------------");
System.out.println("bisocket clients: " + transportCounters[0]);
System.out.println("http clients: " + transportCounters[1]);
@@ -206,15 +218,29 @@
System.out.println("failed MockEJBCLients: " + mockEJBClientFailureCounter.getCount());
System.out.println("failed MockJBMClients: " + mockJBMClientFailureCounter.getCount());
System.out.println("failed HeavyComputeClients: " + heavyComputeClientFailureCounter.getCount());
+ System.out.println("-----------------------------------------");
+ printSet(mockEJBClientsInUse);
+ printSet(mockJBMClientsInUse);
+ printSet(heavyComputeClientsInUse);
System.out.println("=========================================");
System.out.println("");
- if (creationDone &&
- mockEJBClientCurrentCounter.getCount() == 0 &&
- mockJBMClientCurrentCounter.getCount() == 0 &&
- heavyComputeClientCurrentCounter.getCount() == 0)
+ if (creationDone &&
+ mockEJBClientsInUse.size() == 0 &&
+ mockJBMClientsInUse.size() == 0 &&
+ heavyComputeClientsInUse.size() == 0)
+
cancel();
}
+
+ private void printSet(Set set)
+ {
+ Iterator it = set.iterator();
+ while(it.hasNext())
+ {
+ System.out.println(it.next().toString());
+ }
+ }
}
}
Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/soak/HeavyComputeClient.java
===================================================================
--- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/soak/HeavyComputeClient.java 2008-03-17 07:36:49 UTC (rev 3656)
+++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/soak/HeavyComputeClient.java 2008-03-17 07:46:10 UTC (rev 3657)
@@ -21,8 +21,8 @@
*/
package org.jboss.test.remoting.soak;
-import java.util.HashMap;
import java.util.Map;
+import java.util.Set;
import org.apache.log4j.Logger;
import org.jboss.remoting.Client;
@@ -45,7 +45,7 @@
protected Map metadata;
protected String name;
protected boolean ok = true;
- protected ClientLauncher.Counter counter;
+ protected Set inUseSet;
protected ClientLauncher.Counter failureCounter;
public HeavyComputeClient(String locator, Map metadata) throws Exception
@@ -53,8 +53,8 @@
this.locator = new InvokerLocator(locator);
this.metadata = metadata;
this.name = (String) metadata.get(SoakConstants.NAME);
- counter = (ClientLauncher.Counter) metadata.remove(COUNTER);
- counter.increment();
+ this.inUseSet = (Set) metadata.remove(IN_USE_SET);
+ inUseSet.add(this);
failureCounter = (ClientLauncher.Counter) metadata.remove(FAILURE_COUNTER);
log.info("created " + name);
}
@@ -77,7 +77,7 @@
finally
{
log.info(name + ": " + (ok ? "PASS" : "FAIL"));
- counter.decrement();
+ inUseSet.remove(this);
if (!ok) failureCounter.increment();
}
}
@@ -108,5 +108,10 @@
client.disconnect();
}
}
+
+ public String toString()
+ {
+ return name;
+ }
}
Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/soak/MockEJBClient.java
===================================================================
--- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/soak/MockEJBClient.java 2008-03-17 07:36:49 UTC (rev 3656)
+++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/soak/MockEJBClient.java 2008-03-17 07:46:10 UTC (rev 3657)
@@ -23,6 +23,7 @@
import java.util.HashMap;
import java.util.Map;
+import java.util.Set;
import org.apache.log4j.Logger;
import org.jboss.remoting.Client;
@@ -45,7 +46,7 @@
protected Map metadata;
protected String name;
protected boolean ok = true;
- protected ClientLauncher.Counter counter;
+ protected Set inUseSet;
protected ClientLauncher.Counter failureCounter;
public MockEJBClient(String locator, Map metadata) throws Exception
@@ -53,8 +54,8 @@
this.locator = new InvokerLocator(locator);
this.metadata = metadata;
this.name = (String) metadata.get(SoakConstants.NAME);
- counter = (ClientLauncher.Counter) metadata.remove(COUNTER);
- counter.increment();
+ this.inUseSet = (Set) metadata.remove(IN_USE_SET);
+ inUseSet.add(this);
failureCounter = (ClientLauncher.Counter) metadata.remove(FAILURE_COUNTER);
log.info("created " + name);
}
@@ -76,7 +77,7 @@
}
finally
{
- counter.decrement();
+ inUseSet.remove(this);
log.info(name + ": " + (ok ? "PASS" : "FAIL"));
if (!ok) failureCounter.increment();
}
@@ -110,5 +111,10 @@
client.disconnect();
}
}
+
+ public String toString()
+ {
+ return name;
+ }
}
Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/soak/MockJBMClient.java
===================================================================
--- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/soak/MockJBMClient.java 2008-03-17 07:36:49 UTC (rev 3656)
+++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/soak/MockJBMClient.java 2008-03-17 07:46:10 UTC (rev 3657)
@@ -23,6 +23,7 @@
import java.util.HashMap;
import java.util.Map;
+import java.util.Set;
import org.apache.log4j.Logger;
import org.jboss.remoting.Client;
@@ -48,7 +49,7 @@
protected String name;
protected boolean ok = true;
protected Client client;
- protected ClientLauncher.Counter counter;
+ protected Set inUseSet;
protected ClientLauncher.Counter failureCounter;
public MockJBMClient(String locator, Map metadata) throws Exception
@@ -56,8 +57,8 @@
this.locator = new InvokerLocator(locator);
this.metadata = metadata;
this.name = (String) metadata.get(NAME);
- counter = (ClientLauncher.Counter) metadata.remove(COUNTER);
- counter.increment();
+ this.inUseSet = (Set) metadata.remove(IN_USE_SET);
+ inUseSet.add(this);
failureCounter = (ClientLauncher.Counter) metadata.remove(FAILURE_COUNTER);
log.info("created " + name);
}
@@ -101,7 +102,7 @@
{
client.disconnect();
log.info(name + ": " + (ok ? "PASS" : "FAIL"));
- counter.decrement();
+ inUseSet.remove(this);
if (!ok) failureCounter.increment();
}
}
@@ -121,5 +122,10 @@
log.debug("received callback");
}
}
+
+ public String toString()
+ {
+ return name;
+ }
}
Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/soak/SoakConstants.java
===================================================================
--- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/soak/SoakConstants.java 2008-03-17 07:36:49 UTC (rev 3656)
+++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/soak/SoakConstants.java 2008-03-17 07:46:10 UTC (rev 3657)
@@ -60,5 +60,7 @@
public static final String COUNTER = "counter";
public static final String FAILURE_COUNTER = "failureCounter";
+
+ public static final String IN_USE_SET = "inUseSet";
}
16 years, 2 months
JBoss Remoting SVN: r3656 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-03-17 03:36:49 -0400 (Mon, 17 Mar 2008)
New Revision: 3656
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/RMIClientInvoker.java
Log:
JBREM-933: Added handleDisconnect().
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/RMIClientInvoker.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/RMIClientInvoker.java 2008-03-17 07:36:12 UTC (rev 3655)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/RMIClientInvoker.java 2008-03-17 07:36:49 UTC (rev 3656)
@@ -210,6 +210,7 @@
protected void handleConnect()
throws ConnectionFailedException
{
+ storeLocalConfig(configuration);
int registryPort = getRegistryPort(locator);
Home home = null;
Exception savedException = null;
@@ -225,7 +226,6 @@
String host = home.host;
int port = home.port;
locator.setHomeInUse(home);
- storeLocalConfig(configuration);
log.debug(this + " looking up registry: " + host + "," + port);
Registry registry = LocateRegistry.getRegistry(host, registryPort);
log.debug(this + " trying to connect to: " + home);
@@ -293,6 +293,7 @@
*/
protected void handleDisconnect()
{
+ RemotingRMIClientSocketFactory.removeLocalConfiguration(locator);
}
protected String getDefaultDataType()
16 years, 2 months