JBoss Remoting SVN: r3496 - remoting3/trunk.
by jboss-remoting-commits@lists.jboss.org
Author: david.lloyd(a)jboss.com
Date: 2008-02-23 10:47:59 -0500 (Sat, 23 Feb 2008)
New Revision: 3496
Modified:
remoting3/trunk/
Log:
Ignore generated jars
Property changes on: remoting3/trunk
___________________________________________________________________
Name: svn:ignore
- *.ipr
*.iws
build.properties.local
+ *.ipr
*.iws
build.properties.local
jboss-remoting-*.jar
16 years, 9 months
JBoss Remoting SVN: r3495 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/socket/ssl/serversocketrefresh.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-02-23 04:03:20 -0500 (Sat, 23 Feb 2008)
New Revision: 3495
Modified:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/socket/ssl/serversocketrefresh/TestCase.java
Log:
JBREM-876: Changed log level to INFO.
Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/socket/ssl/serversocketrefresh/TestCase.java
===================================================================
--- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/socket/ssl/serversocketrefresh/TestCase.java 2008-02-23 06:43:04 UTC (rev 3494)
+++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/socket/ssl/serversocketrefresh/TestCase.java 2008-02-23 09:03:20 UTC (rev 3495)
@@ -21,6 +21,6 @@
protected Level getTestLogLevel()
{
- return Level.ERROR;
+ return Level.INFO;
}
}
16 years, 9 months
JBoss Remoting SVN: r3494 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/invoker.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-02-23 01:43:04 -0500 (Sat, 23 Feb 2008)
New Revision: 3494
Modified:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/invoker/ClientInvokerDelayedDestructionTestCase.java
Log:
JBREM-877: Added testEventualDestruction().
Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/invoker/ClientInvokerDelayedDestructionTestCase.java
===================================================================
--- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/invoker/ClientInvokerDelayedDestructionTestCase.java 2008-02-23 06:35:05 UTC (rev 3493)
+++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/invoker/ClientInvokerDelayedDestructionTestCase.java 2008-02-23 06:43:04 UTC (rev 3494)
@@ -37,6 +37,7 @@
import org.jboss.remoting.Client;
import org.jboss.remoting.InvocationRequest;
import org.jboss.remoting.InvokerLocator;
+import org.jboss.remoting.InvokerRegistry;
import org.jboss.remoting.ServerInvocationHandler;
import org.jboss.remoting.ServerInvoker;
import org.jboss.remoting.callback.Callback;
@@ -231,6 +232,36 @@
}
+ public void testEventualDestruction() throws Throwable
+ {
+ log.info("entering " + getName());
+
+ // Start server.
+ setupServer();
+
+ // Create client.
+ InvokerLocator clientLocator = new InvokerLocator(locatorURI);
+ HashMap clientConfig = new HashMap();
+ clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
+ clientConfig.put(Client.INVOKER_DESTRUCTION_DELAY, "5000");
+ addExtraClientConfig(clientConfig);
+
+ for (int i = 0; i < 50; i++)
+ {
+ Client client = new Client(clientLocator, clientConfig);
+ client.connect();
+ assertEquals("abc", client.invoke("abc"));
+ client.disconnect();
+ }
+
+ Thread.sleep(10000);
+ assertEquals(0, InvokerRegistry.getClientInvokers().length);
+
+ shutdownServer();
+ log.info(getName() + " PASSES");
+ }
+
+
protected String getTransport()
{
return "socket";
16 years, 9 months
JBoss Remoting SVN: r3493 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/invoker.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-02-23 01:35:05 -0500 (Sat, 23 Feb 2008)
New Revision: 3493
Added:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/invoker/InvokerDestructionTest.java
Log:
JBREM-877: Demonstrates cost of recreating client invoker.
Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/invoker/InvokerDestructionTest.java
===================================================================
--- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/invoker/InvokerDestructionTest.java (rev 0)
+++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/invoker/InvokerDestructionTest.java 2008-02-23 06:35:05 UTC (rev 3493)
@@ -0,0 +1,176 @@
+package org.jboss.test.remoting.invoker;
+
+
+import java.net.InetAddress;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.management.MBeanServer;
+
+import junit.framework.TestCase;
+
+import org.apache.log4j.ConsoleAppender;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.apache.log4j.PatternLayout;
+import org.jboss.logging.XLevel;
+import org.jboss.remoting.Client;
+import org.jboss.remoting.InvocationRequest;
+import org.jboss.remoting.InvokerLocator;
+import org.jboss.remoting.ServerInvocationHandler;
+import org.jboss.remoting.ServerInvoker;
+import org.jboss.remoting.callback.InvokerCallbackHandler;
+import org.jboss.remoting.transport.Connector;
+import org.jboss.remoting.transport.PortUtil;
+
+
+/**
+ * Demonstrates the cost of recreating a client invoker with each invocation.
+ * See JBREM-877.
+ *
+ * @author <a href="ron.sigal(a)jboss.com">Ron Sigal</a>
+ * @version $Revision: 1.1 $
+ * <p>
+ * Copyright Feb 23, 2008
+ * </p>
+ */
+public class InvokerDestructionTest extends TestCase
+{
+ private static Logger log = Logger.getLogger(InvokerDestructionTest.class);
+
+ private static boolean firstTime = true;
+ protected static String metadata;
+
+ protected String host;
+ protected int port;
+ protected String locatorURI;
+ protected InvokerLocator serverLocator;
+ protected Connector connector;
+ protected TestInvocationHandler invocationHandler;
+
+
+ public void setUp() throws Exception
+ {
+ if (firstTime)
+ {
+ firstTime = false;
+ Logger.getLogger("org.jboss.remoting").setLevel(XLevel.INFO);
+ Logger.getLogger("org.jboss.test.remoting").setLevel(Level.INFO);
+ String pattern = "[%d{ABSOLUTE}] [%t] %5p (%F:%L) - %m%n";
+ PatternLayout layout = new PatternLayout(pattern);
+ ConsoleAppender consoleAppender = new ConsoleAppender(layout);
+ Logger.getRootLogger().addAppender(consoleAppender);
+ metadata = System.getProperty("remoting.metadata", "serializationtype=java");
+ }
+ }
+
+
+ public void tearDown()
+ {
+ }
+
+
+
+ public void testNoDelay() throws Throwable
+ {
+ log.info("entering " + getName());
+
+ // Start server.
+ setupServer(0);
+
+ // Create client.
+ InvokerLocator clientLocator = new InvokerLocator(locatorURI);
+ HashMap clientConfig = new HashMap();
+ clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
+ addExtraClientConfig(clientConfig);
+
+ long l1 = doTest(clientLocator, clientConfig, 10000);
+ log.info("delay 0: " + l1);
+
+ shutdownServer();
+ log.info(getName() + " PASSES");
+ }
+
+
+ public void testDelay() throws Throwable
+ {
+ log.info("entering " + getName());
+
+ // Start server.
+ setupServer(5000);
+
+ // Create client.
+ InvokerLocator clientLocator = new InvokerLocator(locatorURI);
+ HashMap clientConfig = new HashMap();
+ clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
+ addExtraClientConfig(clientConfig);
+
+ long l1 = doTest(clientLocator, clientConfig, 10000);
+ log.info("delay 5000: " + l1);
+
+ shutdownServer();
+ log.info(getName() + " PASSES");
+ }
+
+
+ protected long doTest(InvokerLocator locator, Map config, int count) throws Throwable
+ {
+ long start = System.currentTimeMillis();
+ for (int i = 0; i < count; i++)
+ {
+ Client client = new Client(locator, config);
+ client.connect();
+ client.invoke("abc");
+ client.disconnect();
+ }
+ return System.currentTimeMillis() - start;
+ }
+
+ protected String getTransport()
+ {
+ return "socket";
+ }
+
+
+ protected void addExtraClientConfig(Map config) {}
+ protected void addExtraServerConfig(Map config) {}
+
+
+ protected void setupServer(int delay) throws Exception
+ {
+ host = InetAddress.getLocalHost().getHostAddress();
+ port = PortUtil.findFreePort(host);
+ locatorURI = getTransport() + "://" + host + ":" + port;
+ locatorURI += "/?" + Client.INVOKER_DESTRUCTION_DELAY + "=" + delay;
+ serverLocator = new InvokerLocator(locatorURI);
+ log.info("Starting remoting server with locator uri of: " + locatorURI);
+ HashMap config = new HashMap();
+ config.put(InvokerLocator.FORCE_REMOTE, "true");
+ addExtraServerConfig(config);
+ connector = new Connector(serverLocator, config);
+ connector.create();
+ invocationHandler = new TestInvocationHandler();
+ connector.addInvocationHandler("test", invocationHandler);
+ connector.start();
+ }
+
+
+ protected void shutdownServer() throws Exception
+ {
+ if (connector != null)
+ connector.stop();
+ }
+
+
+ static class TestInvocationHandler implements ServerInvocationHandler
+ {
+ public void addListener(InvokerCallbackHandler callbackHandler) {}
+ public Object invoke(final InvocationRequest invocation) throws Throwable
+ {
+ return invocation.getParameter();
+ }
+ public void removeListener(InvokerCallbackHandler callbackHandler) {}
+ public void setMBeanServer(MBeanServer server) {}
+ public void setInvoker(ServerInvoker invoker) {}
+ }
+}
\ No newline at end of file
16 years, 9 months
JBoss Remoting SVN: r3492 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/invoker.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-02-23 01:33:24 -0500 (Sat, 23 Feb 2008)
New Revision: 3492
Added:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/invoker/ClientInvokerDelayedDestructionTestCase.java
Log:
JBREM-877: New unit test.
Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/invoker/ClientInvokerDelayedDestructionTestCase.java
===================================================================
--- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/invoker/ClientInvokerDelayedDestructionTestCase.java (rev 0)
+++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/invoker/ClientInvokerDelayedDestructionTestCase.java 2008-02-23 06:33:24 UTC (rev 3492)
@@ -0,0 +1,289 @@
+/*
+* 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.invoker;
+
+import java.net.InetAddress;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.management.MBeanServer;
+
+import junit.framework.TestCase;
+
+import org.apache.log4j.ConsoleAppender;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.apache.log4j.PatternLayout;
+import org.jboss.logging.XLevel;
+import org.jboss.remoting.Client;
+import org.jboss.remoting.InvocationRequest;
+import org.jboss.remoting.InvokerLocator;
+import org.jboss.remoting.ServerInvocationHandler;
+import org.jboss.remoting.ServerInvoker;
+import org.jboss.remoting.callback.Callback;
+import org.jboss.remoting.callback.HandleCallbackException;
+import org.jboss.remoting.callback.InvokerCallbackHandler;
+import org.jboss.remoting.transport.ClientInvoker;
+import org.jboss.remoting.transport.Connector;
+import org.jboss.remoting.transport.PortUtil;
+
+
+/**
+ * Unit tests from JBREM-877.
+ *
+ * @author <a href="ron.sigal(a)jboss.com">Ron Sigal</a>
+ * @version $Revision: 1.1 $
+ * <p>
+ * Copyright Feb 22, 2008
+ * </p>
+ */
+public class ClientInvokerDelayedDestructionTestCase extends TestCase
+{
+ private static Logger log = Logger.getLogger(ClientInvokerDelayedDestructionTestCase.class);
+
+ private static boolean firstTime = true;
+
+ protected String host;
+ protected int port;
+ protected String locatorURI;
+ protected InvokerLocator serverLocator;
+ protected Connector connector;
+ protected TestInvocationHandler invocationHandler;
+
+
+ public void setUp() throws Exception
+ {
+ if (firstTime)
+ {
+ firstTime = false;
+ Logger.getLogger("org.jboss.remoting").setLevel(XLevel.INFO);
+ Logger.getLogger("org.jboss.test.remoting").setLevel(Level.INFO);
+ String pattern = "[%d{ABSOLUTE}] [%t] %5p (%F:%L) - %m%n";
+ PatternLayout layout = new PatternLayout(pattern);
+ ConsoleAppender consoleAppender = new ConsoleAppender(layout);
+ Logger.getRootLogger().addAppender(consoleAppender);
+ }
+ }
+
+
+ public void tearDown()
+ {
+ }
+
+
+ public void testNoDelayedDestruction() throws Throwable
+ {
+ log.info("entering " + getName());
+
+ // Start server.
+ setupServer();
+
+ // Create client.
+ InvokerLocator clientLocator = new InvokerLocator(locatorURI);
+ HashMap clientConfig = new HashMap();
+ clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
+ addExtraClientConfig(clientConfig);
+ Client client = new Client(clientLocator, clientConfig);
+ client.connect();
+ ClientInvoker invoker1 = client.getInvoker();
+
+ // Test connections.
+ assertEquals("abc", client.invoke("abc"));
+ log.info("connection is good for first client");
+ client.disconnect();
+
+ client = new Client(clientLocator, clientConfig);
+ client.connect();
+ ClientInvoker invoker2 = client.getInvoker();
+ assertEquals("abc", client.invoke("abc"));
+ log.info("connection is good for second client");
+ assertNotSame(invoker2, invoker1);
+
+ client.disconnect();
+ shutdownServer();
+ log.info(getName() + " PASSES");
+ }
+
+
+ public void testZeroDelay() throws Throwable
+ {
+ log.info("entering " + getName());
+
+ // Start server.
+ setupServer();
+
+ // Create client.
+ InvokerLocator clientLocator = new InvokerLocator(locatorURI);
+ HashMap clientConfig = new HashMap();
+ clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
+ clientConfig.put(Client.INVOKER_DESTRUCTION_DELAY, "0");
+ addExtraClientConfig(clientConfig);
+ Client client = new Client(clientLocator, clientConfig);
+ client.connect();
+ ClientInvoker invoker1 = client.getInvoker();
+
+ // Test connections.
+ assertEquals("abc", client.invoke("abc"));
+ log.info("connection is good for first client");
+ client.disconnect();
+
+ client = new Client(clientLocator, clientConfig);
+ client.connect();
+ ClientInvoker invoker2 = client.getInvoker();
+ assertEquals("abc", client.invoke("abc"));
+ log.info("connection is good for second client");
+ assertNotSame(invoker2, invoker1);
+
+ client.disconnect();
+ shutdownServer();
+ log.info(getName() + " PASSES");
+ }
+
+
+ public void testDelayThenGetNewInvoker() throws Throwable
+ {
+ log.info("entering " + getName());
+
+ // Start server.
+ setupServer();
+
+ // Create client.
+ InvokerLocator clientLocator = new InvokerLocator(locatorURI);
+ HashMap clientConfig = new HashMap();
+ clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
+ clientConfig.put(Client.INVOKER_DESTRUCTION_DELAY, "5000");
+ addExtraClientConfig(clientConfig);
+ Client client = new Client(clientLocator, clientConfig);
+ client.connect();
+ ClientInvoker invoker1 = client.getInvoker();
+
+ // Test connections.
+ assertEquals("abc", client.invoke("abc"));
+ log.info("connection is good for first client");
+ client.disconnect();
+
+ Thread.sleep(10000);
+ client = new Client(clientLocator, clientConfig);
+ client.connect();
+ ClientInvoker invoker2 = client.getInvoker();
+ assertEquals("abc", client.invoke("abc"));
+ log.info("connection is good for second client");
+ assertNotSame(invoker2, invoker1);
+
+ client.disconnect();
+ shutdownServer();
+ log.info(getName() + " PASSES");
+ }
+
+
+ public void testDelayThenReuseInvoker() throws Throwable
+ {
+ log.info("entering " + getName());
+
+ // Start server.
+ setupServer();
+
+ // Create client.
+ InvokerLocator clientLocator = new InvokerLocator(locatorURI);
+ HashMap clientConfig = new HashMap();
+ clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
+ clientConfig.put(Client.INVOKER_DESTRUCTION_DELAY, "10000");
+ addExtraClientConfig(clientConfig);
+ Client client = new Client(clientLocator, clientConfig);
+ client.connect();
+ ClientInvoker invoker1 = client.getInvoker();
+
+ // Test connections.
+ assertEquals("abc", client.invoke("abc"));
+ log.info("connection is good for first client");
+ client.disconnect();
+
+ Thread.sleep(5000);
+ client = new Client(clientLocator, clientConfig);
+ client.connect();
+ ClientInvoker invoker2 = client.getInvoker();
+ assertEquals("abc", client.invoke("abc"));
+ log.info("connection is good for second client");
+ assertSame(invoker2, invoker1);
+
+ client.disconnect();
+ shutdownServer();
+ log.info(getName() + " PASSES");
+ }
+
+
+ protected String getTransport()
+ {
+ return "socket";
+ }
+
+
+ protected void addExtraClientConfig(Map config) {}
+ protected void addExtraServerConfig(Map config) {}
+
+
+ protected void setupServer() throws Exception
+ {
+ host = InetAddress.getLocalHost().getHostAddress();
+ port = PortUtil.findFreePort(host);
+ locatorURI = getTransport() + "://" + host + ":" + port;
+ serverLocator = new InvokerLocator(locatorURI);
+ log.info("Starting remoting server with locator uri of: " + locatorURI);
+ HashMap config = new HashMap();
+ config.put(InvokerLocator.FORCE_REMOTE, "true");
+ addExtraServerConfig(config);
+ connector = new Connector(serverLocator, config);
+ connector.create();
+ invocationHandler = new TestInvocationHandler();
+ connector.addInvocationHandler("test", invocationHandler);
+ connector.start();
+ }
+
+
+ protected void shutdownServer() throws Exception
+ {
+ if (connector != null)
+ connector.stop();
+ }
+
+
+ static class TestInvocationHandler implements ServerInvocationHandler
+ {
+ public void addListener(InvokerCallbackHandler callbackHandler) {}
+ public Object invoke(final InvocationRequest invocation) throws Throwable
+ {
+ return invocation.getParameter();
+ }
+ public void removeListener(InvokerCallbackHandler callbackHandler) {}
+ public void setMBeanServer(MBeanServer server) {}
+ public void setInvoker(ServerInvoker invoker) {}
+ }
+
+
+ static class TestCallbackHandler implements InvokerCallbackHandler
+ {
+ public void handleCallback(Callback callback) throws HandleCallbackException
+ {
+ log.info("received callback");
+ }
+ }
+}
\ No newline at end of file
16 years, 9 months
JBoss Remoting SVN: r3491 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/classloader/race.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-02-23 01:32:55 -0500 (Sat, 23 Feb 2008)
New Revision: 3491
Modified:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/classloader/race/ClassloaderRaceTestParent.java
Log:
JBREM-900: Modifed error message.
Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/classloader/race/ClassloaderRaceTestParent.java
===================================================================
--- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/classloader/race/ClassloaderRaceTestParent.java 2008-02-23 06:30:51 UTC (rev 3490)
+++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/classloader/race/ClassloaderRaceTestParent.java 2008-02-23 06:32:55 UTC (rev 3491)
@@ -377,7 +377,7 @@
}
catch (Throwable t)
{
- log.error("unable to complete invocation", t);
+ log.error(this + " unable to complete invocation", t);
}
}
16 years, 9 months
JBoss Remoting SVN: r3490 - remoting2/branches/2.x/src/main/org/jboss/remoting.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-02-23 01:30:51 -0500 (Sat, 23 Feb 2008)
New Revision: 3490
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/Client.java
Log:
JBREM-877: Added Timer for delayed invoker destruction.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/Client.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/Client.java 2008-02-22 22:32:34 UTC (rev 3489)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/Client.java 2008-02-23 06:30:51 UTC (rev 3490)
@@ -59,6 +59,8 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.Timer;
+import java.util.TimerTask;
/**
* Client is a convience class for invoking remote methods for a given subsystem. It is intended to
@@ -151,6 +153,11 @@
*/
public static final int DEFAULT_DISCONNECT_TIMEOUT = -1;
+ /**
+ * Key for setting delay before client invoker is destroyed by disconnect().
+ */
+ public static final String INVOKER_DESTRUCTION_DELAY = "invokerDestructionDelay";
+
public static final String THROW_CALLBACK_EXCEPTION = "throwCallbackException";
private static final Logger log = Logger.getLogger(Client.class);
@@ -187,6 +194,10 @@
private int disconnectTimeout = DEFAULT_DISCONNECT_TIMEOUT;
private boolean connected = false;
+
+ private int invokerDestructionDelay = 0;
+ private Timer invokerDestructionTimer;
+ private Object invokerDestructionTimerLock = new Object();
// Constructors ---------------------------------------------------------------------------------
@@ -266,6 +277,7 @@
this.configuration = new HashMap(configuration);
}
this.sessionId = new GUID().toString();
+ processParameters();
}
/**
@@ -486,7 +498,35 @@
// Need to remove myself from registry so will not keep reference to me since I am of no
// use now. Will have to create a new one.
- InvokerRegistry.destroyClientInvoker(invoker.getLocator(), configuration);
+ if (invokerDestructionDelay > 0)
+ {
+ synchronized (invokerDestructionTimerLock)
+ {
+ InvokerDestructionTimerTask task = new InvokerDestructionTimerTask(invoker);
+ if (invokerDestructionTimer == null)
+ {
+ invokerDestructionTimer = new Timer(true);
+ }
+
+ try
+ {
+ invokerDestructionTimer.schedule(task, invokerDestructionDelay);
+ }
+ catch (IllegalStateException e)
+ {
+ log.debug("Unable to schedule InvokerDestructionTimerTask on existing Timer", e);
+ invokerDestructionTimer = new Timer(true);
+ invokerDestructionTimer.schedule(task, invokerDestructionDelay);
+ }
+
+ log.trace(this + " scheduled destruction of " + invoker);
+ }
+ }
+ else
+ {
+ InvokerRegistry.destroyClientInvoker(invoker.getLocator(), configuration);
+ }
+
invoker = null;
}
@@ -1725,7 +1765,49 @@
}
return listenerId;
}
+
+ private void processParameters()
+ {
+ Map params = new HashMap();
+ if (configuration != null)
+ params.putAll(configuration);
+ if (locator.getParameters() != null)
+ params.putAll(locator.getParameters());
+
+ Object param = params.get(INVOKER_DESTRUCTION_DELAY);
+ if (param instanceof String)
+ {
+ try
+ {
+ invokerDestructionDelay = Integer.parseInt((String) param);
+ log.debug(this + " setting invokerDestructionDelay to " + invokerDestructionDelay);
+ }
+ catch (NumberFormatException e)
+ {
+ log.error("invokerDestructionDelay parameter has invalid format: " + param);
+ }
+ }
+ else if (param != null)
+ {
+ log.error("invokerDestructionDelay parameter must be a string in integer format: " + param);
+ }
+ }
// Inner classes --------------------------------------------------------------------------------
+ class InvokerDestructionTimerTask extends TimerTask
+ {
+ private ClientInvoker invoker;
+
+ public InvokerDestructionTimerTask(ClientInvoker invoker)
+ {
+ this.invoker = invoker;
+ }
+
+ public void run()
+ {
+ log.trace("calling InvokerRegistry.destroyClientInvoker() for " + invoker);
+ InvokerRegistry.destroyClientInvoker(invoker.getLocator(), configuration);
+ }
+ }
}
16 years, 9 months
JBoss Remoting SVN: r3489 - remoting2/branches/2.x/src/main/org/jboss/remoting.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-02-22 17:32:34 -0500 (Fri, 22 Feb 2008)
New Revision: 3489
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/MicroRemoteClientInvoker.java
Log:
JBREM-900: (1) In invoke() put marshaller set up in synchronized block; (2) removed synchronization from getUnMarshaller(), setUnMarshaller().
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/MicroRemoteClientInvoker.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/MicroRemoteClientInvoker.java 2008-02-22 22:24:19 UTC (rev 3488)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/MicroRemoteClientInvoker.java 2008-02-22 22:32:34 UTC (rev 3489)
@@ -68,31 +68,31 @@
if (trace) { log.trace(this + "(" + (++invokeCount) + ") invoking " + invocationReq); }
- // Set up marshaller.
- Marshaller marshaller = getMarshaller();
- if (marshaller == null)
+ // Set up marshaller and unmarshaller.
+ Marshaller marshaller = null;
+ UnMarshaller unmarshaller = null;
+ RemotingClassLoader rcl = null;
+ synchronized (MicroRemoteClientInvoker.class)
{
- // try by locator (in case marshaller class name specified)
- marshaller = MarshalFactory.getMarshaller(getLocator(), getClassLoader());
+ marshaller = getMarshaller();
if (marshaller == null)
{
- // need to have a marshaller, so create a default one
- marshaller = MarshalFactory.getMarshaller(getDataType(), getSerializationType());
+ // try by locator (in case marshaller class name specified)
+ marshaller = MarshalFactory.getMarshaller(getLocator(), getClassLoader());
if (marshaller == null)
{
- // went as far as possible to find a marshaller, will have to give up
- throw new InvalidMarshallingResource(
- "Can not find a valid marshaller for data type: " + getDataType());
+ // need to have a marshaller, so create a default one
+ marshaller = MarshalFactory.getMarshaller(getDataType(), getSerializationType());
+ if (marshaller == null)
+ {
+ // went as far as possible to find a marshaller, will have to give up
+ throw new InvalidMarshallingResource(
+ "Can not find a valid marshaller for data type: " + getDataType());
+ }
}
+ setMarshaller(marshaller);
}
- setMarshaller(marshaller);
- }
-
- // Set up unmarshaller.
- UnMarshaller unmarshaller = null;
- RemotingClassLoader rcl = null;
- synchronized (unmarshallers)
- {
+
unmarshaller = getUnMarshaller();
if (unmarshaller == null)
{
@@ -350,18 +350,12 @@
public void setUnMarshaller(UnMarshaller unmarshaller)
{
- synchronized (unmarshallers)
- {
- unmarshallers.put(Thread.currentThread().getContextClassLoader(), unmarshaller);
- }
+ unmarshallers.put(Thread.currentThread().getContextClassLoader(), unmarshaller);
}
public UnMarshaller getUnMarshaller()
{
- synchronized (unmarshallers)
- {
- return (UnMarshaller)unmarshallers.get(Thread.currentThread().getContextClassLoader());
- }
+ return (UnMarshaller)unmarshallers.get(Thread.currentThread().getContextClassLoader());
}
public String getSessionId()
16 years, 9 months
JBoss Remoting SVN: r3488 - remoting2/branches/2.x/src/main/org/jboss/remoting/loading.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-02-22 17:24:19 -0500 (Fri, 22 Feb 2008)
New Revision: 3488
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/loading/RemotingClassLoader.java
Log:
JBREM-900: In setUserClassLoader() corrected comparison of parameter userClassLoader to null.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/loading/RemotingClassLoader.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/loading/RemotingClassLoader.java 2008-02-22 22:12:23 UTC (rev 3487)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/loading/RemotingClassLoader.java 2008-02-22 22:24:19 UTC (rev 3488)
@@ -46,7 +46,7 @@
public synchronized void setUserClassLoader(ClassLoader userClassLoader)
throws Exception
{
- if (userClassLoader == null)
+ if (this.userClassLoader == null)
{
this.userClassLoader = userClassLoader;
}
16 years, 9 months
JBoss Remoting SVN: r3487 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/ipv6.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-02-22 17:12:23 -0500 (Fri, 22 Feb 2008)
New Revision: 3487
Modified:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/ipv6/PercentEncodingTestCase.java
Log:
JBREM-865: Skip test if running with jdk 1.4.
Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/ipv6/PercentEncodingTestCase.java
===================================================================
--- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/ipv6/PercentEncodingTestCase.java 2008-02-22 21:13:40 UTC (rev 3486)
+++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/ipv6/PercentEncodingTestCase.java 2008-02-22 22:12:23 UTC (rev 3487)
@@ -70,15 +70,22 @@
public void testPercentEncoding() throws Throwable
{
log.info("entering " + getName());
-
- String locatorURI = "socket://[fe80::205:9aff:fe3c:7800%7]:7777/";
- InvokerLocator locator = new InvokerLocator(locatorURI);
- assertEquals(locatorURI, locator.getLocatorURI());
-
- locatorURI = "socket://multihome/?homes=[fe80::205:9aff:fe3c:7800%7]:7777![fe80::214:22ff:feef:68bb%4]:8888";
- locator = new InvokerLocator(locatorURI);
- assertEquals(locatorURI, locator.getLocatorURI());
-
+
+ String version = System.getProperty("java.version");
+ if (version.startsWith("1.4"))
+ {
+ log.info("java version is " + version + ". Skipping test");
+ }
+ else
+ {
+ String locatorURI = "socket://[fe80::205:9aff:fe3c:7800%7]:7777/";
+ InvokerLocator locator = new InvokerLocator(locatorURI);
+ assertEquals(locatorURI, locator.getLocatorURI());
+
+ locatorURI = "socket://multihome/?homes=[fe80::205:9aff:fe3c:7800%7]:7777![fe80::214:22ff:feef:68bb%4]:8888";
+ locator = new InvokerLocator(locatorURI);
+ assertEquals(locatorURI, locator.getLocatorURI());
+ }
log.info(getName() + " PASSES");
}
16 years, 9 months