JBoss Remoting SVN: r4037 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-04-22 04:32:22 -0400 (Tue, 22 Apr 2008)
New Revision: 4037
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/PortUtil.java
Log:
JBREM-966: Replace getRandomStartingPort() with simple call to SecureRandom.nextInt().
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/PortUtil.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/PortUtil.java 2008-04-22 07:14:18 UTC (rev 4036)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/PortUtil.java 2008-04-22 08:32:22 UTC (rev 4037)
@@ -162,13 +162,12 @@
}
public static int getRandomStartingPort()
- {
- Object o = new Object();
- String os = o.toString();
- os = os.substring(17);
- int n = Integer.parseInt(os, 16);
- int p = Math.abs(new SecureRandom(String.valueOf(System.currentTimeMillis() + n).getBytes()).nextInt(2000)) + 2000;
- return p;
+ {
+ int minPort = 2000;
+ int maxPort = 65535;
+ int count = maxPort - minPort + 1;
+ int port = new SecureRandom().nextInt(count) + minPort;
+ return port;
}
public static void main(String args[])
16 years, 7 months
JBoss Remoting SVN: r4036 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/connection.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-04-22 03:14:18 -0400 (Tue, 22 Apr 2008)
New Revision: 4036
Added:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/connection/ConnectionValidatorRemoteClient.java
Log:
JBREM-947: Used for manual check on ConnectionValidator when network cable is unplugged.
Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/connection/ConnectionValidatorRemoteClient.java
===================================================================
--- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/connection/ConnectionValidatorRemoteClient.java (rev 0)
+++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/connection/ConnectionValidatorRemoteClient.java 2008-04-22 07:14:18 UTC (rev 4036)
@@ -0,0 +1,135 @@
+/*
+* 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.connection;
+
+import java.util.HashMap;
+
+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.ConnectionListener;
+import org.jboss.remoting.ConnectionValidator;
+import org.jboss.remoting.InvokerLocator;
+
+/**
+ * @author <a href="mailto:tom.elrod@jboss.com">Tom Elrod</a>
+ */
+public class ConnectionValidatorRemoteClient extends TestCase implements ConnectionListener
+{
+ private static Logger log = Logger.getLogger(ConnectionValidatorRemoteClient.class);
+
+ // Default locator values
+ private static String transport = "socket";
+ private static String host = "localhost";
+ private static int port = 5400;
+ String locatorURI = transport + "://" + host + ":" + port;
+ private Throwable validatorResp = null;
+ private int counter = 0;
+
+ private Client remotingClient = null;
+
+ public void testValidator() throws Throwable
+ {
+
+ HashMap config = new HashMap();
+ config.put(ConnectionValidator.VALIDATOR_PING_TIMEOUT, "1000");
+ config.put("timeout", "20000");
+ remotingClient.addConnectionListener(this, config);
+
+ Object response = remotingClient.invoke("Do something");
+
+ log.info("Invocation response: " + response);
+
+ assertNull(validatorResp);
+
+ Thread.currentThread().sleep(30000);
+
+ log.info("validatorResp = " + validatorResp);
+ assertNotNull("Connection listener was not called as expected.", validatorResp);
+ assertEquals(1, counter);
+ }
+
+ public void setUp() throws Exception
+ {
+ 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);
+
+ InvokerLocator locator = new InvokerLocator(locatorURI);
+ log.info("Calling remoting server with locator uri of: " + locatorURI);
+
+ remotingClient = new Client(locator);
+ remotingClient.connect();
+ }
+
+ public void tearDown() throws Exception
+ {
+ if(remotingClient != null)
+ {
+ remotingClient.disconnect();
+ }
+ }
+
+ /**
+ * Can pass transport and port to be used as parameters.
+ * Valid transports are 'rmi' and 'socket'.
+ *
+ * @param args
+ */
+ public static void main(String[] args)
+ {
+ if(args != null && args.length == 3)
+ {
+ transport = args[0];
+ host = args[1];
+ port = Integer.parseInt(args[2]);
+ }
+
+ ConnectionValidatorRemoteClient client = new ConnectionValidatorRemoteClient();
+ try
+ {
+ client.setUp();
+ client.testValidator();
+ client.tearDown();
+ }
+ catch(Throwable e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ public void handleConnectionException(Throwable throwable, Client client)
+ {
+ log.info("Got connection exception.");
+ validatorResp = throwable;
+ counter++;
+ }
+}
\ No newline at end of file
16 years, 7 months
JBoss Remoting SVN: r4035 - in remoting2/branches/2.x/src/tests/org/jboss/test/remoting/lease: timeout and 1 other directory.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-04-21 22:06:57 -0400 (Mon, 21 Apr 2008)
New Revision: 4035
Added:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/lease/timeout/
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/lease/timeout/LeasePingerTimeoutTestCase.java
Log:
JBREM-956: New unit test.
Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/lease/timeout/LeasePingerTimeoutTestCase.java
===================================================================
--- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/lease/timeout/LeasePingerTimeoutTestCase.java (rev 0)
+++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/lease/timeout/LeasePingerTimeoutTestCase.java 2008-04-22 02:06:57 UTC (rev 4035)
@@ -0,0 +1,307 @@
+/*
+* 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.lease.timeout;
+
+import java.lang.reflect.Field;
+import java.net.InetAddress;
+import java.util.HashMap;
+import java.util.List;
+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.ConnectionListener;
+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.InvokerCallbackHandler;
+import org.jboss.remoting.transport.Connector;
+import org.jboss.remoting.transport.PortUtil;
+import org.jboss.remoting.transport.socket.LRUPool;
+import org.jboss.remoting.transport.socket.ServerThread;
+import org.jboss.remoting.transport.socket.SocketServerInvoker;
+
+
+/**
+ * Unit test for JBREM-956.
+ *
+ * @author <a href="ron.sigal(a)jboss.com">Ron Sigal</a>
+ * @version $Revision: 1.1 $
+ * <p>
+ * Copyright Apr 20, 2008
+ * </p>
+ */
+public class LeasePingerTimeoutTestCase extends TestCase
+{
+ private static Logger log = Logger.getLogger(LeasePingerTimeoutTestCase.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()
+ {
+ }
+
+
+ /**
+ * Verifies that LeasePinger uses standard "timeout" parameter in the absence
+ * of a "leasePingerTimeout" parameter.
+ */
+ public void testDefaultTimeout() 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();
+
+ // Get LeasePinger.
+ MicroRemoteClientInvoker clientInvoker = (MicroRemoteClientInvoker) client.getInvoker();
+ Field field = MicroRemoteClientInvoker.class.getDeclaredField("leasePinger");
+ field.setAccessible(true);
+ LeasePinger pinger = (LeasePinger) field.get(clientInvoker);
+
+ // Prevent server from answering PINGs.
+ SocketServerInvoker serverInvoker = (SocketServerInvoker) connector.getServerInvoker();
+ field = SocketServerInvoker.class.getDeclaredField("clientpool");
+ field.setAccessible(true);
+ LRUPool clientpool = (LRUPool) field.get(serverInvoker);
+ assertEquals(1, clientpool.size());
+ ServerThread st = (ServerThread) clientpool.getContents().iterator().next();
+
+ while (clientpool.size() > 0)
+ {
+ st.evict();
+ Thread.sleep(1000);
+ }
+
+ field = SocketServerInvoker.class.getDeclaredField("threadpool");
+ field.setAccessible(true);
+ List threadpool = (List) field.get(serverInvoker);
+ threadpool.clear();
+ assertEquals(0, threadpool.size());
+ log.info("clientpool.size(): " + clientpool.size());
+ log.info("threadpool.size(): " + threadpool.size());
+ serverInvoker.setMaxPoolSize(0);
+
+ // Verify that PING fails after default timeout.
+ Field succeedField = LeasePinger.class.getDeclaredField("pingSucceeded");
+ succeedField.setAccessible(true);
+ Field invokedField = LeasePinger.class.getDeclaredField("pingInvoked");
+ invokedField.setAccessible(true);
+ boolean pingInvoked = ((Boolean) invokedField.get(pinger)).booleanValue();
+
+ while (!pingInvoked)
+ {
+ Thread.sleep(1000);
+ pingInvoked = ((Boolean) invokedField.get(pinger)).booleanValue();
+ }
+
+ // Verify that PING has been sent but not answered.
+ log.info("pingInvoked: " + pingInvoked);
+ Thread.sleep(5000);
+ assertTrue(((Boolean) invokedField.get(pinger)).booleanValue());
+ assertFalse(((Boolean) succeedField.get(pinger)).booleanValue());
+ log.info("LeasePinger has not timed out after 5000 ms");
+
+ client.setDisconnectTimeout(0);
+ client.disconnect();
+ shutdownServer();
+ log.info(getName() + " PASSES");
+ }
+
+
+ /**
+ * Verifies that LeasePinger uses "leasePingerTimeout" if it is present.
+ */
+ public void testLeasePingerTimeout() 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(LeasePinger.LEASE_PINGER_TIMEOUT, "1000");
+ addExtraClientConfig(clientConfig);
+ Client client = new Client(clientLocator, clientConfig);
+ client.connect();
+
+ // Get LeasePinger.
+ MicroRemoteClientInvoker clientInvoker = (MicroRemoteClientInvoker) client.getInvoker();
+ Field field = MicroRemoteClientInvoker.class.getDeclaredField("leasePinger");
+ field.setAccessible(true);
+ LeasePinger pinger = (LeasePinger) field.get(clientInvoker);
+
+ // Prevent server from answering PINGs.
+ SocketServerInvoker serverInvoker = (SocketServerInvoker) connector.getServerInvoker();
+ field = SocketServerInvoker.class.getDeclaredField("clientpool");
+ field.setAccessible(true);
+ LRUPool clientpool = (LRUPool) field.get(serverInvoker);
+ assertEquals(1, clientpool.size());
+ ServerThread st = (ServerThread) clientpool.getContents().iterator().next();
+
+ while (clientpool.size() > 0)
+ {
+ st.evict();
+ Thread.sleep(1000);
+ }
+
+ field = SocketServerInvoker.class.getDeclaredField("threadpool");
+ field.setAccessible(true);
+ List threadpool = (List) field.get(serverInvoker);
+ threadpool.clear();
+ assertEquals(0, threadpool.size());
+ log.info("clientpool.size(): " + clientpool.size());
+ log.info("threadpool.size(): " + threadpool.size());
+ serverInvoker.setMaxPoolSize(0);
+
+ // Verify that PING fails after default timeout.
+ Field succeedField = LeasePinger.class.getDeclaredField("pingSucceeded");
+ succeedField.setAccessible(true);
+ Field invokedField = LeasePinger.class.getDeclaredField("pingInvoked");
+ invokedField.setAccessible(true);
+ boolean pingInvoked = ((Boolean) invokedField.get(pinger)).booleanValue();
+
+ while (!pingInvoked)
+ {
+ Thread.sleep(1000);
+ pingInvoked = ((Boolean) invokedField.get(pinger)).booleanValue();
+ }
+
+ // Verify that PING has been sent but not answered.
+ log.info("pingInvoked: " + pingInvoked);
+ Thread.sleep(5000);
+ assertFalse(((Boolean) invokedField.get(pinger)).booleanValue());
+ assertFalse(((Boolean) succeedField.get(pinger)).booleanValue());
+ log.info("LeasePinger has timed out withing 5000 ms");
+
+ client.setDisconnectTimeout(0);
+ 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;
+ locatorURI += "/?enableLease=true";
+ locatorURI += "&" + InvokerLocator.CLIENT_LEASE + "=true";
+ locatorURI += "&leasePeriod=10000";
+ locatorURI += "&timeout=10000";
+ 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.addConnectionListener(new TestConnectionListener());
+ 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 TestConnectionListener implements ConnectionListener
+ {
+ public void handleConnectionException(Throwable throwable, Client client)
+ {
+ }
+ }
+}
\ No newline at end of file
16 years, 7 months
JBoss Remoting SVN: r4034 - remoting2/branches/2.x/src/main/org/jboss/remoting.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-04-21 22:04:54 -0400 (Mon, 21 Apr 2008)
New Revision: 4034
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/ServerInvoker.java
Log:
JBREM-956: Remove per invocation timeout from PING request payload.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/ServerInvoker.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/ServerInvoker.java 2008-04-22 02:02:50 UTC (rev 4033)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/ServerInvoker.java 2008-04-22 02:04:54 UTC (rev 4034)
@@ -1913,6 +1913,11 @@
if(invocation != null)
{
String clientSessionId = invocation.getSessionId();
+ if (invocation.getRequestPayload() != null)
+ {
+ // Remove per invocation timeout.
+ invocation.getRequestPayload().remove(TIMEOUT);
+ }
if(clientSessionId != null)
{
if(trace) { log.trace("Getting lease for client session id: " + clientSessionId); }
16 years, 7 months
JBoss Remoting SVN: r4033 - remoting2/branches/2.x/src/main/org/jboss/remoting.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-04-21 22:02:50 -0400 (Mon, 21 Apr 2008)
New Revision: 4033
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/MicroRemoteClientInvoker.java
Log:
JBREM-956: Passes configuration map to LeasePinger constructor.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/MicroRemoteClientInvoker.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/MicroRemoteClientInvoker.java 2008-04-22 02:02:23 UTC (rev 4032)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/MicroRemoteClientInvoker.java 2008-04-22 02:02:50 UTC (rev 4033)
@@ -502,7 +502,7 @@
if(trace) { log.trace("server does have leasing enabled (with default lease period of " + defaultLeasePeriod + ") and will start a new lease pinger."); }
- leasePinger = new LeasePinger(this, invokerSessionID, defaultLeasePeriod);
+ leasePinger = new LeasePinger(this, invokerSessionID, defaultLeasePeriod, configuration);
leasePinger.addClient(clientSessionID, configuration, leasePeriod);
leasePinger.startPing();
}
16 years, 7 months
JBoss Remoting SVN: r4032 - remoting2/branches/2.x/src/main/org/jboss/remoting.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-04-21 22:02:23 -0400 (Mon, 21 Apr 2008)
New Revision: 4032
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/LeasePinger.java
Log:
JBREM-956: Added leasePingerTimeout configuration parameter.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/LeasePinger.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/LeasePinger.java 2008-04-22 01:03:22 UTC (rev 4031)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/LeasePinger.java 2008-04-22 02:02:23 UTC (rev 4032)
@@ -25,6 +25,7 @@
public static final long DEFAULT_LEASE_PERIOD = 5000;
public static final int DEFAULT_DISCONNECT_TIMEOUT = -1;
+ public static final String LEASE_PINGER_TIMEOUT = "leasePingerTimeout";
// Static ---------------------------------------------------------------------------------------
@@ -44,15 +45,48 @@
private long pingPeriod = -1;
private int disconnectTimeout = DEFAULT_DISCONNECT_TIMEOUT;
+ private int leasePingerTimeout = -1;
+
+ // The following variables exist for testing purposes.
+ private boolean pingInvoked;
+ private boolean pingSucceeded;
// Constructors ---------------------------------------------------------------------------------
public LeasePinger(ClientInvoker invoker, String invokerSessionID, long defaultLeasePeriod)
{
+ this(invoker, invokerSessionID, defaultLeasePeriod, null);
+ }
+
+ public LeasePinger(ClientInvoker invoker, String invokerSessionID, long defaultLeasePeriod, Map config)
+ {
this.invoker = invoker;
this.invokerSessionID = invokerSessionID;
this.pingPeriod = defaultLeasePeriod;
this.defaultPingPeriod = defaultLeasePeriod;
+
+ if (config != null)
+ {
+ Object o = config.get(LEASE_PINGER_TIMEOUT);
+ if (o != null)
+ {
+ if (o instanceof String)
+ {
+ try
+ {
+ leasePingerTimeout = Integer.valueOf((String) o).intValue();
+ }
+ catch (NumberFormatException e)
+ {
+ log.warn("leasePingerTimeout parameter must represent an int: " + o);
+ }
+ }
+ else
+ {
+ log.warn("leasePingerTimeout parameter must be a String representing an int");
+ }
+ }
+ }
}
// Public ---------------------------------------------------------------------------------------
@@ -277,15 +311,25 @@
Map requestClients = new ConcurrentHashMap();
requestClients.put(ClientHolder.CLIENT_HOLDER_KEY, clientsClone);
+ if (leasePingerTimeout >= 0)
+ {
+ requestClients.put(ServerInvoker.TIMEOUT, Integer.toString(leasePingerTimeout));
+ }
+
InvocationRequest ir =
new InvocationRequest(invokerSessionID, null, "$PING$", requestClients, null, null);
-
+
+ pingSucceeded = false;
+ pingInvoked = true;
invoker.invoke(ir);
+ pingSucceeded = true;
+ pingInvoked = false;
if(trace) { log.trace(this + " successfully pinged the server"); }
}
catch (Throwable t)
{
+ pingInvoked = false;
log.debug(this + " failed to ping to server", t);
}
}
16 years, 7 months
JBoss Remoting SVN: r4031 - remoting3/trunk.
by jboss-remoting-commits@lists.jboss.org
Author: david.lloyd(a)jboss.com
Date: 2008-04-21 21:03:22 -0400 (Mon, 21 Apr 2008)
New Revision: 4031
Modified:
remoting3/trunk/build.properties
remoting3/trunk/build.xml
Log:
Allow se6 server implementation to build on 1.5 as well
Modified: remoting3/trunk/build.properties
===================================================================
--- remoting3/trunk/build.properties 2008-04-21 23:13:05 UTC (rev 4030)
+++ remoting3/trunk/build.properties 2008-04-22 01:03:22 UTC (rev 4031)
@@ -140,6 +140,14 @@
lib.servlet.local=${local.repository}/${lib.servlet.path}
lib.servlet.remote=${remote.repository}/${lib.servlet.path}
+lib.sun-httpserver.version=20070405
+lib.sun-httpserver.name=http-${lib.sun-httpserver.version}.jar
+lib.sun-httpserver.license=gpl
+lib.sun-httpserver.dir=sun-httpserver/${lib.sun-httpserver.version}/lib
+lib.sun-httpserver.path=${lib.sun-httpserver.dir}/${lib.sun-httpserver.name}
+lib.sun-httpserver.local=${local.repository}/${lib.sun-httpserver.path}
+lib.sun-httpserver.remote=${remote.repository}/${lib.sun-httpserver.path}
+
lib.trove.version=2.1.1
lib.trove.name=trove.jar
lib.trove.license=lgpl
Modified: remoting3/trunk/build.xml
===================================================================
--- remoting3/trunk/build.xml 2008-04-21 23:13:05 UTC (rev 4030)
+++ remoting3/trunk/build.xml 2008-04-22 01:03:22 UTC (rev 4031)
@@ -163,6 +163,18 @@
<get src="${remote.license.dir}/${lib.servlet.license}.txt" dest="${lib.servlet.local}.license.txt" usetimestamp="true" ignoreerrors="false"/>
</target>
+ <!-- External library: Sun embedded HTTP server -->
+
+ <target name="lib.sun-httpserver-check">
+ <available property="lib.sun-httpserver.exists" file="${lib.sun-httpserver.local}"/>
+ </target>
+
+ <target name="lib.sun-httpserver" depends="lib.sun-httpserver-check" unless="lib.sun-httpserver.exists">
+ <mkdir dir="${local.repository}/${lib.sun-httpserver.dir}"/>
+ <get src="${lib.sun-httpserver.remote}" dest="${lib.sun-httpserver.local}" usetimestamp="true" ignoreerrors="false"/>
+ <get src="${remote.license.dir}/${lib.sun-httpserver.license}.txt" dest="${lib.sun-httpserver.local}.license.txt" usetimestamp="true" ignoreerrors="false"/>
+ </target>
+
<!-- ============================================== -->
<!-- MODULES - Keep in alpha order by target name -->
<!-- ============================================== -->
@@ -458,6 +470,24 @@
<!-- http-se6 module -->
+ <target name="http-se6.httpserver.builtin-check">
+ <condition property="http-se6.httpserver.builtin">
+ <available classname="com.sun.http.HttpServer"/>
+ </condition>
+ </target>
+
+ <target name="http-se6.httpserver.classpath.false" depends="http-se6.httpserver.builtin-check" unless="http-se6.httpserver.builtin">
+ <path id="httpserver.classpath">
+ <pathelement location="${lib.sun-httpserver.local}"/>
+ </path>
+ </target>
+
+ <target name="http-se6.httpserver.classpath.true" depends="http-se6.httpserver.builtin-check" if="http-se6.httpserver.builtin">
+ <path id="httpserver.classpath"/>
+ </target>
+
+ <target name="http-se6.httpserver.classpath" depends="http-se6.httpserver.classpath.false,http-se6.httpserver.classpath.true"/>
+
<target name="http-se6.compile.depcheck">
<mkdir dir="http-se6/target/main"/>
<uptodate property="http-se6.compile.uptodate" targetfile="http-se6/target/main/.lastcompile">
@@ -467,12 +497,9 @@
<exclude name="**/.*"/>
</srcfiles>
</uptodate>
- <condition property="http-se6.supported">
- <available classname="com.sun.net.httpserver.HttpServer"/>
- </condition>
</target>
- <target name="http-se6.compile" depends="http-se6.compile.depcheck" unless="http-se6.compile.uptodate" if="http-se6.supported">
+ <target name="http-se6.compile" depends="http-se6.compile.depcheck,http-se6.httpserver.classpath" unless="http-se6.compile.uptodate">
<mkdir dir="http-se6/target/main/classes"/>
<javac
source="${javac.source}"
@@ -485,6 +512,7 @@
<path refid="api.classpath"/>
<path refid="http.classpath"/>
<path refid="util.classpath"/>
+ <path refid="httpserver.classpath"/>
</classpath>
</javac>
<touch file="http-se6/target/main/.lastcompile" verbose="false"/>
@@ -494,7 +522,7 @@
<delete dir="http-se6/target"/>
</target>
- <target name="http-se6" description="Build the http-se6 module" depends="api,http,util,http-se6.compile">
+ <target name="http-se6" description="Build the http-se6 module" depends="lib.sun-httpserver,api,http,util,http-se6.compile">
<path id="http-se6.classpath">
<pathelement location="http-se6/target/main/classes"/>
</path>
16 years, 7 months
JBoss Remoting SVN: r4030 - remoting2/branches/2.x.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-04-21 19:13:05 -0400 (Mon, 21 Apr 2008)
New Revision: 4030
Modified:
remoting2/branches/2.x/build.xml
Log:
JBREM-920: Uses ${java.runtime.version} instead of ${ant.java.version}.
Modified: remoting2/branches/2.x/build.xml
===================================================================
--- remoting2/branches/2.x/build.xml 2008-04-20 04:52:55 UTC (rev 4029)
+++ remoting2/branches/2.x/build.xml 2008-04-21 23:13:05 UTC (rev 4030)
@@ -1464,16 +1464,16 @@
</junit>
</target>
- <!-- check to see if running jdk1.5 -->
+ <!-- check to see if running jdk1.6/jdk1.5/jdk1.4 -->
<target name="get-jvm">
<condition property="isJDK6">
- <equals arg1="${ant.java.version}" arg2="1.6"/>
+ <contains string="${java.runtime.version}" substring="1.6"/>
</condition>
<condition property="isJDK5">
- <equals arg1="${ant.java.version}" arg2="1.5"/>
+ <contains string="${java.runtime.version}" substring="1.5"/>
</condition>
<condition property="isJDK4">
- <equals arg1="${ant.java.version}" arg2="1.4"/>
+ <contains string="${java.runtime.version}" substring="1.4"/>
</condition>
</target>
16 years, 7 months
JBoss Remoting SVN: r4029 - remoting2/branches/2.x.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-04-20 00:52:55 -0400 (Sun, 20 Apr 2008)
New Revision: 4029
Modified:
remoting2/branches/2.x/build.xml
Log:
JBREM-920: Will run with security manager if jdk is 1.6; otherwise, will run without security manager.
Modified: remoting2/branches/2.x/build.xml
===================================================================
--- remoting2/branches/2.x/build.xml 2008-04-20 04:48:36 UTC (rev 4028)
+++ remoting2/branches/2.x/build.xml 2008-04-20 04:52:55 UTC (rev 4029)
@@ -302,7 +302,7 @@
<!-- The combined library classpath -->
<path id="library.classpath.tomcat">
<!--pathelement location="${compile.dir}"/-->
- <pathelement path="${output.lib.dir}/jboss-remoting.jar"/>
+ <pathelement path="${output.lib.dir}/jboss-remoting.jar"/>
<pathelement location="${etc.dir}"/>
<path refid="third_party.classpath.tomcat"/>
</path>
@@ -349,14 +349,25 @@
<property name="perf.seq.dojboss" value="yes"/>
<!-- set the security manager information for unit tests -->
+ <condition property="java.security.manager.key" value="java.security.manager">
+ <isset property="isJDK6"/>
+ </condition>
+
+ <condition property="java.security.manager.key" value="no.java.security.manager">
+ <or>
+ <isset property="isJDK4"/>
+ <isset property="isJDK5"/>
+ </or>
+ </condition>
+
<property name="java.security.policy" value="${etc.dir}/remoting.security.policy"/>
<property name="java.security.policy.marshal" value="${etc.dir}/remoting.security.policy.marshal"/>
<property name="java.security.policy.strict" value="${etc.dir}/remoting.security.policy.strict"/>
- <property name="java.security.manager" value=""/>
+ <property name="${java.security.manager.key}" value=""/>
<!--<property name="java.security.manager" value="org.jboss.test.security.LoggingSecurityManager"/>-->
<!--<property name="java.security.debug" value="access,failure"/>-->
<property name="java.security.debug" value=""/>
-
+
<!-- Create security policy file -->
<concat destfile="${etc.dir}/remoting.security.policy">
<filelist dir="${etc.dir}"
@@ -370,7 +381,7 @@
files="remoting.security.policy.core,
remoting.security.policy.tests.minimal"/>
</concat>
-
+
<!-- Create security policy file for tests.marshall -->
<concat destfile="${etc.dir}/remoting.security.policy.marshal">
<filelist dir="${etc.dir}"
@@ -1025,7 +1036,7 @@
<classpath>
<path refid="tests.classpath"/>
</classpath>
- <sysproperty key="java.security.manager" value="${java.security.manager}"/>
+ <sysproperty key="${java.security.manager.key}" value="${java.security.manager}"/>
<sysproperty key="java.security.policy" value="${java.security.policy}"/>
<sysproperty key="java.security.debug" value="${java.security.debug}"/>
<sysproperty key="build.home" value="${basedir}"/>
@@ -1079,7 +1090,7 @@
<classpath>
<path refid="tests.classpath"/>
</classpath>
- <sysproperty key="java.security.manager" value="${java.security.manager}"/>
+ <sysproperty key="${java.security.manager.key}" value="${java.security.manager}"/>
<sysproperty key="java.security.policy" value="${java.security.policy}"/>
<sysproperty key="java.security.debug" value="${java.security.debug}"/>
<sysproperty key="build.home" value="${basedir}"/>
@@ -1141,7 +1152,7 @@
<classpath>
<path refid="tests.classpath"/>
</classpath>
- <sysproperty key="java.security.manager" value="${java.security.manager}"/>
+ <sysproperty key="${java.security.manager.key}" value="${java.security.manager}"/>
<sysproperty key="java.security.policy" value="${java.security.policy.strict}"/>
<sysproperty key="java.security.debug" value="${java.security.debug}"/>
<sysproperty key="build.home" value="${basedir}"/>
@@ -1181,7 +1192,7 @@
<classpath>
<path refid="tests.classpath"/>
</classpath>
- <sysproperty key="java.security.manager" value="${java.security.manager}"/>
+ <sysproperty key="${java.security.manager.key}" value="${java.security.manager}"/>
<sysproperty key="java.security.policy" value="${java.security.policy}"/>
<sysproperty key="java.security.debug" value="${java.security.debug}"/>
<sysproperty key="ant.library.dir" value="${ant.library.dir}"/>
@@ -1212,7 +1223,7 @@
<classpath>
<path refid="tests.classpath"/>
</classpath>
- <sysproperty key="java.security.manager" value="${java.security.manager}"/>
+ <sysproperty key="${java.security.manager.key}" value="${java.security.manager}"/>
<sysproperty key="java.security.policy" value="${java.security.policy}"/>
<sysproperty key="java.security.debug" value="${java.security.debug}"/>
<sysproperty key="build.home" value="${basedir}"/>
@@ -1251,7 +1262,7 @@
<classpath>
<path refid="${classpath}"/>
</classpath>
- <sysproperty key="java.security.manager" value="${java.security.manager}"/>
+ <sysproperty key="${java.security.manager.key}" value="${java.security.manager}"/>
<sysproperty key="java.security.policy" value="${java.security.policy}"/>
<sysproperty key="java.security.debug" value="${java.security.debug}"/>
<sysproperty key="build.home" value="${basedir}"/>
@@ -1290,7 +1301,7 @@
<mkdir dir="${output.tests.results}"/>
<mkdir dir="${output.tests.tmp}"/>
<echo>http (strict security) with ${version}: ${metadata}</echo>
- <echo>ant.library.dir: ${ant.library.dir}</echo>
+ <echo>ant.library.dir: ${ant.library.dir}</echo>
<junit
printsummary="true" fork="yes" includeantruntime="true"
tempdir="${output.tests.tmp}" maxmemory="1024m">
@@ -1299,7 +1310,7 @@
<classpath>
<path refid="${classpath}"/>
</classpath>
- <sysproperty key="java.security.manager" value="${java.security.manager}"/>
+ <sysproperty key="${java.security.manager.key}" value="${java.security.manager}"/>
<sysproperty key="java.security.policy" value="${java.security.policy.strict}"/>
<sysproperty key="java.security.debug" value="${java.security.debug}"/>
<sysproperty key="build.home" value="${basedir}"/>
@@ -1338,7 +1349,7 @@
<classpath>
<path refid="${classpath}"/>
</classpath>
- <sysproperty key="java.security.manager" value="${java.security.manager}"/>
+ <sysproperty key="${java.security.manager.key}" value="${java.security.manager}"/>
<sysproperty key="java.security.policy" value="${java.security.policy}"/>
<sysproperty key="java.security.debug" value="${java.security.debug}"/>
<sysproperty key="build.home" value="${basedir}"/>
@@ -1391,7 +1402,7 @@
<classpath>
<path refid="tests.classpath"/>
</classpath>
- <sysproperty key="java.security.manager" value="${java.security.manager}"/>
+ <sysproperty key="${java.security.manager.key}" value="${java.security.manager}"/>
<sysproperty key="java.security.policy" value="${java.security.policy}"/>
<sysproperty key="java.security.debug" value="${java.security.debug}"/>
<sysproperty key="build.home" value="${basedir}"/>
@@ -1424,7 +1435,7 @@
<classpath>
<path refid="tests.classpath"/>
</classpath>
- <sysproperty key="java.security.manager" value="${java.security.manager}"/>
+ <sysproperty key="${java.security.manager.key}" value="${java.security.manager}"/>
<sysproperty key="java.security.policy" value="${java.security.policy}"/>
<sysproperty key="java.security.debug" value="${java.security.debug}"/>
<sysproperty key="build.home" value="${basedir}"/>
@@ -1492,7 +1503,7 @@
<classpath>
<path refid="tests.classpath"/>
</classpath>
- <sysproperty key="java.security.manager" value="${java.security.manager}"/>
+ <sysproperty key="${java.security.manager.key}" value="${java.security.manager}"/>
<sysproperty key="java.security.policy" value="${java.security.policy}"/>
<sysproperty key="java.security.debug" value="${java.security.debug}"/>
<sysproperty key="build.home" value="${basedir}"/>
@@ -1526,7 +1537,7 @@
<path refid="tests.marshall.classpath"/>
<pathelement location="${output.lib.dir}/jboss-remoting-tests.jar"/>
</classpath>
- <sysproperty key="java.security.manager" value="${java.security.manager}"/>
+ <sysproperty key="${java.security.manager.key}" value="${java.security.manager}"/>
<sysproperty key="java.security.policy" value="${java.security.policy.marshal}"/>
<sysproperty key="java.security.debug" value="${java.security.debug}"/>
<sysproperty key="build.home" value="${basedir}"/>
@@ -1616,7 +1627,7 @@
<target name="tests.versioning.all"
description="Runs remoting fuctional tests with different remoting versions for client and server."
depends="jars, tests.jars">
-
+
<!-- ******************************************************************************** -->
<!-- Current <- -> Current -->
<antcall target="tests.versioning.all_transports" inheritrefs="true">
@@ -1992,7 +2003,7 @@
<jvmarg value="-Dclient.path=${client.classpath}"/>
<jvmarg value="-Dserver.path=${server.classpath}"/>
<!--<jvmarg value="-Djboss.remoting.pre_2_0_compatible=${jboss.remoting.pre_2_0_compatible}"/>-->
- <sysproperty key="java.security.manager" value="${java.security.manager}"/>
+ <sysproperty key="${java.security.manager.key}" value="${java.security.manager}"/>
<sysproperty key="java.security.policy" value="${java.security.policy}"/>
<sysproperty key="java.security.debug" value="${java.security.debug}"/>
<sysproperty key="build.home" value="${basedir}"/>
@@ -2030,7 +2041,7 @@
<jvmarg value="-Dserver.pre_2_0_compatible=${server.pre_2_0_compatible}"/>
<jvmarg value="-Dremoting.metadata=check_connection=${check_connection}"/>
<jvmarg value="-Dcheck_content_type=${check_content_type}"/>
- <sysproperty key="java.security.manager" value="${java.security.manager}"/>
+ <sysproperty key="${java.security.manager.key}" value="${java.security.manager}"/>
<sysproperty key="java.security.policy" value="${java.security.policy}"/>
<sysproperty key="java.security.debug" value="${java.security.debug}"/>
<sysproperty key="build.home" value="${basedir}"/>
@@ -2069,7 +2080,7 @@
<jvmarg value="-Dserver.pre_2_0_compatible=${server.pre_2_0_compatible}"/>
<jvmarg value="-Dremoting.metadata=check_connection=${check_connection}"/>
<jvmarg value="-Dcheck_content_type=${check_content_type}"/>
- <sysproperty key="java.security.manager" value="${java.security.manager}"/>
+ <sysproperty key="${java.security.manager.key}" value="${java.security.manager}"/>
<sysproperty key="java.security.policy" value="${java.security.policy}"/>
<sysproperty key="java.security.debug" value="${java.security.debug}"/>
<sysproperty key="build.home" value="${basedir}"/>
@@ -2109,7 +2120,7 @@
<jvmarg value="-Dserver.pre_2_0_compatible=${server.pre_2_0_compatible}"/>
<jvmarg value="-Dremoting.metadata=check_connection=${check_connection}"/>
<jvmarg value="-Dcheck_content_type=${check_content_type}"/>
- <sysproperty key="java.security.manager" value="${java.security.manager}"/>
+ <sysproperty key="${java.security.manager.key}" value="${java.security.manager}"/>
<sysproperty key="java.security.policy" value="${java.security.policy}"/>
<sysproperty key="java.security.debug" value="${java.security.debug}"/>
<sysproperty key="build.home" value="${basedir}"/>
@@ -2150,7 +2161,7 @@
<jvmarg value="-Dserver.pre_2_0_compatible=${server.pre_2_0_compatible}"/>
<jvmarg value="-Dcheck_content_type=${check_content_type}"/>
<sysproperty key="jboss-junit-configuration" value="${jboss-junit-configuration}"/>
- <sysproperty key="java.security.manager" value="${java.security.manager}"/>
+ <sysproperty key="${java.security.manager.key}" value="${java.security.manager}"/>
<sysproperty key="java.security.policy" value="${java.security.policy}"/>
<sysproperty key="java.security.debug" value="${java.security.debug}"/>
<sysproperty key="build.home" value="${basedir}"/>
@@ -2274,7 +2285,7 @@
<jvmarg value="-Dserver.pre_2_0_compatible=${server.pre_2_0_compatible}"/>
<jvmarg value="-Dclient.check_connection=${client.check_connection}"/>
<jvmarg value="-Dserver.check_connection=${server.check_connection}"/>
- <sysproperty key="java.security.manager" value="${java.security.manager}"/>
+ <sysproperty key="${java.security.manager.key}" value="${java.security.manager}"/>
<sysproperty key="java.security.policy" value="${java.security.policy}"/>
<sysproperty key="java.security.debug" value="${java.security.debug}"/>
<sysproperty key="build.home" value="${basedir}"/>
@@ -2306,7 +2317,7 @@
<jvmarg value="-Dclient.path=${client.classpath}"/>
<jvmarg value="-Dserver.path=${server.classpath}"/>
<jvmarg value="-Djboss.remoting.pre_2_0_compatible=${jboss.remoting.pre_2_0_compatible}"/>
- <sysproperty key="java.security.manager" value="${java.security.manager}"/>
+ <sysproperty key="${java.security.manager.key}" value="${java.security.manager}"/>
<sysproperty key="java.security.policy" value="${java.security.policy}"/>
<sysproperty key="java.security.debug" value="${java.security.debug}"/>
<sysproperty key="build.home" value="${basedir}"/>
@@ -2340,7 +2351,7 @@
<jvmarg value="-Dclient.path=${client.classpath}"/>
<jvmarg value="-Dserver.path=${server.classpath}"/>
<jvmarg value="-Djboss.remoting.pre_2_0_compatible=${jboss.remoting.pre_2_0_compatible}"/>
- <sysproperty key="java.security.manager" value="${java.security.manager}"/>
+ <sysproperty key="${java.security.manager.key}" value="${java.security.manager}"/>
<sysproperty key="java.security.policy" value="${java.security.policy}"/>
<sysproperty key="java.security.debug" value="${java.security.debug}"/>
<sysproperty key="build.home" value="${basedir}"/>
16 years, 7 months
JBoss Remoting SVN: r4028 - remoting2/branches/2.x/src/main/org/jboss/remoting/util.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-04-20 00:48:36 -0400 (Sun, 20 Apr 2008)
New Revision: 4028
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/util/SecurityUtility.java
Log:
JBREM-934: Added temporary notification of whether access control will be engaged.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/util/SecurityUtility.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/util/SecurityUtility.java 2008-04-19 04:38:03 UTC (rev 4027)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/util/SecurityUtility.java 2008-04-20 04:48:36 UTC (rev 4028)
@@ -95,7 +95,8 @@
catch (PrivilegedActionException e)
{
e.getCause().printStackTrace();
- }
+ }
+ System.out.println("skipAccessControl: " + skipAccessControl);
}
16 years, 7 months