JBoss Remoting SVN: r5065 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2009-04-19 00:30:18 -0400 (Sun, 19 Apr 2009)
New Revision: 5065
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/SocketServerInvoker.java
Log:
JBREM-1123: Added immediateShutdown property.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/SocketServerInvoker.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/SocketServerInvoker.java 2009-04-19 04:29:54 UTC (rev 5064)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/SocketServerInvoker.java 2009-04-19 04:30:18 UTC (rev 5065)
@@ -25,7 +25,6 @@
import org.jboss.remoting.Home;
import org.jboss.remoting.InvokerLocator;
import org.jboss.remoting.ServerInvoker;
-import org.jboss.remoting.security.ServerSocketFactoryMBean;
import org.jboss.remoting.util.SecurityUtility;
import org.jboss.remoting.util.TimerUtil;
import org.jboss.remoting.marshal.serializable.SerializableMarshaller;
@@ -101,6 +100,7 @@
protected int maxPoolSize = MAX_POOL_SIZE_DEFAULT;
protected LRUPool clientpool;
protected LinkedList threadpool;
+ protected boolean immediateShutdown;
protected ServerSocketRefresh refreshThread;
protected boolean newServerSocketFactory = false;
@@ -457,7 +457,14 @@
{
Object o = itr.next();
ServerThread st = (ServerThread) o;
- st.shutdown();
+ if (immediateShutdown)
+ {
+ st.shutdownImmediately();
+ }
+ else
+ {
+ st.shutdown();
+ }
}
clientpool.flush();
@@ -471,7 +478,14 @@
for(int i = 0; i < threadsToShutdown; i++)
{
ServerThread thread = (ServerThread) threadpool.removeFirst();
- thread.shutdown();
+ if (immediateShutdown)
+ {
+ thread.shutdownImmediately();
+ }
+ else
+ {
+ thread.shutdown();
+ }
}
log.debug(this + " stopped threads in threadpool");
@@ -700,6 +714,16 @@
}
}
+ public boolean isImmediateShutdown()
+ {
+ return immediateShutdown;
+ }
+
+ public void setImmediateShutdown(boolean immediateShutdown)
+ {
+ this.immediateShutdown = immediateShutdown;
+ }
+
protected void configureSocket(Socket s) throws SocketException
{
s.setReuseAddress(getReuseAddress());
15 years, 8 months
JBoss Remoting SVN: r5064 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2009-04-19 00:29:54 -0400 (Sun, 19 Apr 2009)
New Revision: 5064
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/ServerThread.java
Log:
JBREM-1123: Added shutdownImmediately().
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/ServerThread.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/ServerThread.java 2009-04-19 03:44:19 UTC (rev 5063)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/ServerThread.java 2009-04-19 04:29:54 UTC (rev 5064)
@@ -359,7 +359,29 @@
if (trace) log.trace(this + " shutting down");
notifyAll();
}
+
+ public void shutdownImmediately()
+ {
+ if (trace) log.trace("attempting to shut down immediately " + this);
+ shutdown = true;
+ try
+ {
+ if (socketWrapper != null)
+ {
+ String desc = socketWrapper.toString();
+ socketWrapper.close();
+ if (trace) log.trace(this + " closing socketWrapper: " + desc);
+ }
+ }
+ catch (Exception ex)
+ {
+ log.debug("failed to close socket wrapper", ex);
+ }
+
+ if (trace) log.trace(this + " shutting down");
+ }
+
/**
* Sets if server thread should check connection before continue to process on next invocation
* request. If is set to true, will send an ACK to client to verify client is still connected
15 years, 8 months
JBoss Remoting SVN: r5063 - remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/socket/oneway.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2009-04-18 23:44:19 -0400 (Sat, 18 Apr 2009)
New Revision: 5063
Modified:
remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/socket/oneway/OnewayInvocationTestCase.java
Log:
JBREM-1078: Removed references to MicroSocketClientInvoker.setNumberOfRetries().
Modified: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/socket/oneway/OnewayInvocationTestCase.java
===================================================================
--- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/socket/oneway/OnewayInvocationTestCase.java 2009-04-18 06:34:54 UTC (rev 5062)
+++ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/socket/oneway/OnewayInvocationTestCase.java 2009-04-19 03:44:19 UTC (rev 5063)
@@ -98,7 +98,6 @@
Client client = new Client(locator, clientConfig);
client.connect();
MicroSocketClientInvoker invoker = (MicroSocketClientInvoker) client.getInvoker();
- invoker.setNumberOfRetries(3);
int i = 0;
try
@@ -144,7 +143,6 @@
Client client = new Client(locator, clientConfig);
client.connect();
MicroSocketClientInvoker invoker = (MicroSocketClientInvoker) client.getInvoker();
- invoker.setNumberOfRetries(3);
int i = 0;
try
15 years, 8 months
JBoss Remoting SVN: r5062 - remoting2/branches/2.2/src/main/org/jboss/remoting.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2009-04-18 02:34:54 -0400 (Sat, 18 Apr 2009)
New Revision: 5062
Modified:
remoting2/branches/2.2/src/main/org/jboss/remoting/ServerInvoker.java
Log:
JBREM-1119: (1) Made removeCallbackHandler() public; (2) added shutdownCallbackHandler().
Modified: remoting2/branches/2.2/src/main/org/jboss/remoting/ServerInvoker.java
===================================================================
--- remoting2/branches/2.2/src/main/org/jboss/remoting/ServerInvoker.java 2009-04-18 06:34:10 UTC (rev 5061)
+++ remoting2/branches/2.2/src/main/org/jboss/remoting/ServerInvoker.java 2009-04-18 06:34:54 UTC (rev 5062)
@@ -825,28 +825,7 @@
//then it will just use that without having to do a lookup or HashMap iteration over
//values
- ServerInvocationHandler handler = null;
-
- if (singleHandler != null)
- {
- handler = singleHandler;
- }
- else
- {
- if (subsystem != null)
- {
- handler = (ServerInvocationHandler)handlers.get(subsystem.toUpperCase());
- }
- else
- {
- // subsystem not specified, so will hope for a default one being set
- if (!handlers.isEmpty())
- {
- if (trace) { log.trace(this + " handling invocation with no subsystem explicitely specified, using the default handler"); }
- handler = (ServerInvocationHandler)handlers.values().iterator().next();
- }
- }
- }
+ ServerInvocationHandler handler = findInvocationHandler(subsystem);
if (param instanceof InternalInvocation)
{
@@ -1506,6 +1485,14 @@
ServerInvokerCallbackHandler callbackHandler = removeCallbackHandler(invocation);
if(callbackHandler != null)
{
+ if (registerCallbackListeners)
+ {
+// connectionNotifier.removeListener(callbackHandler);
+ removeConnectionListener(callbackHandler);
+ }
+
+ callbackHandler.destroy();
+
if(handler == null)
{
throw new InvalidConfigurationException(
@@ -1513,15 +1500,10 @@
"registered. Please add via xml configuration or via the Connector's " +
"addInvocationHandler() method.");
}
- if (registerCallbackListeners)
- {
- connectionNotifier.removeListener(callbackHandler);
- }
+
handler.removeListener(callbackHandler);
if(trace) { log.trace("ServerInvoker (" + this + ") removing server callback handler " + callbackHandler + "."); }
-
- callbackHandler.destroy();
}
else
{
@@ -1550,7 +1532,7 @@
// the only elements should be the callback handler and possibly the callback handle object
if(params == null || params.length < 0 || params.length > 3)
{
- log.error("Recieved addClientListener InternalInvocation, but getParameters() " +
+ log.debug("Received addClientListener InternalInvocation, but getParameters() " +
"returned: " + params);
throw new RuntimeException(
"InvokerCallbackHandler and callback handle object (optional) must be supplied as " +
@@ -1636,7 +1618,34 @@
}
return result;
}
+
+ protected ServerInvocationHandler findInvocationHandler(String subsystem)
+ {
+ ServerInvocationHandler handler = null;
+ if (singleHandler != null)
+ {
+ handler = singleHandler;
+ }
+ else
+ {
+ if (subsystem != null)
+ {
+ handler = (ServerInvocationHandler)handlers.get(subsystem.toUpperCase());
+ }
+ else
+ {
+ // subsystem not specified, so will hope for a default one being set
+ if (!handlers.isEmpty())
+ {
+ if (trace) { log.trace(this + " handling invocation with no subsystem explicitely specified, using the default handler"); }
+ handler = (ServerInvocationHandler)handlers.values().iterator().next();
+ }
+ }
+ }
+ return handler;
+ }
+
/**
* Called prior to an invocation.
* TODO is sending in the arg appropriate?
@@ -1865,7 +1874,7 @@
return callbackHandler;
}
- private ServerInvokerCallbackHandler removeCallbackHandler(InvocationRequest invocation)
+ public ServerInvokerCallbackHandler removeCallbackHandler(InvocationRequest invocation)
{
String id = ServerInvokerCallbackHandler.getId(invocation);
ServerInvokerCallbackHandler callbackHandler = null;
@@ -1876,6 +1885,25 @@
}
return callbackHandler;
}
+
+ public void shutdownCallbackHandler(ServerInvokerCallbackHandler callbackHandler, InvocationRequest invocation)
+ {
+ removeCallbackHandler(invocation);
+ if (registerCallbackListeners)
+ {
+ removeConnectionListener(callbackHandler);
+ }
+ ServerInvocationHandler handler = findInvocationHandler(invocation.getSessionId());
+ if (handler != null)
+ {
+ handler.removeListener(callbackHandler);
+ if(trace) { log.trace(this + " removing server callback handler " + callbackHandler + "."); }
+ }
+ else
+ {
+ log.debug(this + " cannot remove " + callbackHandler + ": associated ServerInvocationHandler not longer exists");
+ }
+ }
// Inner classes --------------------------------------------------------------------------------
15 years, 8 months
JBoss Remoting SVN: r5061 - remoting2/branches/2.2/src/main/org/jboss/remoting/callback.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2009-04-18 02:34:10 -0400 (Sat, 18 Apr 2009)
New Revision: 5061
Modified:
remoting2/branches/2.2/src/main/org/jboss/remoting/callback/ServerInvokerCallbackHandler.java
Log:
JBREM-1119: Added shutdown() method.
Modified: remoting2/branches/2.2/src/main/org/jboss/remoting/callback/ServerInvokerCallbackHandler.java
===================================================================
--- remoting2/branches/2.2/src/main/org/jboss/remoting/callback/ServerInvokerCallbackHandler.java 2009-04-18 06:33:42 UTC (rev 5060)
+++ remoting2/branches/2.2/src/main/org/jboss/remoting/callback/ServerInvokerCallbackHandler.java 2009-04-18 06:34:10 UTC (rev 5061)
@@ -81,6 +81,7 @@
private SerializableStore callbackStore = null;
private CallbackErrorHandler callbackErrorHandler = null;
+ private ServerInvoker serverInvoker;
/**
* The map key to use when looking up any callback store that
@@ -166,6 +167,7 @@
private void init(InvocationRequest invocation, ServerInvoker owner) throws Exception
{
+ serverInvoker = owner;
clientSessionId = invocation.getSessionId();
sessionId = invocation.getSessionId();
@@ -1020,12 +1022,18 @@
}
}
+ public void shutdown()
+ {
+ serverInvoker.shutdownCallbackHandler(this, invocation);
+ destroy();
+ log.debug(this + " shut down");
+ }
+
public void handleConnectionException(Throwable throwable, Client client)
{
if (clientSessionId.equals(client.getSessionId()))
{
- destroy();
- log.debug(this + " shut down");
+ shutdown();
}
}
15 years, 8 months
JBoss Remoting SVN: r5060 - remoting2/branches/2.2/src/main/org/jboss/remoting.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2009-04-18 02:33:42 -0400 (Sat, 18 Apr 2009)
New Revision: 5060
Modified:
remoting2/branches/2.2/src/main/org/jboss/remoting/ConnectionNotifier.java
Log:
JBREM-1119: Use copies of lists to avoid ConcurrentModificationException.
Modified: remoting2/branches/2.2/src/main/org/jboss/remoting/ConnectionNotifier.java
===================================================================
--- remoting2/branches/2.2/src/main/org/jboss/remoting/ConnectionNotifier.java 2009-04-18 06:33:21 UTC (rev 5059)
+++ remoting2/branches/2.2/src/main/org/jboss/remoting/ConnectionNotifier.java 2009-04-18 06:33:42 UTC (rev 5060)
@@ -47,14 +47,17 @@
Client client = new Client(new InvokerLocator(locatorurl), requestPayload);
client.setSessionId(clientSessionId);
+ ArrayList localListeners = null;
synchronized (listeners)
{
- Iterator it = listeners.iterator();
- while (it.hasNext())
- {
- ((ConnectionListener) it.next()).handleConnectionException(null, client);
- }
+ localListeners = new ArrayList(listeners);
}
+
+ Iterator it = localListeners.iterator();
+ while (it.hasNext())
+ {
+ ((ConnectionListener) it.next()).handleConnectionException(null, client);
+ }
}
catch(Exception e)
{
@@ -74,14 +77,17 @@
client.setSessionId(clientSessionId);
ClientDisconnectedException ex = new ClientDisconnectedException();
+ ArrayList localListeners = null;
synchronized (listeners)
{
- Iterator it = listeners.iterator();
- while (it.hasNext())
- {
- ((ConnectionListener) it.next()).handleConnectionException(ex, client);
- }
+ localListeners = new ArrayList(listeners);
}
+
+ Iterator it = localListeners.iterator();
+ while (it.hasNext())
+ {
+ ((ConnectionListener) it.next()).handleConnectionException(ex, client);
+ }
}
catch(Exception e)
{
15 years, 8 months
JBoss Remoting SVN: r5059 - in remoting2/branches/2.2/src/tests/org/jboss/test/remoting/callback: leak and 1 other directory.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2009-04-18 02:33:21 -0400 (Sat, 18 Apr 2009)
New Revision: 5059
Added:
remoting2/branches/2.2/src/tests/org/jboss/test/remoting/callback/leak/
remoting2/branches/2.2/src/tests/org/jboss/test/remoting/callback/leak/ServerInvokerCallbackHandlerLeakTestCase.java
Log:
JBREM-1119: New unit tests.
Added: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/callback/leak/ServerInvokerCallbackHandlerLeakTestCase.java
===================================================================
--- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/callback/leak/ServerInvokerCallbackHandlerLeakTestCase.java (rev 0)
+++ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/callback/leak/ServerInvokerCallbackHandlerLeakTestCase.java 2009-04-18 06:33:21 UTC (rev 5059)
@@ -0,0 +1,279 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.callback.leak;
+
+import java.lang.reflect.Field;
+import java.net.InetAddress;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import java.util.TimerTask;
+
+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.remoting.Client;
+import org.jboss.remoting.ConnectionListener;
+import org.jboss.remoting.ConnectionNotifier;
+import org.jboss.remoting.InvocationRequest;
+import org.jboss.remoting.InvokerLocator;
+import org.jboss.remoting.LeasePinger;
+import org.jboss.remoting.MicroRemoteClientInvoker;
+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.callback.ServerInvokerCallbackHandler;
+import org.jboss.remoting.transport.Connector;
+import org.jboss.remoting.transport.PortUtil;
+
+
+/**
+ * Unit tests for JBREM-1113.
+ *
+ * @author <a href="ron.sigal(a)jboss.com">Ron Sigal</a>
+ * @version $Rev$
+ * <p>
+ * Copyright Apr 13, 2009
+ * </p>
+ */
+public class ServerInvokerCallbackHandlerLeakTestCase extends TestCase
+{
+ private static Logger log = Logger.getLogger(ServerInvokerCallbackHandlerLeakTestCase.class);
+
+ private static boolean firstTime = true;
+ private static int COUNT = 10;
+ private static Object lock = new Object();
+
+ 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(Level.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);
+ }
+ TestConnectionListener.count = 0;
+ }
+
+
+ public void tearDown()
+ {
+ }
+
+
+ public void testLeakWithCallbackHandlersListening() throws Throwable
+ {
+ doLeakTest(true);
+ }
+
+
+ public void testLeakWithoutCallbackHandlersListening() throws Throwable
+ {
+ doLeakTest(false);
+ }
+
+
+ public void doLeakTest(boolean registerCallbackListener) throws Throwable
+ {
+ log.info("entering " + getName());
+ setupServer(registerCallbackListener);
+
+ // Get fields.
+ ServerInvoker serverInvoker = connector.getServerInvoker();
+ Field field = ServerInvoker.class.getDeclaredField("connectionNotifier");
+ field.setAccessible(true);
+ ConnectionNotifier connectionNotifier = (ConnectionNotifier) field.get(serverInvoker);
+ field = ServerInvoker.class.getDeclaredField("callbackHandlers");
+ field.setAccessible(true);
+ Map callbackHandlers = (Map) field.get(serverInvoker);
+
+ // Create client.
+ HashMap clientConfig = new HashMap();
+ clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
+ addExtraClientConfig(clientConfig);
+ Client client = null;
+
+ for (int i = 0; i < COUNT; i++)
+ {
+ client = new Client(serverLocator, clientConfig);
+ client.connect();
+ log.info("client is connected");
+
+ // Test connections.
+ assertEquals("abc", client.invoke("abc"));
+ log.info("connection is good");
+
+ TestCallbackHandler callbackHandler = new TestCallbackHandler();
+ client.addListener(callbackHandler, null, null, true);
+ }
+
+ field = MicroRemoteClientInvoker.class.getDeclaredField("leasePinger");
+ field.setAccessible(true);
+ LeasePinger pinger = (LeasePinger) field.get(client.getInvoker());
+ field = LeasePinger.class.getDeclaredField("timerTask");
+ field.setAccessible(true);
+ TimerTask timerTask = (TimerTask) field.get(pinger);
+ timerTask.cancel();
+
+ synchronized(lock)
+ {
+ lock.wait();
+ }
+ Thread.sleep(2000);
+
+ assertEquals(COUNT, TestConnectionListener.count);
+ assertEquals(1, connectionNotifier.size());
+ assertTrue(callbackHandlers.isEmpty());
+
+ log.info(getName() + " PASSES");
+ }
+
+
+ protected String getTransport()
+ {
+ return "socket";
+ }
+
+
+ protected void addExtraClientConfig(Map config) {}
+ protected void addExtraServerConfig(Map config) {}
+
+
+ protected void setupServer(boolean registerCallbackListener) throws Exception
+ {
+ host = InetAddress.getLocalHost().getHostAddress();
+ port = PortUtil.findFreePort(host);
+ locatorURI = getTransport() + "://" + host + ":" + port;
+ locatorURI += "/?leasing=true";
+ if (registerCallbackListener)
+ {
+ locatorURI += "&" + ServerInvoker.REGISTER_CALLBACK_LISTENER + "=true";
+ }
+ else
+ {
+ locatorURI += "&" + ServerInvoker.REGISTER_CALLBACK_LISTENER + "=false";
+ }
+ 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();
+ connector.setLeasePeriod(2000);
+ TestConnectionListener listener = new TestConnectionListener(!registerCallbackListener);
+ connector.addConnectionListener(listener);
+ }
+
+
+ protected void shutdownServer() throws Exception
+ {
+ if (connector != null)
+ connector.stop();
+ }
+
+
+ static class TestInvocationHandler implements ServerInvocationHandler
+ {
+ static public Set callbackHandlers = new HashSet();
+ public void addListener(InvokerCallbackHandler callbackHandler)
+ {
+ callbackHandlers.add(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");
+ }
+ }
+
+
+ static class TestConnectionListener implements ConnectionListener
+ {
+ static public int count;
+ boolean shutdownCallbackHandlers;
+
+ public TestConnectionListener(boolean shutdownCallbackHandlers)
+ {
+ this.shutdownCallbackHandlers = shutdownCallbackHandlers;
+ }
+
+ public synchronized void handleConnectionException(Throwable throwable, Client client)
+ {
+ log.info("got connection exception");
+ if(++count == COUNT)
+ {
+ if (shutdownCallbackHandlers)
+ {
+ Iterator it = TestInvocationHandler.callbackHandlers.iterator();
+ while (it.hasNext())
+ {
+ ServerInvokerCallbackHandler callbackHandler = (ServerInvokerCallbackHandler) it.next();
+ callbackHandler.shutdown();
+ log.info("shut down: " + callbackHandler);
+ }
+ TestInvocationHandler.callbackHandlers.clear();
+ }
+ synchronized(lock)
+ {
+ lock.notify();
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
15 years, 8 months
JBoss Remoting SVN: r5058 - remoting2/branches/2.2/docs/guide/en.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2009-04-18 00:09:58 -0400 (Sat, 18 Apr 2009)
New Revision: 5058
Modified:
remoting2/branches/2.2/docs/guide/en/chap5.xml
Log:
JBREM-1078: Removed references to MicroSocketClientInvoker.numberOfRetries.
Modified: remoting2/branches/2.2/docs/guide/en/chap5.xml
===================================================================
--- remoting2/branches/2.2/docs/guide/en/chap5.xml 2009-04-18 03:46:46 UTC (rev 5057)
+++ remoting2/branches/2.2/docs/guide/en/chap5.xml 2009-04-18 04:09:58 UTC (rev 5058)
@@ -1069,18 +1069,8 @@
to the maximum number of concurrent client calls that can be made from
the socket client invoker. The default is 50.</para>
- <para><emphasis role="bold">numberOfRetries</emphasis> - number of
- retries to get a socket from the pool. This basically equates to number
- of seconds will wait to get client socket connection from pool before
- timing out. If max retries is reached, will cause a
- CannotConnectException to be thrown (whose cause will be SocketException
- saying how long it waited for socket connection from pool). The default
- is 30 (MAX_RETRIES)</para>
-
<para><emphasis role="bold">numberOfCallRetries</emphasis> - number of
- retries for making invocation. This is unrelated to numberOfRetries in
- that when this comes into play is after it has already received a client
- socket connection from the pool. However, is possible that the socket
+ retries for making invocation. It is possible that an existing socket
connection timed out while waiting within the pool. Since not doing a
connection check by default, will throw away the connection and try to
get a new one. Will do this for whatever the numberOfCallRetries (which
@@ -1234,14 +1224,12 @@
connection to the pool. As more client invocations are made, is
possible for the number of socket connections to reach the maximum
allowed (which is controlled by 'clientMaxPoolSize' property). At this
- point, when the next client invocation is made, it will keep trying to
- get an available connection from the pool, waiting 1 second in between
- tries for up to maximum number of retries (which is controlled by the
- numberOfRetries property). If runs out of retries, will throw
- SocketException saying how long it waited to find available socket
- connection.</para>
+ point, when the next client invocation is made, it will wait up to
+ 30 seconds for an existing connection to be returned to the pool.
+ If it doesn't get a connection within 30 seconds, it will throw
+ an IllegalStateException.</para>
- <para>Once the socket client invoker goes get an available socket
+ <para>Once the socket client invoker goes and get an available socket
connection from the pool, are not out of the woods yet. There is still
a possibility that the socket connection returned, while still
appearing to be valid, has timed out while sitting in the pool. So if
15 years, 8 months
JBoss Remoting SVN: r5057 - remoting2/branches/2.2/src/main/org/jboss/remoting/transport/socket.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2009-04-17 23:46:46 -0400 (Fri, 17 Apr 2009)
New Revision: 5057
Modified:
remoting2/branches/2.2/src/main/org/jboss/remoting/transport/socket/MicroSocketClientInvoker.java
Log:
JBREM-1078: Removed umberOfRetries.
Modified: remoting2/branches/2.2/src/main/org/jboss/remoting/transport/socket/MicroSocketClientInvoker.java
===================================================================
--- remoting2/branches/2.2/src/main/org/jboss/remoting/transport/socket/MicroSocketClientInvoker.java 2009-04-18 03:45:55 UTC (rev 5056)
+++ remoting2/branches/2.2/src/main/org/jboss/remoting/transport/socket/MicroSocketClientInvoker.java 2009-04-18 03:46:46 UTC (rev 5057)
@@ -83,13 +83,6 @@
public static final boolean TCP_NODELAY_DEFAULT = false;
/**
- * Default maximum number of retries to get a valid socket from the* socket pool. This also
- * translates to number of seconds will wait for connection to be returned to connection pool
- * before erroring. Default is 30.
- */
- public static final int MAX_RETRIES = 30;
-
- /**
* Default maximum number of times a invocation will be made when it gets a SocketException.
* Default is 3.
*/
@@ -200,7 +193,6 @@
protected String clientSocketClassName;
protected Class clientSocketClass;
- protected int numberOfRetries;
protected int numberOfCallRetries;
protected int maxPoolSize;
@@ -241,7 +233,6 @@
enableTcpNoDelay = TCP_NODELAY_DEFAULT;
clientSocketClassName = ClientSocketWrapper.class.getName();
clientSocketClass = null;
- numberOfRetries = MAX_RETRIES;
numberOfCallRetries = MAX_CALL_RETRIES;
pool = null;
maxPoolSize = MAX_POOL_SIZE;
@@ -335,28 +326,6 @@
return numberOfCallRetries;
}
- /**
- * Sets the number of retries to get a socket connection.
- *
- * @param numberOfRetries Must be a number greater than 0.
- */
- public void setNumberOfRetries(int numberOfRetries)
- {
- if (numberOfRetries < 1)
- {
- this.numberOfRetries = MAX_RETRIES;
- }
- else
- {
- this.numberOfRetries = numberOfRetries;
- }
- }
-
- public int getNumberOfRetries()
- {
- return numberOfRetries;
- }
-
public boolean isWrapInterruptedException()
{
return wrapInterruptedException;
15 years, 8 months
JBoss Remoting SVN: r5056 - remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/socket/configuration.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2009-04-17 23:45:55 -0400 (Fri, 17 Apr 2009)
New Revision: 5056
Modified:
remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/socket/configuration/SocketRetryConfigTestCase.java
Log:
JBREM-1078: Removed unused socketRetries variable.
Modified: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/socket/configuration/SocketRetryConfigTestCase.java
===================================================================
--- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/socket/configuration/SocketRetryConfigTestCase.java 2009-04-18 03:44:38 UTC (rev 5055)
+++ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/socket/configuration/SocketRetryConfigTestCase.java 2009-04-18 03:45:55 UTC (rev 5056)
@@ -32,7 +32,6 @@
*/
public class SocketRetryConfigTestCase extends TestCase
{
- private int socketRetries = 5;
private int callRetries = 6;
private int timeout = 1000;
15 years, 8 months