From jboss-remoting-commits at lists.jboss.org Fri Apr 3 01:36:06 2009 Content-Type: multipart/mixed; boundary="===============2564908850745814532==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4911 - remoting2/branches/2.2/src/tests/org/jboss/test/remoting/connection. Date: Fri, 03 Apr 2009 01:36:06 -0400 Message-ID: --===============2564908850745814532== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-03 01:36:05 -0400 (Fri, 03 Apr 2009) New Revision: 4911 Added: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/connection/Conn= ectionValidatorDisconnectTimeoutTestCase.java Log: JBREM-1112: New unit tests. Added: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/connection/= ConnectionValidatorDisconnectTimeoutTestCase.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/connection/Con= nectionValidatorDisconnectTimeoutTestCase.java (rev= 0) +++ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/connection/Con= nectionValidatorDisconnectTimeoutTestCase.java 2009-04-03 05:36:05 UTC (rev= 4911) @@ -0,0 +1,592 @@ +/* + * 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.connection; + +import java.io.IOException; +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.ClientDisconnectedException; +import org.jboss.remoting.ConnectionListener; +import org.jboss.remoting.ConnectionValidator; +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.InvokerCallbackHandler; +import org.jboss.remoting.transport.Connector; +import org.jboss.remoting.transport.PortUtil; +import org.jboss.remoting.transport.ServerFactory; +import org.jboss.remoting.transport.socket.SocketServerInvoker; + + +/** + * Unit test for JBREM-1112. + * = + * @author Ron Sigal + * @version = + *

+ * Copyright Apr 3, 2009 + *

+ */ +public class ConnectionValidatorDisconnectTimeoutTestCase extends TestCase +{ + private static Logger log =3D Logger.getLogger(ConnectionValidatorDisco= nnectTimeoutTestCase.class); + = + private static boolean firstTime =3D true; + = + protected String host; + protected int port; + protected String locatorURI; + protected InvokerLocator serverLocator; + protected Connector connector; + protected TestInvocationHandler invocationHandler; + protected TestConnectionListener serverConnectionListener; + + = + public void setUp() throws Exception + { + if (firstTime) + { + firstTime =3D false; + Logger.getLogger("org.jboss.remoting").setLevel(XLevel.INFO); + Logger.getLogger("org.jboss.test.remoting").setLevel(Level.INFO); + String pattern =3D "[%d{ABSOLUTE}] [%t] %5p (%F:%L) - %m%n"; + PatternLayout layout =3D new PatternLayout(pattern); + ConsoleAppender consoleAppender =3D new ConsoleAppender(layout); + Logger.getRootLogger().addAppender(consoleAppender); = + } + } + + = + public void tearDown() + { + } + = + = + public void testDefaultUnary() throws Throwable + { + log.info("entering " + getName()); + = + // Start server. + setupServer(); + = + // Create client. + InvokerLocator clientLocator =3D new InvokerLocator(locatorURI); + HashMap clientConfig =3D new HashMap(); + clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); + clientConfig.put(Client.ENABLE_LEASE, "true"); + addExtraClientConfig(clientConfig); + Client client =3D new Client(clientLocator, clientConfig); + client.connect(); + log.info("client is connected"); + = + // Test connections. + assertEquals("abc", client.invoke("abc")); + log.info("connection is good"); + = + // Install ConnectionListener. + TestConnectionListener clientConnectionListener =3D new TestConnecti= onListener("CLIENT"); + client.addConnectionListener(clientConnectionListener); + = + // Wait for broken connection and test. + Thread.sleep(4000); + assertTrue(serverConnectionListener.notified); + assertTrue(serverConnectionListener.throwable instanceof ClientDisco= nnectedException); + assertTrue(clientConnectionListener.notified); + assertTrue(clientConnectionListener.throwable instanceof Exception); + assertEquals("Could not connect to server!", ((Exception)clientConne= ctionListener.throwable).getMessage()); + = + client.removeConnectionListener(clientConnectionListener); + client.disconnect(); + shutdownServer(); + log.info(getName() + " PASSES"); + } + = + = + public void testDefaultFirstBinary() throws Throwable + { + log.info("entering " + getName()); + = + // Start server. + setupServer(); + = + // Create client. + InvokerLocator clientLocator =3D new InvokerLocator(locatorURI); + HashMap clientConfig =3D new HashMap(); + clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); + clientConfig.put(Client.ENABLE_LEASE, "true"); + addExtraClientConfig(clientConfig); + Client client =3D new Client(clientLocator, clientConfig); + client.connect(); + log.info("client is connected"); + = + // Test connections. + assertEquals("abc", client.invoke("abc")); + log.info("connection is good"); + = + // Install ConnectionListener. + TestConnectionListener clientConnectionListener =3D new TestConnecti= onListener("CLIENT"); + client.addConnectionListener(clientConnectionListener, 500); + = + // Wait for broken connection and test. + Thread.sleep(4000); + assertTrue(serverConnectionListener.notified); + assertTrue(serverConnectionListener.throwable instanceof ClientDisco= nnectedException); + assertTrue(clientConnectionListener.notified); + assertTrue(clientConnectionListener.throwable instanceof Exception); + assertEquals("Could not connect to server!", ((Exception)clientConne= ctionListener.throwable).getMessage()); + = + client.removeConnectionListener(clientConnectionListener); + client.disconnect(); + shutdownServer(); + log.info(getName() + " PASSES"); + } + = + = + public void testDefaultSecondBinary() throws Throwable + { + log.info("entering " + getName()); + = + // Start server. + setupServer(); + = + // Create client. + InvokerLocator clientLocator =3D new InvokerLocator(locatorURI); + HashMap clientConfig =3D new HashMap(); + clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); + clientConfig.put(Client.ENABLE_LEASE, "true"); + addExtraClientConfig(clientConfig); + Client client =3D new Client(clientLocator, clientConfig); + client.connect(); + log.info("client is connected"); + = + // Test connections. + assertEquals("abc", client.invoke("abc")); + log.info("connection is good"); + = + // Install ConnectionListener. + TestConnectionListener clientConnectionListener =3D new TestConnecti= onListener("CLIENT"); + client.addConnectionListener(clientConnectionListener, new HashMap()= ); + = + // Wait for broken connection and test. + Thread.sleep(4000); + assertTrue(serverConnectionListener.notified); + assertTrue(serverConnectionListener.throwable instanceof ClientDisco= nnectedException); + assertTrue(clientConnectionListener.notified); + assertTrue(clientConnectionListener.throwable instanceof Exception); + assertEquals("Could not connect to server!", ((Exception)clientConne= ctionListener.throwable).getMessage()); + = + client.removeConnectionListener(clientConnectionListener); + client.disconnect(); + shutdownServer(); + log.info(getName() + " PASSES"); + } + = + = + public void testZeroInvokerLocator() throws Throwable + { + log.info("entering " + getName()); + = + // Start server. + setupServer(); + = + // Create client. + String clientLocatorURI =3D locatorURI; + clientLocatorURI +=3D "/?" + Client.USE_ALL_PARAMS + "=3Dtrue"; + clientLocatorURI +=3D "&" + ConnectionValidator.FAILURE_DISCONNECT_T= IMEOUT + "=3D0"; + InvokerLocator clientLocator =3D new InvokerLocator(clientLocatorURI= ); + HashMap clientConfig =3D new HashMap(); + clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); + clientConfig.put(Client.ENABLE_LEASE, "true"); + addExtraClientConfig(clientConfig); + Client client =3D new Client(clientLocator, clientConfig); + client.connect(); + log.info("client is connected"); + = + // Test connections. + assertEquals("abc", client.invoke("abc")); + log.info("connection is good"); + = + // Install ConnectionListener. + TestConnectionListener clientConnectionListener =3D new TestConnecti= onListener("CLIENT"); + client.addConnectionListener(clientConnectionListener, new HashMap()= ); + = + // Wait for broken connection and test. + Thread.sleep(8000); + assertTrue(serverConnectionListener.notified); + assertNull(serverConnectionListener.throwable); + assertTrue(clientConnectionListener.notified); + assertTrue(clientConnectionListener.throwable instanceof Exception); + assertEquals("Could not connect to server!", ((Exception)clientConne= ctionListener.throwable).getMessage()); + = + client.removeConnectionListener(clientConnectionListener); + client.disconnect(); + shutdownServer(); + log.info(getName() + " PASSES"); + } + = + = + public void testNonZeroInvokerLocator() throws Throwable + { + log.info("entering " + getName()); + = + // Start server. + setupServer(); + = + // Create client. + String clientLocatorURI =3D locatorURI; + clientLocatorURI +=3D "/?" + Client.USE_ALL_PARAMS + "=3Dtrue"; + clientLocatorURI +=3D "&" + ConnectionValidator.FAILURE_DISCONNECT_T= IMEOUT + "=3D10000"; + InvokerLocator clientLocator =3D new InvokerLocator(clientLocatorURI= ); + HashMap clientConfig =3D new HashMap(); + clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); + clientConfig.put(Client.ENABLE_LEASE, "true"); + addExtraClientConfig(clientConfig); + Client client =3D new Client(clientLocator, clientConfig); + client.connect(); + log.info("client is connected"); + = + // Test connections. + assertEquals("abc", client.invoke("abc")); + log.info("connection is good"); + = + // Install ConnectionListener. + TestConnectionListener clientConnectionListener =3D new TestConnecti= onListener("CLIENT"); + client.addConnectionListener(clientConnectionListener, new HashMap()= ); + = + // Wait for broken connection and test. + Thread.sleep(4000); + assertTrue(serverConnectionListener.notified); + assertTrue(serverConnectionListener.throwable instanceof ClientDisco= nnectedException); + assertTrue(clientConnectionListener.notified); + assertTrue(clientConnectionListener.throwable instanceof Exception); + assertEquals("Could not connect to server!", ((Exception)clientConne= ctionListener.throwable).getMessage()); + = + client.disconnect(); + shutdownServer(); + log.info(getName() + " PASSES"); + } + = + = + public void testZeroConfig() throws Throwable + { + log.info("entering " + getName()); + = + // Start server. + setupServer(); + = + // Create client. + InvokerLocator clientLocator =3D new InvokerLocator(locatorURI); + HashMap clientConfig =3D new HashMap(); + clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); + clientConfig.put(Client.ENABLE_LEASE, "true"); + clientConfig.put(ConnectionValidator.FAILURE_DISCONNECT_TIMEOUT, "0"= ); + addExtraClientConfig(clientConfig); + Client client =3D new Client(clientLocator, clientConfig); + client.connect(); + log.info("client is connected"); + = + // Test connections. + assertEquals("abc", client.invoke("abc")); + log.info("connection is good"); + = + // Install ConnectionListener. + TestConnectionListener clientConnectionListener =3D new TestConnecti= onListener("CLIENT"); + client.addConnectionListener(clientConnectionListener, new HashMap()= ); + = + // Wait for broken connection and test. + Thread.sleep(8000); + assertTrue(serverConnectionListener.notified); + assertNull(serverConnectionListener.throwable); + assertTrue(clientConnectionListener.notified); + assertTrue(clientConnectionListener.throwable instanceof Exception); + assertEquals("Could not connect to server!", ((Exception)clientConne= ctionListener.throwable).getMessage()); + = + client.disconnect(); + shutdownServer(); + log.info(getName() + " PASSES"); + } + = + = + public void testNonZeroConfig() throws Throwable + { + log.info("entering " + getName()); + = + // Start server. + setupServer(); + = + // Create client. + InvokerLocator clientLocator =3D new InvokerLocator(locatorURI); + HashMap clientConfig =3D new HashMap(); + clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); + clientConfig.put(Client.ENABLE_LEASE, "true"); + clientConfig.put(ConnectionValidator.FAILURE_DISCONNECT_TIMEOUT, "10= 000"); + addExtraClientConfig(clientConfig); + Client client =3D new Client(clientLocator, clientConfig); + client.connect(); + log.info("client is connected"); + = + // Test connections. + assertEquals("abc", client.invoke("abc")); + log.info("connection is good"); + = + // Install ConnectionListener. + TestConnectionListener clientConnectionListener =3D new TestConnecti= onListener("CLIENT"); + client.addConnectionListener(clientConnectionListener, new HashMap()= ); + = + // Wait for broken connection and test. + Thread.sleep(4000); + assertTrue(serverConnectionListener.notified); + assertTrue(serverConnectionListener.throwable instanceof ClientDisco= nnectedException); + assertTrue(clientConnectionListener.notified); + assertTrue(clientConnectionListener.throwable instanceof Exception); + assertEquals("Could not connect to server!", ((Exception)clientConne= ctionListener.throwable).getMessage()); + = + client.disconnect(); + shutdownServer(); + log.info(getName() + " PASSES"); + } + = + = + public void testZeroMetadata() throws Throwable + { + log.info("entering " + getName()); + = + // Start server. + setupServer(); + = + // Create client. + InvokerLocator clientLocator =3D new InvokerLocator(locatorURI); + HashMap clientConfig =3D new HashMap(); + clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); + clientConfig.put(Client.ENABLE_LEASE, "true"); + addExtraClientConfig(clientConfig); + Client client =3D new Client(clientLocator, clientConfig); + client.connect(); + log.info("client is connected"); + = + // Test connections. + assertEquals("abc", client.invoke("abc")); + log.info("connection is good"); + = + // Install ConnectionListener. + TestConnectionListener clientConnectionListener =3D new TestConnecti= onListener("CLIENT"); + HashMap metadata =3D new HashMap(); + metadata.put(ConnectionValidator.FAILURE_DISCONNECT_TIMEOUT, "0"); + client.addConnectionListener(clientConnectionListener, metadata); + = + // Wait for broken connection and test. + Thread.sleep(8000); + assertTrue(serverConnectionListener.notified); + assertNull(serverConnectionListener.throwable); + assertTrue(clientConnectionListener.notified); + assertTrue(clientConnectionListener.throwable instanceof Exception); + assertEquals("Could not connect to server!", ((Exception)clientConne= ctionListener.throwable).getMessage()); + = + client.disconnect(); + shutdownServer(); + log.info(getName() + " PASSES"); + } + = + = + public void testNonZeroMetadata() throws Throwable + { + log.info("entering " + getName()); + = + // Start server. + setupServer(); + = + // Create client. + InvokerLocator clientLocator =3D new InvokerLocator(locatorURI); + HashMap clientConfig =3D new HashMap(); + clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); + clientConfig.put(Client.ENABLE_LEASE, "true"); + addExtraClientConfig(clientConfig); + Client client =3D new Client(clientLocator, clientConfig); + client.connect(); + log.info("client is connected"); + = + // Test connections. + assertEquals("abc", client.invoke("abc")); + log.info("connection is good"); + = + // Install ConnectionListener. + TestConnectionListener clientConnectionListener =3D new TestConnecti= onListener("CLIENT"); + HashMap metadata =3D new HashMap(); + metadata.put(ConnectionValidator.FAILURE_DISCONNECT_TIMEOUT, "10000"= ); + client.addConnectionListener(clientConnectionListener, metadata); + = + // Wait for broken connection and test. + Thread.sleep(4000); + assertTrue(serverConnectionListener.notified); + assertTrue(serverConnectionListener.throwable instanceof ClientDisco= nnectedException); + assertTrue(clientConnectionListener.notified); + assertTrue(clientConnectionListener.throwable instanceof Exception); + assertEquals("Could not connect to server!", ((Exception)clientConne= ctionListener.throwable).getMessage()); + = + 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 + { + InvokerRegistry.registerInvokerFactories("socket", org.jboss.remotin= g.transport.socket.TransportClientFactory.class, TestServerInvokerFactory.c= lass); + host =3D InetAddress.getLocalHost().getHostAddress(); + port =3D PortUtil.findFreePort(host); + locatorURI =3D getTransport() + "://" + host + ":" + port; + String metadata =3D System.getProperty("remoting.metadata"); + if (metadata !=3D null) + { + locatorURI +=3D "/?" + metadata; + } + serverLocator =3D new InvokerLocator(locatorURI); + log.info("Starting remoting server with locator uri of: " + locatorU= RI); + HashMap config =3D new HashMap(); + config.put(InvokerLocator.FORCE_REMOTE, "true"); + config.put("leasePeriod", "1000"); + addExtraServerConfig(config); + connector =3D new Connector(serverLocator, config); + connector.create(); + invocationHandler =3D new TestInvocationHandler(); + connector.addInvocationHandler("test", invocationHandler); + connector.start(); + serverConnectionListener =3D new TestConnectionListener("SERVER"); + connector.addConnectionListener(serverConnectionListener); + } + = + = + protected void shutdownServer() throws Exception + { + if (connector !=3D null) + connector.stop(); + } + = + = + static class TestServerInvoker extends SocketServerInvoker + { + public TestServerInvoker(InvokerLocator locator, Map configuration) + { + super(locator, configuration); = + } + + public Object invoke(InvocationRequest invocation) throws Throwable + { + Object param =3D invocation.getParameter(); + + // check to see if this is a is alive ping + if ("$PING$".equals(param)) + { + Map metadata =3D invocation.getRequestPayload(); + if (metadata !=3D null) + { + String invokerSessionId =3D (String) metadata.get(INVOKER_S= ESSION_ID); + if (invokerSessionId !=3D null) + { + // Comes from ConnectionValidator configured to tie vali= dation with lease. + log.info(this + " responding FALSE to $PING$ for invoker= sessionId " + invokerSessionId); + return Boolean.FALSE; + } + } + } + + return super.invoke(invocation); + } + } + = + = + public static class TestServerInvokerFactory implements ServerFactory + { + public ServerInvoker createServerInvoker(InvokerLocator locator, Map= config) throws IOException + { + return new TestServerInvoker(locator, config); + } + + public boolean supportsSSL() + { + return false; + } + } + = + = + static class TestInvocationHandler implements ServerInvocationHandler + { + public void addListener(InvokerCallbackHandler callbackHandler) {} + public Object invoke(final InvocationRequest invocation) throws Thro= wable + { + return invocation.getParameter(); + } + public void removeListener(InvokerCallbackHandler callbackHandler) {} + public void setMBeanServer(MBeanServer server) {} + public void setInvoker(ServerInvoker invoker) {} + } + + = + static class TestConnectionListener implements ConnectionListener + { + public boolean notified; + public Throwable throwable; + String name; + = + TestConnectionListener(String name) + { + this.name =3D name; + } + = + public void handleConnectionException(Throwable throwable, Client cl= ient) + { + notified =3D true; + this.throwable =3D throwable; + log.info(this + " NOTIFIED, throwable =3D " + throwable); + } + = + public String toString() + { + return "TestConnectionListener[" + name + "]"; + } + } +} \ No newline at end of file --===============2564908850745814532==-- From jboss-remoting-commits at lists.jboss.org Fri Apr 3 01:40:18 2009 Content-Type: multipart/mixed; boundary="===============2389417662793041100==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4912 - remoting2/branches/2.2/src/main/org/jboss/remoting. Date: Fri, 03 Apr 2009 01:40:18 -0400 Message-ID: --===============2389417662793041100== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-03 01:40:18 -0400 (Fri, 03 Apr 2009) New Revision: 4912 Modified: remoting2/branches/2.2/src/main/org/jboss/remoting/ConnectionValidator.j= ava Log: JBREM-1112: Introduced failureDisconnectTimeout variable. Modified: remoting2/branches/2.2/src/main/org/jboss/remoting/ConnectionVali= dator.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.2/src/main/org/jboss/remoting/ConnectionValidator.= java 2009-04-03 05:36:05 UTC (rev 4911) +++ remoting2/branches/2.2/src/main/org/jboss/remoting/ConnectionValidator.= java 2009-04-03 05:40:18 UTC (rev 4912) @@ -72,12 +72,18 @@ * of active lease on server side. Default value is "true". */ public static final String TIE_TO_LEASE =3D "tieToLease"; + = /** * Key to determine whether to stop ConnectionValidator when PING fails. * Default value is "true". */ public static final String STOP_LEASE_ON_FAILURE =3D "stopLeaseOnFailur= e"; = + /** + * Key to determine value of disconnectTimeout upon connection failure. + */ + public static final String FAILURE_DISCONNECT_TIMEOUT =3D "failureDisco= nnectTimeout"; + = // Static -------------------------------------------------------------= -------------------------- = private static boolean trace =3D log.isTraceEnabled(); @@ -237,6 +243,7 @@ private boolean tieToLease =3D true; private boolean stopLeaseOnFailure =3D true; private int pingTimeout; + private int failureDisconnectTimeout =3D -1; private boolean isValid; private Timer timer; = @@ -409,7 +416,7 @@ = public String toString() { - return "ConnectionValidator[" + clientInvoker + ", pingPeriod=3D" + = pingPeriod + " ms]"; + return "ConnectionValidator[" + Integer.toHexString(System.identityH= ashCode(this)) + ":" + clientInvoker + ", pingPeriod=3D" + pingPeriod + " m= s]"; } = // Package protected --------------------------------------------------= -------------------------- @@ -577,6 +584,28 @@ " to a boolean: must be a String"); } } + = + o =3D config.get(FAILURE_DISCONNECT_TIMEOUT); + if (o !=3D null) + { + if (o instanceof String) + { + try + { + failureDisconnectTimeout =3D Integer.valueOf(((String) o= )).intValue(); + } + catch (Exception e) + { + log.warn(this + " could not convert " + FAILURE_DISCONNE= CT_TIMEOUT + " value" + + " to an int: " + o); + } + } + else + { + log.warn(this + " could not convert " + FAILURE_DISCONNECT_= TIMEOUT + " value" + + " to an int: must be a String"); + } + } } } = @@ -717,6 +746,7 @@ { public void run() { + log.debug(this + " calling " + listener + ".handleConnec= tionException()"); listener.handleConnectionException(t, client); } }.start(); @@ -758,7 +788,7 @@ = if (!isValid) { - log.debug(ConnectionValidator.this + "'s connections is invali= d"); + log.debug(ConnectionValidator.this + "'s connection is invalid= "); = notifyListeners(new Exception("Could not connect to server!")); = @@ -769,7 +799,8 @@ = if (invoker !=3D null) { - invoker.terminateLease(null, client.getDisconnectTimeout= ()); + int disconnectTimeout =3D (failureDisconnectTimeout =3D= =3D -1) ? client.getDisconnectTimeout() : failureDisconnectTimeout; + invoker.terminateLease(null, disconnectTimeout); log.debug(ConnectionValidator.this + " shut down lease p= inger"); } else --===============2389417662793041100==-- From jboss-remoting-commits at lists.jboss.org Fri Apr 3 01:42:41 2009 Content-Type: multipart/mixed; boundary="===============4935962208984281940==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4913 - remoting2/branches/2.2/src/main/org/jboss/remoting. Date: Fri, 03 Apr 2009 01:42:41 -0400 Message-ID: --===============4935962208984281940== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-03 01:42:41 -0400 (Fri, 03 Apr 2009) New Revision: 4913 Modified: remoting2/branches/2.2/src/main/org/jboss/remoting/LeasePinger.java Log: JBREM-1112: Added log.debug() call with disconnectTimeout. Modified: remoting2/branches/2.2/src/main/org/jboss/remoting/LeasePinger.ja= va =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.2/src/main/org/jboss/remoting/LeasePinger.java 200= 9-04-03 05:40:18 UTC (rev 4912) +++ remoting2/branches/2.2/src/main/org/jboss/remoting/LeasePinger.java 200= 9-04-03 05:42:41 UTC (rev 4913) @@ -81,6 +81,7 @@ HashMap metadata =3D null; = // If disconnectTimeout =3D=3D 0, skip network i/o. + log.debug(this + ": disconnectTimeout: " + disconnectTimeout); if (disconnectTimeout !=3D 0) { if (disconnectTimeout > 0) --===============4935962208984281940==-- From jboss-remoting-commits at lists.jboss.org Fri Apr 3 01:44:52 2009 Content-Type: multipart/mixed; boundary="===============6273601732247252396==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4914 - remoting2/branches/2.2/src/main/org/jboss/remoting. Date: Fri, 03 Apr 2009 01:44:52 -0400 Message-ID: --===============6273601732247252396== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-03 01:44:52 -0400 (Fri, 03 Apr 2009) New Revision: 4914 Modified: remoting2/branches/2.2/src/main/org/jboss/remoting/Lease.java Log: JBREM-1112: Added log.debug() when requestPayload is null.. Modified: remoting2/branches/2.2/src/main/org/jboss/remoting/Lease.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.2/src/main/org/jboss/remoting/Lease.java 2009-04-0= 3 05:42:41 UTC (rev 4913) +++ remoting2/branches/2.2/src/main/org/jboss/remoting/Lease.java 2009-04-0= 3 05:44:52 UTC (rev 4914) @@ -219,6 +219,7 @@ } else { + log.debug("requestPayload =3D=3D null, calling ConnectionNotifier= .connectionTerminated()"); notifier.connectionTerminated(locatorURL, clientSessionId, null); } } --===============6273601732247252396==-- From jboss-remoting-commits at lists.jboss.org Fri Apr 3 02:43:57 2009 Content-Type: multipart/mixed; boundary="===============4029023802921128814==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4916 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/connection. Date: Fri, 03 Apr 2009 02:43:56 -0400 Message-ID: --===============4029023802921128814== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-03 02:43:56 -0400 (Fri, 03 Apr 2009) New Revision: 4916 Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/connection/Conn= ectionValidatorDisconnectTimeoutTestCase.java Log: JBREM-1112: New unit tests. Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/connection/= ConnectionValidatorDisconnectTimeoutTestCase.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/connection/Con= nectionValidatorDisconnectTimeoutTestCase.java (rev= 0) +++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/connection/Con= nectionValidatorDisconnectTimeoutTestCase.java 2009-04-03 06:43:56 UTC (rev= 4916) @@ -0,0 +1,592 @@ +/* + * 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.connection; + +import java.io.IOException; +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.ClientDisconnectedException; +import org.jboss.remoting.ConnectionListener; +import org.jboss.remoting.ConnectionValidator; +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.InvokerCallbackHandler; +import org.jboss.remoting.transport.Connector; +import org.jboss.remoting.transport.PortUtil; +import org.jboss.remoting.transport.ServerFactory; +import org.jboss.remoting.transport.socket.SocketServerInvoker; + + +/** + * Unit test for JBREM-1112. + * = + * @author Ron Sigal + * @version = + *

+ * Copyright Apr 3, 2009 + *

+ */ +public class ConnectionValidatorDisconnectTimeoutTestCase extends TestCase +{ + private static Logger log =3D Logger.getLogger(ConnectionValidatorDisco= nnectTimeoutTestCase.class); + = + private static boolean firstTime =3D true; + = + protected String host; + protected int port; + protected String locatorURI; + protected InvokerLocator serverLocator; + protected Connector connector; + protected TestInvocationHandler invocationHandler; + protected TestConnectionListener serverConnectionListener; + + = + public void setUp() throws Exception + { + if (firstTime) + { + firstTime =3D false; + Logger.getLogger("org.jboss.remoting").setLevel(XLevel.INFO); + Logger.getLogger("org.jboss.test.remoting").setLevel(Level.INFO); + String pattern =3D "[%d{ABSOLUTE}] [%t] %5p (%F:%L) - %m%n"; + PatternLayout layout =3D new PatternLayout(pattern); + ConsoleAppender consoleAppender =3D new ConsoleAppender(layout); + Logger.getRootLogger().addAppender(consoleAppender); = + } + } + + = + public void tearDown() + { + } + = + = + public void testDefaultUnary() throws Throwable + { + log.info("entering " + getName()); + = + // Start server. + setupServer(); + = + // Create client. + InvokerLocator clientLocator =3D new InvokerLocator(locatorURI); + HashMap clientConfig =3D new HashMap(); + clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); + clientConfig.put(Client.ENABLE_LEASE, "true"); + addExtraClientConfig(clientConfig); + Client client =3D new Client(clientLocator, clientConfig); + client.connect(); + log.info("client is connected"); + = + // Test connections. + assertEquals("abc", client.invoke("abc")); + log.info("connection is good"); + = + // Install ConnectionListener. + TestConnectionListener clientConnectionListener =3D new TestConnecti= onListener("CLIENT"); + client.addConnectionListener(clientConnectionListener); + = + // Wait for broken connection and test. + Thread.sleep(4000); + assertTrue(serverConnectionListener.notified); + assertTrue(serverConnectionListener.throwable instanceof ClientDisco= nnectedException); + assertTrue(clientConnectionListener.notified); + assertTrue(clientConnectionListener.throwable instanceof Exception); + assertEquals("Could not connect to server!", ((Exception)clientConne= ctionListener.throwable).getMessage()); + = + client.removeConnectionListener(clientConnectionListener); + client.disconnect(); + shutdownServer(); + log.info(getName() + " PASSES"); + } + = + = + public void testDefaultFirstBinary() throws Throwable + { + log.info("entering " + getName()); + = + // Start server. + setupServer(); + = + // Create client. + InvokerLocator clientLocator =3D new InvokerLocator(locatorURI); + HashMap clientConfig =3D new HashMap(); + clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); + clientConfig.put(Client.ENABLE_LEASE, "true"); + addExtraClientConfig(clientConfig); + Client client =3D new Client(clientLocator, clientConfig); + client.connect(); + log.info("client is connected"); + = + // Test connections. + assertEquals("abc", client.invoke("abc")); + log.info("connection is good"); + = + // Install ConnectionListener. + TestConnectionListener clientConnectionListener =3D new TestConnecti= onListener("CLIENT"); + client.addConnectionListener(clientConnectionListener, 500); + = + // Wait for broken connection and test. + Thread.sleep(4000); + assertTrue(serverConnectionListener.notified); + assertTrue(serverConnectionListener.throwable instanceof ClientDisco= nnectedException); + assertTrue(clientConnectionListener.notified); + assertTrue(clientConnectionListener.throwable instanceof Exception); + assertEquals("Could not connect to server!", ((Exception)clientConne= ctionListener.throwable).getMessage()); + = + client.removeConnectionListener(clientConnectionListener); + client.disconnect(); + shutdownServer(); + log.info(getName() + " PASSES"); + } + = + = + public void testDefaultSecondBinary() throws Throwable + { + log.info("entering " + getName()); + = + // Start server. + setupServer(); + = + // Create client. + InvokerLocator clientLocator =3D new InvokerLocator(locatorURI); + HashMap clientConfig =3D new HashMap(); + clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); + clientConfig.put(Client.ENABLE_LEASE, "true"); + addExtraClientConfig(clientConfig); + Client client =3D new Client(clientLocator, clientConfig); + client.connect(); + log.info("client is connected"); + = + // Test connections. + assertEquals("abc", client.invoke("abc")); + log.info("connection is good"); + = + // Install ConnectionListener. + TestConnectionListener clientConnectionListener =3D new TestConnecti= onListener("CLIENT"); + client.addConnectionListener(clientConnectionListener, new HashMap()= ); + = + // Wait for broken connection and test. + Thread.sleep(4000); + assertTrue(serverConnectionListener.notified); + assertTrue(serverConnectionListener.throwable instanceof ClientDisco= nnectedException); + assertTrue(clientConnectionListener.notified); + assertTrue(clientConnectionListener.throwable instanceof Exception); + assertEquals("Could not connect to server!", ((Exception)clientConne= ctionListener.throwable).getMessage()); + = + client.removeConnectionListener(clientConnectionListener); + client.disconnect(); + shutdownServer(); + log.info(getName() + " PASSES"); + } + = + = + public void testZeroInvokerLocator() throws Throwable + { + log.info("entering " + getName()); + = + // Start server. + setupServer(); + = + // Create client. + String clientLocatorURI =3D locatorURI; + clientLocatorURI +=3D "/?" + Client.USE_ALL_PARAMS + "=3Dtrue"; + clientLocatorURI +=3D "&" + ConnectionValidator.FAILURE_DISCONNECT_T= IMEOUT + "=3D0"; + InvokerLocator clientLocator =3D new InvokerLocator(clientLocatorURI= ); + HashMap clientConfig =3D new HashMap(); + clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); + clientConfig.put(Client.ENABLE_LEASE, "true"); + addExtraClientConfig(clientConfig); + Client client =3D new Client(clientLocator, clientConfig); + client.connect(); + log.info("client is connected"); + = + // Test connections. + assertEquals("abc", client.invoke("abc")); + log.info("connection is good"); + = + // Install ConnectionListener. + TestConnectionListener clientConnectionListener =3D new TestConnecti= onListener("CLIENT"); + client.addConnectionListener(clientConnectionListener, new HashMap()= ); + = + // Wait for broken connection and test. + Thread.sleep(8000); + assertTrue(serverConnectionListener.notified); + assertNull(serverConnectionListener.throwable); + assertTrue(clientConnectionListener.notified); + assertTrue(clientConnectionListener.throwable instanceof Exception); + assertEquals("Could not connect to server!", ((Exception)clientConne= ctionListener.throwable).getMessage()); + = + client.removeConnectionListener(clientConnectionListener); + client.disconnect(); + shutdownServer(); + log.info(getName() + " PASSES"); + } + = + = + public void testNonZeroInvokerLocator() throws Throwable + { + log.info("entering " + getName()); + = + // Start server. + setupServer(); + = + // Create client. + String clientLocatorURI =3D locatorURI; + clientLocatorURI +=3D "/?" + Client.USE_ALL_PARAMS + "=3Dtrue"; + clientLocatorURI +=3D "&" + ConnectionValidator.FAILURE_DISCONNECT_T= IMEOUT + "=3D10000"; + InvokerLocator clientLocator =3D new InvokerLocator(clientLocatorURI= ); + HashMap clientConfig =3D new HashMap(); + clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); + clientConfig.put(Client.ENABLE_LEASE, "true"); + addExtraClientConfig(clientConfig); + Client client =3D new Client(clientLocator, clientConfig); + client.connect(); + log.info("client is connected"); + = + // Test connections. + assertEquals("abc", client.invoke("abc")); + log.info("connection is good"); + = + // Install ConnectionListener. + TestConnectionListener clientConnectionListener =3D new TestConnecti= onListener("CLIENT"); + client.addConnectionListener(clientConnectionListener, new HashMap()= ); + = + // Wait for broken connection and test. + Thread.sleep(4000); + assertTrue(serverConnectionListener.notified); + assertTrue(serverConnectionListener.throwable instanceof ClientDisco= nnectedException); + assertTrue(clientConnectionListener.notified); + assertTrue(clientConnectionListener.throwable instanceof Exception); + assertEquals("Could not connect to server!", ((Exception)clientConne= ctionListener.throwable).getMessage()); + = + client.disconnect(); + shutdownServer(); + log.info(getName() + " PASSES"); + } + = + = + public void testZeroConfig() throws Throwable + { + log.info("entering " + getName()); + = + // Start server. + setupServer(); + = + // Create client. + InvokerLocator clientLocator =3D new InvokerLocator(locatorURI); + HashMap clientConfig =3D new HashMap(); + clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); + clientConfig.put(Client.ENABLE_LEASE, "true"); + clientConfig.put(ConnectionValidator.FAILURE_DISCONNECT_TIMEOUT, "0"= ); + addExtraClientConfig(clientConfig); + Client client =3D new Client(clientLocator, clientConfig); + client.connect(); + log.info("client is connected"); + = + // Test connections. + assertEquals("abc", client.invoke("abc")); + log.info("connection is good"); + = + // Install ConnectionListener. + TestConnectionListener clientConnectionListener =3D new TestConnecti= onListener("CLIENT"); + client.addConnectionListener(clientConnectionListener, new HashMap()= ); + = + // Wait for broken connection and test. + Thread.sleep(8000); + assertTrue(serverConnectionListener.notified); + assertNull(serverConnectionListener.throwable); + assertTrue(clientConnectionListener.notified); + assertTrue(clientConnectionListener.throwable instanceof Exception); + assertEquals("Could not connect to server!", ((Exception)clientConne= ctionListener.throwable).getMessage()); + = + client.disconnect(); + shutdownServer(); + log.info(getName() + " PASSES"); + } + = + = + public void testNonZeroConfig() throws Throwable + { + log.info("entering " + getName()); + = + // Start server. + setupServer(); + = + // Create client. + InvokerLocator clientLocator =3D new InvokerLocator(locatorURI); + HashMap clientConfig =3D new HashMap(); + clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); + clientConfig.put(Client.ENABLE_LEASE, "true"); + clientConfig.put(ConnectionValidator.FAILURE_DISCONNECT_TIMEOUT, "10= 000"); + addExtraClientConfig(clientConfig); + Client client =3D new Client(clientLocator, clientConfig); + client.connect(); + log.info("client is connected"); + = + // Test connections. + assertEquals("abc", client.invoke("abc")); + log.info("connection is good"); + = + // Install ConnectionListener. + TestConnectionListener clientConnectionListener =3D new TestConnecti= onListener("CLIENT"); + client.addConnectionListener(clientConnectionListener, new HashMap()= ); + = + // Wait for broken connection and test. + Thread.sleep(4000); + assertTrue(serverConnectionListener.notified); + assertTrue(serverConnectionListener.throwable instanceof ClientDisco= nnectedException); + assertTrue(clientConnectionListener.notified); + assertTrue(clientConnectionListener.throwable instanceof Exception); + assertEquals("Could not connect to server!", ((Exception)clientConne= ctionListener.throwable).getMessage()); + = + client.disconnect(); + shutdownServer(); + log.info(getName() + " PASSES"); + } + = + = + public void testZeroMetadata() throws Throwable + { + log.info("entering " + getName()); + = + // Start server. + setupServer(); + = + // Create client. + InvokerLocator clientLocator =3D new InvokerLocator(locatorURI); + HashMap clientConfig =3D new HashMap(); + clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); + clientConfig.put(Client.ENABLE_LEASE, "true"); + addExtraClientConfig(clientConfig); + Client client =3D new Client(clientLocator, clientConfig); + client.connect(); + log.info("client is connected"); + = + // Test connections. + assertEquals("abc", client.invoke("abc")); + log.info("connection is good"); + = + // Install ConnectionListener. + TestConnectionListener clientConnectionListener =3D new TestConnecti= onListener("CLIENT"); + HashMap metadata =3D new HashMap(); + metadata.put(ConnectionValidator.FAILURE_DISCONNECT_TIMEOUT, "0"); + client.addConnectionListener(clientConnectionListener, metadata); + = + // Wait for broken connection and test. + Thread.sleep(8000); + assertTrue(serverConnectionListener.notified); + assertNull(serverConnectionListener.throwable); + assertTrue(clientConnectionListener.notified); + assertTrue(clientConnectionListener.throwable instanceof Exception); + assertEquals("Could not connect to server!", ((Exception)clientConne= ctionListener.throwable).getMessage()); + = + client.disconnect(); + shutdownServer(); + log.info(getName() + " PASSES"); + } + = + = + public void testNonZeroMetadata() throws Throwable + { + log.info("entering " + getName()); + = + // Start server. + setupServer(); + = + // Create client. + InvokerLocator clientLocator =3D new InvokerLocator(locatorURI); + HashMap clientConfig =3D new HashMap(); + clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); + clientConfig.put(Client.ENABLE_LEASE, "true"); + addExtraClientConfig(clientConfig); + Client client =3D new Client(clientLocator, clientConfig); + client.connect(); + log.info("client is connected"); + = + // Test connections. + assertEquals("abc", client.invoke("abc")); + log.info("connection is good"); + = + // Install ConnectionListener. + TestConnectionListener clientConnectionListener =3D new TestConnecti= onListener("CLIENT"); + HashMap metadata =3D new HashMap(); + metadata.put(ConnectionValidator.FAILURE_DISCONNECT_TIMEOUT, "10000"= ); + client.addConnectionListener(clientConnectionListener, metadata); + = + // Wait for broken connection and test. + Thread.sleep(4000); + assertTrue(serverConnectionListener.notified); + assertTrue(serverConnectionListener.throwable instanceof ClientDisco= nnectedException); + assertTrue(clientConnectionListener.notified); + assertTrue(clientConnectionListener.throwable instanceof Exception); + assertEquals("Could not connect to server!", ((Exception)clientConne= ctionListener.throwable).getMessage()); + = + 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 + { + InvokerRegistry.registerInvokerFactories("socket", org.jboss.remotin= g.transport.socket.TransportClientFactory.class, TestServerInvokerFactory.c= lass); + host =3D InetAddress.getLocalHost().getHostAddress(); + port =3D PortUtil.findFreePort(host); + locatorURI =3D getTransport() + "://" + host + ":" + port; + String metadata =3D System.getProperty("remoting.metadata"); + if (metadata !=3D null) + { + locatorURI +=3D "/?" + metadata; + } + serverLocator =3D new InvokerLocator(locatorURI); + log.info("Starting remoting server with locator uri of: " + locatorU= RI); + HashMap config =3D new HashMap(); + config.put(InvokerLocator.FORCE_REMOTE, "true"); + config.put("leasePeriod", "1000"); + addExtraServerConfig(config); + connector =3D new Connector(serverLocator, config); + connector.create(); + invocationHandler =3D new TestInvocationHandler(); + connector.addInvocationHandler("test", invocationHandler); + connector.start(); + serverConnectionListener =3D new TestConnectionListener("SERVER"); + connector.addConnectionListener(serverConnectionListener); + } + = + = + protected void shutdownServer() throws Exception + { + if (connector !=3D null) + connector.stop(); + } + = + = + static class TestServerInvoker extends SocketServerInvoker + { + public TestServerInvoker(InvokerLocator locator, Map configuration) + { + super(locator, configuration); = + } + + public Object invoke(InvocationRequest invocation) throws Throwable + { + Object param =3D invocation.getParameter(); + + // check to see if this is a is alive ping + if ("$PING$".equals(param)) + { + Map metadata =3D invocation.getRequestPayload(); + if (metadata !=3D null) + { + String invokerSessionId =3D (String) metadata.get(INVOKER_S= ESSION_ID); + if (invokerSessionId !=3D null) + { + // Comes from ConnectionValidator configured to tie vali= dation with lease. + log.info(this + " responding FALSE to $PING$ for invoker= sessionId " + invokerSessionId); + return Boolean.FALSE; + } + } + } + + return super.invoke(invocation); + } + } + = + = + public static class TestServerInvokerFactory implements ServerFactory + { + public ServerInvoker createServerInvoker(InvokerLocator locator, Map= config) throws IOException + { + return new TestServerInvoker(locator, config); + } + + public boolean supportsSSL() + { + return false; + } + } + = + = + static class TestInvocationHandler implements ServerInvocationHandler + { + public void addListener(InvokerCallbackHandler callbackHandler) {} + public Object invoke(final InvocationRequest invocation) throws Thro= wable + { + return invocation.getParameter(); + } + public void removeListener(InvokerCallbackHandler callbackHandler) {} + public void setMBeanServer(MBeanServer server) {} + public void setInvoker(ServerInvoker invoker) {} + } + + = + static class TestConnectionListener implements ConnectionListener + { + public boolean notified; + public Throwable throwable; + String name; + = + TestConnectionListener(String name) + { + this.name =3D name; + } + = + public void handleConnectionException(Throwable throwable, Client cl= ient) + { + notified =3D true; + this.throwable =3D throwable; + log.info(this + " NOTIFIED, throwable =3D " + throwable); + } + = + public String toString() + { + return "TestConnectionListener[" + name + "]"; + } + } +} \ No newline at end of file --===============4029023802921128814==-- From jboss-remoting-commits at lists.jboss.org Fri Apr 3 02:44:47 2009 Content-Type: multipart/mixed; boundary="===============2200418899455219525==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4917 - remoting2/branches/2.x/src/main/org/jboss/remoting. Date: Fri, 03 Apr 2009 02:44:46 -0400 Message-ID: --===============2200418899455219525== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-03 02:44:46 -0400 (Fri, 03 Apr 2009) New Revision: 4917 Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/ConnectionValidator.j= ava Log: JBREM-1112: Introduced failureDisconnectTimeout variable. Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/ConnectionVali= dator.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/ConnectionValidator.= java 2009-04-03 06:43:56 UTC (rev 4916) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/ConnectionValidator.= java 2009-04-03 06:44:46 UTC (rev 4917) @@ -72,12 +72,18 @@ * of active lease on server side. Default value is "true". */ public static final String TIE_TO_LEASE =3D "tieToLease"; + = /** * Key to determine whether to stop ConnectionValidator when PING fails. * Default value is "true". */ public static final String STOP_LEASE_ON_FAILURE =3D "stopLeaseOnFailur= e"; = + /** + * Key to determine value of disconnectTimeout upon connection failure. + */ + public static final String FAILURE_DISCONNECT_TIMEOUT =3D "failureDisco= nnectTimeout"; + = // Static -------------------------------------------------------------= -------------------------- = private static boolean trace =3D log.isTraceEnabled(); @@ -236,6 +242,7 @@ private boolean tieToLease =3D true; private boolean stopLeaseOnFailure =3D true; private int pingTimeout; + private int failureDisconnectTimeout =3D -1; private boolean isValid; private Timer timer; = @@ -408,7 +415,7 @@ = public String toString() { - return "ConnectionValidator[" + clientInvoker + ", pingPeriod=3D" + = pingPeriod + " ms]"; + return "ConnectionValidator[" + Integer.toHexString(System.identityH= ashCode(this)) + ":" + clientInvoker + ", pingPeriod=3D" + pingPeriod + " m= s]"; } = // Package protected --------------------------------------------------= -------------------------- @@ -576,6 +583,28 @@ " to a boolean: must be a String"); } } + = + o =3D config.get(FAILURE_DISCONNECT_TIMEOUT); + if (o !=3D null) + { + if (o instanceof String) + { + try + { + failureDisconnectTimeout =3D Integer.valueOf(((String) o= )).intValue(); + } + catch (Exception e) + { + log.warn(this + " could not convert " + FAILURE_DISCONNE= CT_TIMEOUT + " value" + + " to an int: " + o); + } + } + else + { + log.warn(this + " could not convert " + FAILURE_DISCONNECT_= TIMEOUT + " value" + + " to an int: must be a String"); + } + } } } = @@ -716,6 +745,7 @@ { public void run() { + log.debug(this + " calling " + listener + ".handleConnec= tionException()"); listener.handleConnectionException(t, client); } }.start(); @@ -757,7 +787,7 @@ = if (!isValid) { - log.debug(ConnectionValidator.this + "'s connections is invali= d"); + log.debug(ConnectionValidator.this + "'s connection is invalid= "); = notifyListeners(new Exception("Could not connect to server!")); = @@ -768,7 +798,8 @@ = if (invoker !=3D null) { - invoker.terminateLease(null, client.getDisconnectTimeout= ()); + int disconnectTimeout =3D (failureDisconnectTimeout =3D= =3D -1) ? client.getDisconnectTimeout() : failureDisconnectTimeout; + invoker.terminateLease(null, disconnectTimeout); log.debug(ConnectionValidator.this + " shut down lease p= inger"); } else --===============2200418899455219525==-- From jboss-remoting-commits at lists.jboss.org Fri Apr 3 02:48:12 2009 Content-Type: multipart/mixed; boundary="===============4109775085165167896==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4918 - remoting2/branches/2.x/src/main/org/jboss/remoting. Date: Fri, 03 Apr 2009 02:48:12 -0400 Message-ID: --===============4109775085165167896== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-03 02:48:12 -0400 (Fri, 03 Apr 2009) New Revision: 4918 Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/LeasePinger.java Log: JBREM-1112: Added log.debug() call with disconnectTimeout. Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/LeasePinger.ja= va =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/LeasePinger.java 200= 9-04-03 06:44:46 UTC (rev 4917) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/LeasePinger.java 200= 9-04-03 06:48:12 UTC (rev 4918) @@ -115,6 +115,7 @@ HashMap metadata =3D null; = // If disconnectTimeout =3D=3D 0, skip network i/o. + log.debug(this + ": disconnectTimeout: " + disconnectTimeout); if (disconnectTimeout !=3D 0) { if (disconnectTimeout > 0) --===============4109775085165167896==-- From jboss-remoting-commits at lists.jboss.org Fri Apr 3 02:49:35 2009 Content-Type: multipart/mixed; boundary="===============8862162229790745816==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4919 - remoting2/branches/2.x/src/main/org/jboss/remoting. Date: Fri, 03 Apr 2009 02:49:35 -0400 Message-ID: --===============8862162229790745816== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-03 02:49:35 -0400 (Fri, 03 Apr 2009) New Revision: 4919 Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/Lease.java Log: JBREM-1112: Added log.debug() when requestPayload is null. Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/Lease.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/Lease.java 2009-04-0= 3 06:48:12 UTC (rev 4918) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/Lease.java 2009-04-0= 3 06:49:35 UTC (rev 4919) @@ -219,6 +219,7 @@ } else { + log.debug("requestPayload =3D=3D null, calling ConnectionNotifier= .connectionTerminated()"); notifier.connectionTerminated(locatorURL, clientSessionId, null); } } --===============8862162229790745816==-- From jboss-remoting-commits at lists.jboss.org Fri Apr 3 19:21:49 2009 Content-Type: multipart/mixed; boundary="===============1918862263912813023==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4920 - remoting2/branches. Date: Fri, 03 Apr 2009 19:21:48 -0400 Message-ID: --===============1918862263912813023== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: jbertram(a)redhat.com Date: 2009-04-03 19:21:48 -0400 (Fri, 03 Apr 2009) New Revision: 4920 Added: remoting2/branches/2.2.2-SP11_JBREM-1112/ Log: [JBPAPP-1861] create patch branch Copied: remoting2/branches/2.2.2-SP11_JBREM-1112 (from rev 4919, remoting2/= tags/2.2.2-SP11) --===============1918862263912813023==-- From jboss-remoting-commits at lists.jboss.org Fri Apr 3 19:31:44 2009 Content-Type: multipart/mixed; boundary="===============0117744571263987094==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4921 - in remoting2/branches/2.2.2-SP11_JBREM-1112/src: tests/org/jboss/test/remoting/connection and 1 other directory. Date: Fri, 03 Apr 2009 19:31:44 -0400 Message-ID: --===============0117744571263987094== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: jbertram(a)redhat.com Date: 2009-04-03 19:31:44 -0400 (Fri, 03 Apr 2009) New Revision: 4921 Added: remoting2/branches/2.2.2-SP11_JBREM-1112/src/tests/org/jboss/test/remoti= ng/connection/ConnectionValidatorDisconnectTimeoutTestCase.java Modified: remoting2/branches/2.2.2-SP11_JBREM-1112/src/main/org/jboss/remoting/Con= nectionValidator.java remoting2/branches/2.2.2-SP11_JBREM-1112/src/main/org/jboss/remoting/Lea= se.java remoting2/branches/2.2.2-SP11_JBREM-1112/src/main/org/jboss/remoting/Lea= sePinger.java Log: [JBPAPP-1861] Modified: remoting2/branches/2.2.2-SP11_JBREM-1112/src/main/org/jboss/remot= ing/ConnectionValidator.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.2.2-SP11_JBREM-1112/src/main/org/jboss/remoting/Co= nnectionValidator.java 2009-04-03 23:21:48 UTC (rev 4920) +++ remoting2/branches/2.2.2-SP11_JBREM-1112/src/main/org/jboss/remoting/Co= nnectionValidator.java 2009-04-03 23:31:44 UTC (rev 4921) @@ -69,12 +69,18 @@ * of active lease on server side. Default value is "true". */ public static final String TIE_TO_LEASE =3D "tieToLease"; + = /** * Key to determine whether to stop ConnectionValidator when PING fails. * Default value is "true". */ public static final String STOP_LEASE_ON_FAILURE =3D "stopLeaseOnFailur= e"; = + /** + * Key to determine value of disconnectTimeout upon connection failure. + */ + public static final String FAILURE_DISCONNECT_TIMEOUT =3D "failureDisco= nnectTimeout"; + = // Static -------------------------------------------------------------= -------------------------- = private static boolean trace =3D log.isTraceEnabled(); @@ -234,6 +240,7 @@ private boolean tieToLease =3D true; private boolean stopLeaseOnFailure =3D true; private int pingTimeout; + private int failureDisconnectTimeout =3D -1; private boolean isValid; private Timer timer; = @@ -404,7 +411,7 @@ = public String toString() { - return "ConnectionValidator[" + clientInvoker + ", pingPeriod=3D" + = pingPeriod + " ms]"; + return "ConnectionValidator[" + Integer.toHexString(System.identityH= ashCode(this)) + ":" + clientInvoker + ", pingPeriod=3D" + pingPeriod + " m= s]"; } = // Package protected --------------------------------------------------= -------------------------- @@ -498,6 +505,28 @@ " to a boolean: must be a String"); } } + = + o =3D config.get(FAILURE_DISCONNECT_TIMEOUT); + if (o !=3D null) + { + if (o instanceof String) + { + try + { + failureDisconnectTimeout =3D Integer.valueOf(((String) o= )).intValue(); + } + catch (Exception e) + { + log.warn(this + " could not convert " + FAILURE_DISCONNE= CT_TIMEOUT + " value" + + " to an int: " + o); + } + } + else + { + log.warn(this + " could not convert " + FAILURE_DISCONNECT_= TIMEOUT + " value" + + " to an int: must be a String"); + } + } } } = @@ -638,6 +667,7 @@ { public void run() { + log.debug(this + " calling " + listener + ".handleConnec= tionException()"); listener.handleConnectionException(t, client); } }.start(); @@ -679,7 +709,7 @@ = if (!isValid) { - log.debug(ConnectionValidator.this + "'s connections is invali= d"); + log.debug(ConnectionValidator.this + "'s connection is invalid= "); = notifyListeners(new Exception("Could not connect to server!")); = @@ -690,7 +720,8 @@ = if (invoker !=3D null) { - invoker.terminateLease(null, client.getDisconnectTimeout= ()); + int disconnectTimeout =3D (failureDisconnectTimeout =3D= =3D -1) ? client.getDisconnectTimeout() : failureDisconnectTimeout; + invoker.terminateLease(null, disconnectTimeout); log.debug(ConnectionValidator.this + " shut down lease p= inger"); } else Modified: remoting2/branches/2.2.2-SP11_JBREM-1112/src/main/org/jboss/remot= ing/Lease.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.2.2-SP11_JBREM-1112/src/main/org/jboss/remoting/Le= ase.java 2009-04-03 23:21:48 UTC (rev 4920) +++ remoting2/branches/2.2.2-SP11_JBREM-1112/src/main/org/jboss/remoting/Le= ase.java 2009-04-03 23:31:44 UTC (rev 4921) @@ -219,6 +219,7 @@ } else { + log.debug("requestPayload =3D=3D null, calling ConnectionNotifier= .connectionTerminated()"); notifier.connectionTerminated(locatorURL, clientSessionId, null); } } Modified: remoting2/branches/2.2.2-SP11_JBREM-1112/src/main/org/jboss/remot= ing/LeasePinger.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.2.2-SP11_JBREM-1112/src/main/org/jboss/remoting/Le= asePinger.java 2009-04-03 23:21:48 UTC (rev 4920) +++ remoting2/branches/2.2.2-SP11_JBREM-1112/src/main/org/jboss/remoting/Le= asePinger.java 2009-04-03 23:31:44 UTC (rev 4921) @@ -81,6 +81,7 @@ HashMap metadata =3D null; = // If disconnectTimeout =3D=3D 0, skip network i/o. + log.debug(this + ": disconnectTimeout: " + disconnectTimeout); if (disconnectTimeout !=3D 0) { if (disconnectTimeout > 0) Copied: remoting2/branches/2.2.2-SP11_JBREM-1112/src/tests/org/jboss/test/r= emoting/connection/ConnectionValidatorDisconnectTimeoutTestCase.java (from = rev 4914, remoting2/branches/2.2/src/tests/org/jboss/test/remoting/connecti= on/ConnectionValidatorDisconnectTimeoutTestCase.java) =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.2.2-SP11_JBREM-1112/src/tests/org/jboss/test/remot= ing/connection/ConnectionValidatorDisconnectTimeoutTestCase.java = (rev 0) +++ remoting2/branches/2.2.2-SP11_JBREM-1112/src/tests/org/jboss/test/remot= ing/connection/ConnectionValidatorDisconnectTimeoutTestCase.java 2009-04-03= 23:31:44 UTC (rev 4921) @@ -0,0 +1,592 @@ +/* + * 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.connection; + +import java.io.IOException; +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.ClientDisconnectedException; +import org.jboss.remoting.ConnectionListener; +import org.jboss.remoting.ConnectionValidator; +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.InvokerCallbackHandler; +import org.jboss.remoting.transport.Connector; +import org.jboss.remoting.transport.PortUtil; +import org.jboss.remoting.transport.ServerFactory; +import org.jboss.remoting.transport.socket.SocketServerInvoker; + + +/** + * Unit test for JBREM-1112. + * = + * @author Ron Sigal + * @version = + *

+ * Copyright Apr 3, 2009 + *

+ */ +public class ConnectionValidatorDisconnectTimeoutTestCase extends TestCase +{ + private static Logger log =3D Logger.getLogger(ConnectionValidatorDisco= nnectTimeoutTestCase.class); + = + private static boolean firstTime =3D true; + = + protected String host; + protected int port; + protected String locatorURI; + protected InvokerLocator serverLocator; + protected Connector connector; + protected TestInvocationHandler invocationHandler; + protected TestConnectionListener serverConnectionListener; + + = + public void setUp() throws Exception + { + if (firstTime) + { + firstTime =3D false; + Logger.getLogger("org.jboss.remoting").setLevel(XLevel.INFO); + Logger.getLogger("org.jboss.test.remoting").setLevel(Level.INFO); + String pattern =3D "[%d{ABSOLUTE}] [%t] %5p (%F:%L) - %m%n"; + PatternLayout layout =3D new PatternLayout(pattern); + ConsoleAppender consoleAppender =3D new ConsoleAppender(layout); + Logger.getRootLogger().addAppender(consoleAppender); = + } + } + + = + public void tearDown() + { + } + = + = + public void testDefaultUnary() throws Throwable + { + log.info("entering " + getName()); + = + // Start server. + setupServer(); + = + // Create client. + InvokerLocator clientLocator =3D new InvokerLocator(locatorURI); + HashMap clientConfig =3D new HashMap(); + clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); + clientConfig.put(Client.ENABLE_LEASE, "true"); + addExtraClientConfig(clientConfig); + Client client =3D new Client(clientLocator, clientConfig); + client.connect(); + log.info("client is connected"); + = + // Test connections. + assertEquals("abc", client.invoke("abc")); + log.info("connection is good"); + = + // Install ConnectionListener. + TestConnectionListener clientConnectionListener =3D new TestConnecti= onListener("CLIENT"); + client.addConnectionListener(clientConnectionListener); + = + // Wait for broken connection and test. + Thread.sleep(4000); + assertTrue(serverConnectionListener.notified); + assertTrue(serverConnectionListener.throwable instanceof ClientDisco= nnectedException); + assertTrue(clientConnectionListener.notified); + assertTrue(clientConnectionListener.throwable instanceof Exception); + assertEquals("Could not connect to server!", ((Exception)clientConne= ctionListener.throwable).getMessage()); + = + client.removeConnectionListener(clientConnectionListener); + client.disconnect(); + shutdownServer(); + log.info(getName() + " PASSES"); + } + = + = + public void testDefaultFirstBinary() throws Throwable + { + log.info("entering " + getName()); + = + // Start server. + setupServer(); + = + // Create client. + InvokerLocator clientLocator =3D new InvokerLocator(locatorURI); + HashMap clientConfig =3D new HashMap(); + clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); + clientConfig.put(Client.ENABLE_LEASE, "true"); + addExtraClientConfig(clientConfig); + Client client =3D new Client(clientLocator, clientConfig); + client.connect(); + log.info("client is connected"); + = + // Test connections. + assertEquals("abc", client.invoke("abc")); + log.info("connection is good"); + = + // Install ConnectionListener. + TestConnectionListener clientConnectionListener =3D new TestConnecti= onListener("CLIENT"); + client.addConnectionListener(clientConnectionListener, 500); + = + // Wait for broken connection and test. + Thread.sleep(4000); + assertTrue(serverConnectionListener.notified); + assertTrue(serverConnectionListener.throwable instanceof ClientDisco= nnectedException); + assertTrue(clientConnectionListener.notified); + assertTrue(clientConnectionListener.throwable instanceof Exception); + assertEquals("Could not connect to server!", ((Exception)clientConne= ctionListener.throwable).getMessage()); + = + client.removeConnectionListener(clientConnectionListener); + client.disconnect(); + shutdownServer(); + log.info(getName() + " PASSES"); + } + = + = + public void testDefaultSecondBinary() throws Throwable + { + log.info("entering " + getName()); + = + // Start server. + setupServer(); + = + // Create client. + InvokerLocator clientLocator =3D new InvokerLocator(locatorURI); + HashMap clientConfig =3D new HashMap(); + clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); + clientConfig.put(Client.ENABLE_LEASE, "true"); + addExtraClientConfig(clientConfig); + Client client =3D new Client(clientLocator, clientConfig); + client.connect(); + log.info("client is connected"); + = + // Test connections. + assertEquals("abc", client.invoke("abc")); + log.info("connection is good"); + = + // Install ConnectionListener. + TestConnectionListener clientConnectionListener =3D new TestConnecti= onListener("CLIENT"); + client.addConnectionListener(clientConnectionListener, new HashMap()= ); + = + // Wait for broken connection and test. + Thread.sleep(4000); + assertTrue(serverConnectionListener.notified); + assertTrue(serverConnectionListener.throwable instanceof ClientDisco= nnectedException); + assertTrue(clientConnectionListener.notified); + assertTrue(clientConnectionListener.throwable instanceof Exception); + assertEquals("Could not connect to server!", ((Exception)clientConne= ctionListener.throwable).getMessage()); + = + client.removeConnectionListener(clientConnectionListener); + client.disconnect(); + shutdownServer(); + log.info(getName() + " PASSES"); + } + = + = + public void testZeroInvokerLocator() throws Throwable + { + log.info("entering " + getName()); + = + // Start server. + setupServer(); + = + // Create client. + String clientLocatorURI =3D locatorURI; + clientLocatorURI +=3D "/?" + Client.USE_ALL_PARAMS + "=3Dtrue"; + clientLocatorURI +=3D "&" + ConnectionValidator.FAILURE_DISCONNECT_T= IMEOUT + "=3D0"; + InvokerLocator clientLocator =3D new InvokerLocator(clientLocatorURI= ); + HashMap clientConfig =3D new HashMap(); + clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); + clientConfig.put(Client.ENABLE_LEASE, "true"); + addExtraClientConfig(clientConfig); + Client client =3D new Client(clientLocator, clientConfig); + client.connect(); + log.info("client is connected"); + = + // Test connections. + assertEquals("abc", client.invoke("abc")); + log.info("connection is good"); + = + // Install ConnectionListener. + TestConnectionListener clientConnectionListener =3D new TestConnecti= onListener("CLIENT"); + client.addConnectionListener(clientConnectionListener, new HashMap()= ); + = + // Wait for broken connection and test. + Thread.sleep(8000); + assertTrue(serverConnectionListener.notified); + assertNull(serverConnectionListener.throwable); + assertTrue(clientConnectionListener.notified); + assertTrue(clientConnectionListener.throwable instanceof Exception); + assertEquals("Could not connect to server!", ((Exception)clientConne= ctionListener.throwable).getMessage()); + = + client.removeConnectionListener(clientConnectionListener); + client.disconnect(); + shutdownServer(); + log.info(getName() + " PASSES"); + } + = + = + public void testNonZeroInvokerLocator() throws Throwable + { + log.info("entering " + getName()); + = + // Start server. + setupServer(); + = + // Create client. + String clientLocatorURI =3D locatorURI; + clientLocatorURI +=3D "/?" + Client.USE_ALL_PARAMS + "=3Dtrue"; + clientLocatorURI +=3D "&" + ConnectionValidator.FAILURE_DISCONNECT_T= IMEOUT + "=3D10000"; + InvokerLocator clientLocator =3D new InvokerLocator(clientLocatorURI= ); + HashMap clientConfig =3D new HashMap(); + clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); + clientConfig.put(Client.ENABLE_LEASE, "true"); + addExtraClientConfig(clientConfig); + Client client =3D new Client(clientLocator, clientConfig); + client.connect(); + log.info("client is connected"); + = + // Test connections. + assertEquals("abc", client.invoke("abc")); + log.info("connection is good"); + = + // Install ConnectionListener. + TestConnectionListener clientConnectionListener =3D new TestConnecti= onListener("CLIENT"); + client.addConnectionListener(clientConnectionListener, new HashMap()= ); + = + // Wait for broken connection and test. + Thread.sleep(4000); + assertTrue(serverConnectionListener.notified); + assertTrue(serverConnectionListener.throwable instanceof ClientDisco= nnectedException); + assertTrue(clientConnectionListener.notified); + assertTrue(clientConnectionListener.throwable instanceof Exception); + assertEquals("Could not connect to server!", ((Exception)clientConne= ctionListener.throwable).getMessage()); + = + client.disconnect(); + shutdownServer(); + log.info(getName() + " PASSES"); + } + = + = + public void testZeroConfig() throws Throwable + { + log.info("entering " + getName()); + = + // Start server. + setupServer(); + = + // Create client. + InvokerLocator clientLocator =3D new InvokerLocator(locatorURI); + HashMap clientConfig =3D new HashMap(); + clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); + clientConfig.put(Client.ENABLE_LEASE, "true"); + clientConfig.put(ConnectionValidator.FAILURE_DISCONNECT_TIMEOUT, "0"= ); + addExtraClientConfig(clientConfig); + Client client =3D new Client(clientLocator, clientConfig); + client.connect(); + log.info("client is connected"); + = + // Test connections. + assertEquals("abc", client.invoke("abc")); + log.info("connection is good"); + = + // Install ConnectionListener. + TestConnectionListener clientConnectionListener =3D new TestConnecti= onListener("CLIENT"); + client.addConnectionListener(clientConnectionListener, new HashMap()= ); + = + // Wait for broken connection and test. + Thread.sleep(8000); + assertTrue(serverConnectionListener.notified); + assertNull(serverConnectionListener.throwable); + assertTrue(clientConnectionListener.notified); + assertTrue(clientConnectionListener.throwable instanceof Exception); + assertEquals("Could not connect to server!", ((Exception)clientConne= ctionListener.throwable).getMessage()); + = + client.disconnect(); + shutdownServer(); + log.info(getName() + " PASSES"); + } + = + = + public void testNonZeroConfig() throws Throwable + { + log.info("entering " + getName()); + = + // Start server. + setupServer(); + = + // Create client. + InvokerLocator clientLocator =3D new InvokerLocator(locatorURI); + HashMap clientConfig =3D new HashMap(); + clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); + clientConfig.put(Client.ENABLE_LEASE, "true"); + clientConfig.put(ConnectionValidator.FAILURE_DISCONNECT_TIMEOUT, "10= 000"); + addExtraClientConfig(clientConfig); + Client client =3D new Client(clientLocator, clientConfig); + client.connect(); + log.info("client is connected"); + = + // Test connections. + assertEquals("abc", client.invoke("abc")); + log.info("connection is good"); + = + // Install ConnectionListener. + TestConnectionListener clientConnectionListener =3D new TestConnecti= onListener("CLIENT"); + client.addConnectionListener(clientConnectionListener, new HashMap()= ); + = + // Wait for broken connection and test. + Thread.sleep(4000); + assertTrue(serverConnectionListener.notified); + assertTrue(serverConnectionListener.throwable instanceof ClientDisco= nnectedException); + assertTrue(clientConnectionListener.notified); + assertTrue(clientConnectionListener.throwable instanceof Exception); + assertEquals("Could not connect to server!", ((Exception)clientConne= ctionListener.throwable).getMessage()); + = + client.disconnect(); + shutdownServer(); + log.info(getName() + " PASSES"); + } + = + = + public void testZeroMetadata() throws Throwable + { + log.info("entering " + getName()); + = + // Start server. + setupServer(); + = + // Create client. + InvokerLocator clientLocator =3D new InvokerLocator(locatorURI); + HashMap clientConfig =3D new HashMap(); + clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); + clientConfig.put(Client.ENABLE_LEASE, "true"); + addExtraClientConfig(clientConfig); + Client client =3D new Client(clientLocator, clientConfig); + client.connect(); + log.info("client is connected"); + = + // Test connections. + assertEquals("abc", client.invoke("abc")); + log.info("connection is good"); + = + // Install ConnectionListener. + TestConnectionListener clientConnectionListener =3D new TestConnecti= onListener("CLIENT"); + HashMap metadata =3D new HashMap(); + metadata.put(ConnectionValidator.FAILURE_DISCONNECT_TIMEOUT, "0"); + client.addConnectionListener(clientConnectionListener, metadata); + = + // Wait for broken connection and test. + Thread.sleep(8000); + assertTrue(serverConnectionListener.notified); + assertNull(serverConnectionListener.throwable); + assertTrue(clientConnectionListener.notified); + assertTrue(clientConnectionListener.throwable instanceof Exception); + assertEquals("Could not connect to server!", ((Exception)clientConne= ctionListener.throwable).getMessage()); + = + client.disconnect(); + shutdownServer(); + log.info(getName() + " PASSES"); + } + = + = + public void testNonZeroMetadata() throws Throwable + { + log.info("entering " + getName()); + = + // Start server. + setupServer(); + = + // Create client. + InvokerLocator clientLocator =3D new InvokerLocator(locatorURI); + HashMap clientConfig =3D new HashMap(); + clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); + clientConfig.put(Client.ENABLE_LEASE, "true"); + addExtraClientConfig(clientConfig); + Client client =3D new Client(clientLocator, clientConfig); + client.connect(); + log.info("client is connected"); + = + // Test connections. + assertEquals("abc", client.invoke("abc")); + log.info("connection is good"); + = + // Install ConnectionListener. + TestConnectionListener clientConnectionListener =3D new TestConnecti= onListener("CLIENT"); + HashMap metadata =3D new HashMap(); + metadata.put(ConnectionValidator.FAILURE_DISCONNECT_TIMEOUT, "10000"= ); + client.addConnectionListener(clientConnectionListener, metadata); + = + // Wait for broken connection and test. + Thread.sleep(4000); + assertTrue(serverConnectionListener.notified); + assertTrue(serverConnectionListener.throwable instanceof ClientDisco= nnectedException); + assertTrue(clientConnectionListener.notified); + assertTrue(clientConnectionListener.throwable instanceof Exception); + assertEquals("Could not connect to server!", ((Exception)clientConne= ctionListener.throwable).getMessage()); + = + 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 + { + InvokerRegistry.registerInvokerFactories("socket", org.jboss.remotin= g.transport.socket.TransportClientFactory.class, TestServerInvokerFactory.c= lass); + host =3D InetAddress.getLocalHost().getHostAddress(); + port =3D PortUtil.findFreePort(host); + locatorURI =3D getTransport() + "://" + host + ":" + port; + String metadata =3D System.getProperty("remoting.metadata"); + if (metadata !=3D null) + { + locatorURI +=3D "/?" + metadata; + } + serverLocator =3D new InvokerLocator(locatorURI); + log.info("Starting remoting server with locator uri of: " + locatorU= RI); + HashMap config =3D new HashMap(); + config.put(InvokerLocator.FORCE_REMOTE, "true"); + config.put("leasePeriod", "1000"); + addExtraServerConfig(config); + connector =3D new Connector(serverLocator, config); + connector.create(); + invocationHandler =3D new TestInvocationHandler(); + connector.addInvocationHandler("test", invocationHandler); + connector.start(); + serverConnectionListener =3D new TestConnectionListener("SERVER"); + connector.addConnectionListener(serverConnectionListener); + } + = + = + protected void shutdownServer() throws Exception + { + if (connector !=3D null) + connector.stop(); + } + = + = + static class TestServerInvoker extends SocketServerInvoker + { + public TestServerInvoker(InvokerLocator locator, Map configuration) + { + super(locator, configuration); = + } + + public Object invoke(InvocationRequest invocation) throws Throwable + { + Object param =3D invocation.getParameter(); + + // check to see if this is a is alive ping + if ("$PING$".equals(param)) + { + Map metadata =3D invocation.getRequestPayload(); + if (metadata !=3D null) + { + String invokerSessionId =3D (String) metadata.get(INVOKER_S= ESSION_ID); + if (invokerSessionId !=3D null) + { + // Comes from ConnectionValidator configured to tie vali= dation with lease. + log.info(this + " responding FALSE to $PING$ for invoker= sessionId " + invokerSessionId); + return Boolean.FALSE; + } + } + } + + return super.invoke(invocation); + } + } + = + = + public static class TestServerInvokerFactory implements ServerFactory + { + public ServerInvoker createServerInvoker(InvokerLocator locator, Map= config) throws IOException + { + return new TestServerInvoker(locator, config); + } + + public boolean supportsSSL() + { + return false; + } + } + = + = + static class TestInvocationHandler implements ServerInvocationHandler + { + public void addListener(InvokerCallbackHandler callbackHandler) {} + public Object invoke(final InvocationRequest invocation) throws Thro= wable + { + return invocation.getParameter(); + } + public void removeListener(InvokerCallbackHandler callbackHandler) {} + public void setMBeanServer(MBeanServer server) {} + public void setInvoker(ServerInvoker invoker) {} + } + + = + static class TestConnectionListener implements ConnectionListener + { + public boolean notified; + public Throwable throwable; + String name; + = + TestConnectionListener(String name) + { + this.name =3D name; + } + = + public void handleConnectionException(Throwable throwable, Client cl= ient) + { + notified =3D true; + this.throwable =3D throwable; + log.info(this + " NOTIFIED, throwable =3D " + throwable); + } + = + public String toString() + { + return "TestConnectionListener[" + name + "]"; + } + } +} \ No newline at end of file --===============0117744571263987094==-- From jboss-remoting-commits at lists.jboss.org Sat Apr 4 00:37:09 2009 Content-Type: multipart/mixed; boundary="===============4707211129098102071==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4922 - remoting2/branches/2.2/src/tests/org/jboss/test/remoting/marshall/config. Date: Sat, 04 Apr 2009 00:37:09 -0400 Message-ID: --===============4707211129098102071== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-04 00:37:08 -0400 (Sat, 04 Apr 2009) New Revision: 4922 Modified: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/marshall/config= /ConfigTestMarshaller.java Log: JBREM-1102: Corrected log message. Modified: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/marshall= /config/ConfigTestMarshaller.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/marshall/confi= g/ConfigTestMarshaller.java 2009-04-03 23:31:44 UTC (rev 4921) +++ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/marshall/confi= g/ConfigTestMarshaller.java 2009-04-04 04:37:08 UTC (rev 4922) @@ -59,7 +59,7 @@ = public static boolean ok(int count) { - log.info("wrote: " + wrote + ", count: " + count); + log.info("wrote: " + wrote + ", cloned: " + cloned); return wrote && cloned =3D=3D count; } = --===============4707211129098102071==-- From jboss-remoting-commits at lists.jboss.org Sat Apr 4 00:40:19 2009 Content-Type: multipart/mixed; boundary="===============2363707260456150170==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4923 - remoting2/branches/2.2/src/main/org/jboss/remoting. Date: Sat, 04 Apr 2009 00:40:18 -0400 Message-ID: --===============2363707260456150170== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-04 00:40:18 -0400 (Sat, 04 Apr 2009) New Revision: 4923 Modified: remoting2/branches/2.2/src/main/org/jboss/remoting/MicroRemoteClientInvo= ker.java Log: JBREM-1102: getMarshaller() and getUnMarshaller() can look in configuration= map as well as InvokerLocator. Modified: remoting2/branches/2.2/src/main/org/jboss/remoting/MicroRemoteCli= entInvoker.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.2/src/main/org/jboss/remoting/MicroRemoteClientInv= oker.java 2009-04-04 04:37:08 UTC (rev 4922) +++ remoting2/branches/2.2/src/main/org/jboss/remoting/MicroRemoteClientInv= oker.java 2009-04-04 04:40:18 UTC (rev 4923) @@ -72,7 +72,7 @@ if (marshaller =3D=3D null) { // try by locator (in case marshaller class name specified) - marshaller =3D MarshalFactory.getMarshaller(getLocator(), getClas= sLoader()); + marshaller =3D MarshalFactory.getMarshaller(getLocator(), getClas= sLoader(), configuration); if (marshaller =3D=3D null) { // need to have a marshaller, so create a default one @@ -103,7 +103,7 @@ } = // try by locator (in case unmarshaller class name specified) - unmarshaller =3D MarshalFactory.getUnMarshaller(getLocator(), get= ClassLoader()); + unmarshaller =3D MarshalFactory.getUnMarshaller(getLocator(), get= ClassLoader(), configuration); if (unmarshaller =3D=3D null) { unmarshaller =3D MarshalFactory.getUnMarshaller(getDataType(),= getSerializationType()); @@ -465,11 +465,12 @@ { if (dataType =3D=3D null) { - dataType =3D getDataType(getLocator()); - if (dataType =3D=3D null) + String localDataType =3D getDataType(getLocator()); + if (localDataType =3D=3D null) { - dataType =3D getDefaultDataType(); + localDataType =3D getDefaultDataType(); } + dataType =3D localDataType; } return dataType; } --===============2363707260456150170==-- From jboss-remoting-commits at lists.jboss.org Sat Apr 4 17:41:14 2009 Content-Type: multipart/mixed; boundary="===============7264739818456998617==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4924 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/connection. Date: Sat, 04 Apr 2009 17:40:11 -0400 Message-ID: --===============7264739818456998617== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-04 17:40:11 -0400 (Sat, 04 Apr 2009) New Revision: 4924 Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/connection/Conn= ectionValidatorTestCase.java Log: JBREM-1082: Subclassed Client returns non-null configuration map. Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/connecti= on/ConnectionValidatorTestCase.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/connection/Con= nectionValidatorTestCase.java 2009-04-04 04:40:18 UTC (rev 4923) +++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/connection/Con= nectionValidatorTestCase.java 2009-04-04 21:40:11 UTC (rev 4924) @@ -2,6 +2,7 @@ = import java.io.IOException; import java.net.MalformedURLException; +import java.util.HashMap; import java.util.Map; = import junit.framework.TestCase; @@ -23,7 +24,7 @@ ConnectionValidator cv =3D new ConnectionValidator(new Client() { public Map getConfiguration() { - return null; + return new HashMap(); } = public ClientInvoker getInvoker() --===============7264739818456998617==-- From jboss-remoting-commits at lists.jboss.org Sat Apr 4 23:55:08 2009 Content-Type: multipart/mixed; boundary="===============2379060303424324274==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4925 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/connection. Date: Sat, 04 Apr 2009 23:55:07 -0400 Message-ID: --===============2379060303424324274== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-04 23:55:07 -0400 (Sat, 04 Apr 2009) New Revision: 4925 Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/connection/Conn= ectionValidatorDisconnectTimeoutTestCase.java Log: JBREM-1112: Fixed InvokerLocator in a couple of places to accommodate metad= ata. Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/connecti= on/ConnectionValidatorDisconnectTimeoutTestCase.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/connection/Con= nectionValidatorDisconnectTimeoutTestCase.java 2009-04-04 21:40:11 UTC (rev= 4924) +++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/connection/Con= nectionValidatorDisconnectTimeoutTestCase.java 2009-04-05 03:55:07 UTC (rev= 4925) @@ -225,8 +225,9 @@ = // Create client. String clientLocatorURI =3D locatorURI; - clientLocatorURI +=3D "/?" + Client.USE_ALL_PARAMS + "=3Dtrue"; + clientLocatorURI +=3D "&" + Client.USE_ALL_PARAMS + "=3Dtrue"; clientLocatorURI +=3D "&" + ConnectionValidator.FAILURE_DISCONNECT_T= IMEOUT + "=3D0"; + log.info("clientLocatorURI: " + clientLocatorURI); InvokerLocator clientLocator =3D new InvokerLocator(clientLocatorURI= ); HashMap clientConfig =3D new HashMap(); clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); @@ -268,8 +269,9 @@ = // Create client. String clientLocatorURI =3D locatorURI; - clientLocatorURI +=3D "/?" + Client.USE_ALL_PARAMS + "=3Dtrue"; + clientLocatorURI +=3D "&" + Client.USE_ALL_PARAMS + "=3Dtrue"; clientLocatorURI +=3D "&" + ConnectionValidator.FAILURE_DISCONNECT_T= IMEOUT + "=3D10000"; + log.info("clientLocatorURI: " + clientLocatorURI); InvokerLocator clientLocator =3D new InvokerLocator(clientLocatorURI= ); HashMap clientConfig =3D new HashMap(); clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); @@ -478,11 +480,11 @@ InvokerRegistry.registerInvokerFactories("socket", org.jboss.remotin= g.transport.socket.TransportClientFactory.class, TestServerInvokerFactory.c= lass); host =3D InetAddress.getLocalHost().getHostAddress(); port =3D PortUtil.findFreePort(host); - locatorURI =3D getTransport() + "://" + host + ":" + port; + locatorURI =3D getTransport() + "://" + host + ":" + port + "/?x=3Dx= "; String metadata =3D System.getProperty("remoting.metadata"); if (metadata !=3D null) { - locatorURI +=3D "/?" + metadata; + locatorURI +=3D "&" + metadata; } serverLocator =3D new InvokerLocator(locatorURI); log.info("Starting remoting server with locator uri of: " + locatorU= RI); --===============2379060303424324274==-- From jboss-remoting-commits at lists.jboss.org Sat Apr 4 23:56:21 2009 Content-Type: multipart/mixed; boundary="===============7960655275764732599==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4926 - remoting2/branches/2.2/src/tests/org/jboss/test/remoting/connection. Date: Sat, 04 Apr 2009 23:56:21 -0400 Message-ID: --===============7960655275764732599== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-04 23:56:21 -0400 (Sat, 04 Apr 2009) New Revision: 4926 Modified: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/connection/Conn= ectionValidatorDisconnectTimeoutTestCase.java Log: JBREM-1112: Fixed InvokerLocator in a couple of places to accommodate metad= ata. Modified: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/connecti= on/ConnectionValidatorDisconnectTimeoutTestCase.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/connection/Con= nectionValidatorDisconnectTimeoutTestCase.java 2009-04-05 03:55:07 UTC (rev= 4925) +++ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/connection/Con= nectionValidatorDisconnectTimeoutTestCase.java 2009-04-05 03:56:21 UTC (rev= 4926) @@ -225,8 +225,9 @@ = // Create client. String clientLocatorURI =3D locatorURI; - clientLocatorURI +=3D "/?" + Client.USE_ALL_PARAMS + "=3Dtrue"; + clientLocatorURI +=3D "&" + Client.USE_ALL_PARAMS + "=3Dtrue"; clientLocatorURI +=3D "&" + ConnectionValidator.FAILURE_DISCONNECT_T= IMEOUT + "=3D0"; + log.info("clientLocatorURI: " + clientLocatorURI); InvokerLocator clientLocator =3D new InvokerLocator(clientLocatorURI= ); HashMap clientConfig =3D new HashMap(); clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); @@ -268,8 +269,9 @@ = // Create client. String clientLocatorURI =3D locatorURI; - clientLocatorURI +=3D "/?" + Client.USE_ALL_PARAMS + "=3Dtrue"; + clientLocatorURI +=3D "&" + Client.USE_ALL_PARAMS + "=3Dtrue"; clientLocatorURI +=3D "&" + ConnectionValidator.FAILURE_DISCONNECT_T= IMEOUT + "=3D10000"; + log.info("clientLocatorURI: " + clientLocatorURI); InvokerLocator clientLocator =3D new InvokerLocator(clientLocatorURI= ); HashMap clientConfig =3D new HashMap(); clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); @@ -478,11 +480,11 @@ InvokerRegistry.registerInvokerFactories("socket", org.jboss.remotin= g.transport.socket.TransportClientFactory.class, TestServerInvokerFactory.c= lass); host =3D InetAddress.getLocalHost().getHostAddress(); port =3D PortUtil.findFreePort(host); - locatorURI =3D getTransport() + "://" + host + ":" + port; + locatorURI =3D getTransport() + "://" + host + ":" + port + "/?x=3Dx= "; String metadata =3D System.getProperty("remoting.metadata"); if (metadata !=3D null) { - locatorURI +=3D "/?" + metadata; + locatorURI +=3D "&" + metadata; } serverLocator =3D new InvokerLocator(locatorURI); log.info("Starting remoting server with locator uri of: " + locatorU= RI); --===============7960655275764732599==-- From jboss-remoting-commits at lists.jboss.org Sun Apr 5 00:14:26 2009 Content-Type: multipart/mixed; boundary="===============8800046161612672417==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4927 - in remoting2/branches: 2.x/src/main/org/jboss/remoting and 1 other directory. Date: Sun, 05 Apr 2009 00:14:26 -0400 Message-ID: --===============8800046161612672417== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-05 00:14:26 -0400 (Sun, 05 Apr 2009) New Revision: 4927 Modified: remoting2/branches/2.2/src/main/org/jboss/remoting/ConnectionValidator.j= ava remoting2/branches/2.x/src/main/org/jboss/remoting/ConnectionValidator.j= ava Log: JBREM-1082: Removed mistakenly added second extraction of "NumberOfCallRetr= ies" value from configuration map. Modified: remoting2/branches/2.2/src/main/org/jboss/remoting/ConnectionVali= dator.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.2/src/main/org/jboss/remoting/ConnectionValidator.= java 2009-04-05 03:56:21 UTC (rev 4926) +++ remoting2/branches/2.2/src/main/org/jboss/remoting/ConnectionValidator.= java 2009-04-05 04:14:26 UTC (rev 4927) @@ -205,12 +205,6 @@ ". Using default value " + DEFAULT_PING_TIMEOUT); } } - o =3D config.get("NumberOfCallRetries"); - if (o !=3D null) - { - localConfig.put("NumberOfCallRetries", o); - } - } = if (localConfig.get(ServerInvoker.TIMEOUT) =3D=3D null) Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/ConnectionVali= dator.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/ConnectionValidator.= java 2009-04-05 03:56:21 UTC (rev 4926) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/ConnectionValidator.= java 2009-04-05 04:14:26 UTC (rev 4927) @@ -205,11 +205,6 @@ ". Using default value " + DEFAULT_PING_TIMEOUT); } } - o =3D config.get("NumberOfCallRetries"); - if (o !=3D null) - { - localConfig.put("NumberOfCallRetries", o); - } } = if (localConfig.get(ServerInvoker.TIMEOUT) =3D=3D null) --===============8800046161612672417==-- From jboss-remoting-commits at lists.jboss.org Sun Apr 5 02:12:49 2009 Content-Type: multipart/mixed; boundary="===============4151294415900344568==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4928 - remoting2/branches/2.x. Date: Sun, 05 Apr 2009 02:12:49 -0400 Message-ID: --===============4151294415900344568== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-05 02:12:48 -0400 (Sun, 05 Apr 2009) New Revision: 4928 Modified: remoting2/branches/2.x/build.xml Log: JBREM-139: Added automated servlet transport tests. Modified: remoting2/branches/2.x/build.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/build.xml 2009-04-05 04:14:26 UTC (rev 4927) +++ remoting2/branches/2.x/build.xml 2009-04-05 06:12:48 UTC (rev 4928) @@ -217,8 +217,9 @@ = - - + + = + = @@ -1612,6 +1613,400 @@ = + + + + + + + + jboss home: ${jboss.home} + + + + + + + = + + + + + + + + + + + = + + + + + + + + + + + + = + + + + + + + + Going to sleep for ${as.startup.time} seconds + + + + + + + + + + + + Going to sleep for ${as.startup.time} seconds + + + = + + + + + + + + + + + = + + + + + + + = + + + + + + + + + + + + + = + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + = + + + + + + + + + + + + + + + + + + + + + + + + + + + + = + + + + + + + + + + + + + + + + + + + = + + + + + + + + + = + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + = + + + + + + + + + + + + + + + + + + + + + + + + + + + + = + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + = + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + = + + + + + + + + + + + + + + + + + + + = --===============4151294415900344568==-- From jboss-remoting-commits at lists.jboss.org Sun Apr 5 02:14:14 2009 Content-Type: multipart/mixed; boundary="===============2575317873774039568==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4929 - remoting2/branches/2.x. Date: Sun, 05 Apr 2009 02:14:14 -0400 Message-ID: --===============2575317873774039568== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-05 02:14:13 -0400 (Sun, 05 Apr 2009) New Revision: 4929 Added: remoting2/branches/2.x/local.properties Log: JBREM-139: Local properties for automated servlet transport tests. Added: remoting2/branches/2.x/local.properties =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/local.properties (rev 0) +++ remoting2/branches/2.x/local.properties 2009-04-05 06:14:13 UTC (rev 49= 29) @@ -0,0 +1,4 @@ +jboss.home=3Dc://cygwin/home/rsigal/workspace.new/jboss-as-parent-trunk/bu= ild/output/jboss-5.0.0.GA +as.startup.time=3D220 +as.shutdown.time=3D10 +shell=3Dc:/cygwin/bin/sh.exe \ No newline at end of file --===============2575317873774039568==-- From jboss-remoting-commits at lists.jboss.org Sun Apr 5 02:18:00 2009 Content-Type: multipart/mixed; boundary="===============2116548253160352739==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4930 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servlet. Date: Sun, 05 Apr 2009 02:18:00 -0400 Message-ID: --===============2116548253160352739== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-05 02:18:00 -0400 (Sun, 05 Apr 2009) New Revision: 4930 Removed: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servl= et/MBeanServerJBossTestClient.java remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servl= et/MBeanServerPlatformTestClient.java Log: JBREM-139: Moved MBeanServer tests to their own directory. Deleted: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport= /servlet/MBeanServerJBossTestClient.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/serv= let/MBeanServerJBossTestClient.java 2009-04-05 06:14:13 UTC (rev 4929) +++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/serv= let/MBeanServerJBossTestClient.java 2009-04-05 06:18:00 UTC (rev 4930) @@ -1,43 +0,0 @@ - -/* -* JBoss, Home of Professional Open Source -* Copyright 2005, JBoss Inc., and individual contributors as indicated -* by the @authors tag. See the copyright.txt in the distribution for a -* full listing of individual contributors. -* -* This is free software; you can redistribute it and/or modify it -* under the terms of the GNU Lesser General Public License as -* published by the Free Software Foundation; either version 2.1 of -* the License, or (at your option) any later version. -* -* This software is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -* Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public -* License along with this software; if not, write to the Free -* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -* 02110-1301 USA, or see the FSF site: http://www.fsf.org. -*/ -package org.jboss.test.remoting.transport.servlet; - -/** - * Used to test JBREM-746. - * = - * @author Ron Sigal - * @version $Revision: 1.1 $ - *

- * Copyright Nov 29, 2007 - *

- */ -public class MBeanServerJBossTestClient extends MBeanServerSelectionTestPa= rent -{ - - protected String getDefaultDomain() - { - return "jboss"; - } - -} - Deleted: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport= /servlet/MBeanServerPlatformTestClient.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/serv= let/MBeanServerPlatformTestClient.java 2009-04-05 06:14:13 UTC (rev 4929) +++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/serv= let/MBeanServerPlatformTestClient.java 2009-04-05 06:18:00 UTC (rev 4930) @@ -1,44 +0,0 @@ - -/* -* JBoss, Home of Professional Open Source -* Copyright 2005, JBoss Inc., and individual contributors as indicated -* by the @authors tag. See the copyright.txt in the distribution for a -* full listing of individual contributors. -* -* This is free software; you can redistribute it and/or modify it -* under the terms of the GNU Lesser General Public License as -* published by the Free Software Foundation; either version 2.1 of -* the License, or (at your option) any later version. -* -* This software is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -* Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public -* License along with this software; if not, write to the Free -* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -* 02110-1301 USA, or see the FSF site: http://www.fsf.org. -*/ -package org.jboss.test.remoting.transport.servlet; - -/** - * = - * Used to test JBREM-746. - * = - * @author Ron Sigal - * @version $Revision: 1.1 $ - *

- * Copyright Nov 29, 2007 - *

- */ -public class MBeanServerPlatformTestClient extends MBeanServerSelectionTes= tParent -{ - - protected String getDefaultDomain() - { - return "platform"; - } - -} - --===============2116548253160352739==-- From jboss-remoting-commits at lists.jboss.org Sun Apr 5 02:18:46 2009 Content-Type: multipart/mixed; boundary="===============0644552531937916899==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4931 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servlet. Date: Sun, 05 Apr 2009 02:18:46 -0400 Message-ID: --===============0644552531937916899== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-05 02:18:46 -0400 (Sun, 05 Apr 2009) New Revision: 4931 Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servl= et/remoting-servlet-service.xml Removed: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servl= et/remoting-servlet-server-invoker-service.xml Log: JBREM-139: Renamed remoting-servlet-server-invoker-service.xml to remoting-= servlet-service.xml. Deleted: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport= /servlet/remoting-servlet-server-invoker-service.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/serv= let/remoting-servlet-server-invoker-service.xml 2009-04-05 06:18:00 UTC (re= v 4930) +++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/serv= let/remoting-servlet-server-invoker-service.xml 2009-04-05 06:18:46 UTC (re= v 4931) @@ -1,22 +0,0 @@ - - - - - - - - servlet://localhost:8080/servlet-invoker/ServerInvokerSer= vlet - - - - - - org.jboss.test.remoting= .transport.web.WebInvocationHandler - - - - - - Copied: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/= servlet/remoting-servlet-service.xml (from rev 4674, remoting2/branches/2.x= /src/tests/org/jboss/test/remoting/transport/servlet/remoting-servlet-serve= r-invoker-service.xml) =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/serv= let/remoting-servlet-service.xml (rev 0) +++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/serv= let/remoting-servlet-service.xml 2009-04-05 06:18:46 UTC (rev 4931) @@ -0,0 +1,22 @@ + + + + + + + + servlet://localhost:8080/servlet-invoker/ServerInvokerSer= vlet + + + + + + org.jboss.test.remoting= .transport.web.WebInvocationHandler + + + + + + Property changes on: remoting2/branches/2.x/src/tests/org/jboss/test/remoti= ng/transport/servlet/remoting-servlet-service.xml ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:mergeinfo + = Name: svn:eol-style + native --===============0644552531937916899==-- From jboss-remoting-commits at lists.jboss.org Sun Apr 5 02:19:24 2009 Content-Type: multipart/mixed; boundary="===============2171129023302279629==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4932 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servlet. Date: Sun, 05 Apr 2009 02:19:23 -0400 Message-ID: --===============2171129023302279629== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-05 02:19:23 -0400 (Sun, 05 Apr 2009) New Revision: 4932 Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servl= et/server.xml Log: JBREM-139: Created a single server.xml for all servlet tests. Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/s= ervlet/server.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/serv= let/server.xml (rev 0) +++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/serv= let/server.xml 2009-04-05 06:19:23 UTC (rev 4932) @@ -0,0 +1,186 @@ + + + + + + + + + + + + + = + + + + + + + + + + + + + + + + + + + + + + + + = + + + + + + + + + = + + + + + + + + + + \ No newline at end of file --===============2171129023302279629==-- From jboss-remoting-commits at lists.jboss.org Sun Apr 5 02:20:10 2009 Content-Type: multipart/mixed; boundary="===============2657582338852258056==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4933 - in remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servlet: callback and 1 other directory. Date: Sun, 05 Apr 2009 02:20:09 -0400 Message-ID: --===============2657582338852258056== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-05 02:20:09 -0400 (Sun, 05 Apr 2009) New Revision: 4933 Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servl= et/callback/ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servl= et/callback/CallbackTestClient.java remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servl= et/callback/TestInvocationHandler.java remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servl= et/callback/remoting-servlet-service.xml Log: JBREM-139: Moved callback tests to their own directory. Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/s= ervlet/callback/CallbackTestClient.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/serv= let/callback/CallbackTestClient.java (rev 0) +++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/serv= let/callback/CallbackTestClient.java 2009-04-05 06:20:09 UTC (rev 4933) @@ -0,0 +1,141 @@ +/* + * JBoss, Home of Professional Open Source. + * Copyright 2008, 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.transport.servlet.callback; + +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.InvokerLocator; +import org.jboss.remoting.callback.Callback; +import org.jboss.remoting.callback.HandleCallbackException; +import org.jboss.remoting.callback.InvokerCallbackHandler; +import org.jboss.remoting.transport.Connector; + + +/** + * Unit test for pull callbacks over servlet transport: JBREM-1079. + * = + * @author Ron Sigal + * @version = + *

+ * Copyright Jan 16, 2009 + *

+ */ +public class CallbackTestClient extends TestCase +{ + private static Logger log =3D Logger.getLogger(CallbackTestClient.class= ); + = + private static boolean firstTime =3D 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 =3D false; + Logger.getLogger("org.jboss.remoting").setLevel(XLevel.INFO); + Logger.getLogger("org.jboss.test.remoting").setLevel(Level.INFO); + String pattern =3D "[%d{ABSOLUTE}] [%t] %5p (%F:%L) - %m%n"; + PatternLayout layout =3D new PatternLayout(pattern); + ConsoleAppender consoleAppender =3D new ConsoleAppender(layout); + Logger.getRootLogger().addAppender(consoleAppender); = + } + } + + = + public void tearDown() + { + } + = + = + public void testMethod() throws Throwable + { + log.info("entering " + getName()); + + // Create client. + locatorURI =3D "servlet://localhost:8080/servlet-invoker/ServerInvok= erServlet"; + locatorURI +=3D "/?createUniqueObjectName=3Dtrue&useAllParams=3Dtrue= &blockingMode=3Dblocking"; + InvokerLocator clientLocator =3D new InvokerLocator(locatorURI); + HashMap clientConfig =3D new HashMap(); + Client client =3D new Client(clientLocator, clientConfig); + client.connect(); + log.info("client is connected"); + = + // Test connection. + log.info("result: " + client.invoke("abc")); + assertEquals(null, client.invoke("abc")); + log.info("connection is good"); + = + // Install client side callback handlers. + TestCallbackHandler callbackHandler1 =3D new TestCallbackHandler(); + TestCallbackHandler callbackHandler2 =3D new TestCallbackHandler(); + HashMap metadata =3D new HashMap(); + client.addListener(callbackHandler1, metadata); + client.addListener(callbackHandler2, metadata); + = + // Request callbacks. + int COUNT =3D 100; + for (int i =3D 0; i < COUNT; i++) + { + client.invoke("callback"); + } + = + log.info("sleeping for 2000 ms"); + Thread.sleep(2000); + log.info("waking up"); + = + // Verify all callbacks arrived. + assertEquals(COUNT, callbackHandler1.counter); + assertEquals(COUNT, callbackHandler1.counter); + = + client.removeListener(callbackHandler1); + client.removeListener(callbackHandler2); + client.disconnect(); + log.info(getName() + " PASSES"); + } + = + = + static class TestCallbackHandler implements InvokerCallbackHandler + { + public int counter; + = + public void handleCallback(Callback callback) throws HandleCallbackE= xception + { + counter++; + } = + } +} \ No newline at end of file Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/s= ervlet/callback/TestInvocationHandler.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/serv= let/callback/TestInvocationHandler.java (rev 0) +++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/serv= let/callback/TestInvocationHandler.java 2009-04-05 06:20:09 UTC (rev 4933) @@ -0,0 +1,75 @@ +/* + * JBoss, Home of Professional Open Source. + * Copyright 2008, 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.transport.servlet.callback; + +import java.util.HashSet; +import java.util.Iterator; + +import javax.management.MBeanServer; + +import org.apache.log4j.Logger; +import org.jboss.remoting.InvocationRequest; +import org.jboss.remoting.ServerInvocationHandler; +import org.jboss.remoting.ServerInvoker; +import org.jboss.remoting.callback.Callback; +import org.jboss.remoting.callback.InvokerCallbackHandler; + +public class TestInvocationHandler implements ServerInvocationHandler +{ + private static Logger log =3D Logger.getLogger(TestInvocationHandler.cl= ass); + private HashSet listeners =3D new HashSet(); + = + public void addListener(InvokerCallbackHandler callbackHandler) + { + listeners.add(callbackHandler); + log.info("added " + callbackHandler); + } + + public Object invoke(InvocationRequest invocation) throws Throwable + { + log.debug("invocation: " + invocation.getParameter()); + Iterator it =3D listeners.iterator(); + Callback callback =3D new Callback("callback"); + while (it.hasNext()) + { + InvokerCallbackHandler handler =3D (InvokerCallbackHandler) it.ne= xt(); + handler.handleCallback(callback); + log.debug("sent callback to " + handler); + } + return null; + } + + public void removeListener(InvokerCallbackHandler callbackHandler) + { = + listeners.remove(callbackHandler); + log.info("removed " + callbackHandler); + } + + public void setInvoker(ServerInvoker invoker) + { + } + + public void setMBeanServer(MBeanServer server) + { + } +} + Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/s= ervlet/callback/remoting-servlet-service.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/serv= let/callback/remoting-servlet-service.xml (rev 0) +++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/serv= let/callback/remoting-servlet-service.xml 2009-04-05 06:20:09 UTC (rev 4933) @@ -0,0 +1,23 @@ + + + + + + + + servlet://localhost:8080/servlet-invoker/ServerInvokerSer= vlet/?createUniqueObjectName=3Dtrue&useAllParams=3Dtrue&blockingMod= e=3Dblocking + + + + + + org.jboss.test.remoting= .transport.servlet.callback.TestInvocationHandler + + + + + + + --===============2657582338852258056==-- From jboss-remoting-commits at lists.jboss.org Sun Apr 5 02:21:03 2009 Content-Type: multipart/mixed; boundary="===============1450002598396088081==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4934 - in remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servlet: marshal and 1 other directory. Date: Sun, 05 Apr 2009 02:21:03 -0400 Message-ID: --===============1450002598396088081== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-05 02:21:03 -0400 (Sun, 05 Apr 2009) New Revision: 4934 Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servl= et/marshal/ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servl= et/marshal/ServletConfigurationMapTestClient.java remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servl= et/marshal/remoting-servlet-service.xml Log: JBREM-139: Moved marshalling tests to their own directory. Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/s= ervlet/marshal/ServletConfigurationMapTestClient.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/serv= let/marshal/ServletConfigurationMapTestClient.java = (rev 0) +++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/serv= let/marshal/ServletConfigurationMapTestClient.java 2009-04-05 06:21:03 UTC = (rev 4934) @@ -0,0 +1,71 @@ +/* + * 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.transport.servlet.marshal; + +import java.util.Map; + +import org.apache.log4j.Logger; +import org.jboss.test.remoting.marshall.config.ConfigurationMapTestParent; + +/** + * Unit tests for JBREM-1102. + * = + * @author Ron Sigal + * @version = + *

+ * Copyright Mar 21, 2009 + *

+ */ +public class ServletConfigurationMapTestClient extends ConfigurationMapTes= tParent +{ + protected static Logger log =3D Logger.getLogger(ServletConfigurationMa= pTestClient.class); + = + public void testDatatypeConfig() throws Throwable + { + log.info("skipping " + getName()); + } + = + protected int configTestMarshallerCount() + { + return 1; + } + = + protected int configTestUnmarshallerCount() + { + return 1; + } + = + protected String getTransport() + { + return "servlet"; + } + = + protected void setupServer(String parameter, Map extraConfig) throws Ex= ception + { + locatorURI =3D "servlet://localhost:8080/servlet-invoker/ServerInvok= erServlet/?" + + "marshaller=3Dorg.jboss.test.remoting.marshall.config.C= onfigTestMarshaller&" + + "unmarshaller=3Dorg.jboss.test.remoting.marshall.config= .ConfigTestUnmarshaller"; + = + log.info("setting InvokerLocator to " + locatorURI); + } +} + Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/s= ervlet/marshal/remoting-servlet-service.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/serv= let/marshal/remoting-servlet-service.xml (rev 0) +++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/serv= let/marshal/remoting-servlet-service.xml 2009-04-05 06:21:03 UTC (rev 4934) @@ -0,0 +1,23 @@ + + + + + + + + servlet://localhost:8080/servlet-invoker/ServerInvokerSer= vlet/?marshaller=3Dorg.jboss.test.remoting.marshall.config.ConfigTestMarsha= ller&unmarshaller=3Dorg.jboss.test.remoting.marshall.config.ConfigTestU= nmarshaller + + + + + + org.jboss.test.remoting= .marshall.config.TestInvocationHandler + + + + + + + --===============1450002598396088081==-- From jboss-remoting-commits at lists.jboss.org Sun Apr 5 02:21:40 2009 Content-Type: multipart/mixed; boundary="===============4741634691471673855==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4935 - in remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servlet: mbeanserver and 1 other directories. Date: Sun, 05 Apr 2009 02:21:40 -0400 Message-ID: --===============4741634691471673855== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-05 02:21:40 -0400 (Sun, 05 Apr 2009) New Revision: 4935 Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servl= et/mbeanserver/ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servl= et/mbeanserver/jboss/ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servl= et/mbeanserver/jboss/MBeanServerJBossTestClient.java Log: JBREM-139: Moved MBeanServer tests to their own directory. Copied: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/= servlet/mbeanserver/jboss/MBeanServerJBossTestClient.java (from rev 4674, r= emoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servlet/M= BeanServerJBossTestClient.java) =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/serv= let/mbeanserver/jboss/MBeanServerJBossTestClient.java = (rev 0) +++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/serv= let/mbeanserver/jboss/MBeanServerJBossTestClient.java 2009-04-05 06:21:40 U= TC (rev 4935) @@ -0,0 +1,45 @@ + +/* +* JBoss, Home of Professional Open Source +* Copyright 2005, JBoss Inc., and individual contributors as indicated +* by the @authors tag. See the copyright.txt in the distribution for a +* full listing of individual contributors. +* +* This is free software; you can redistribute it and/or modify it +* under the terms of the GNU Lesser General Public License as +* published by the Free Software Foundation; either version 2.1 of +* the License, or (at your option) any later version. +* +* This software is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this software; if not, write to the Free +* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA +* 02110-1301 USA, or see the FSF site: http://www.fsf.org. +*/ +package org.jboss.test.remoting.transport.servlet.mbeanserver.jboss; + +import org.jboss.test.remoting.transport.servlet.MBeanServerSelectionTestP= arent; + +/** + * Used to test JBREM-746. + * = + * @author Ron Sigal + * @version $Revision: 1.1 $ + *

+ * Copyright Nov 29, 2007 + *

+ */ +public class MBeanServerJBossTestClient extends MBeanServerSelectionTestPa= rent +{ + + protected String getDefaultDomain() + { + return "jboss"; + } + +} + Property changes on: remoting2/branches/2.x/src/tests/org/jboss/test/remoti= ng/transport/servlet/mbeanserver/jboss/MBeanServerJBossTestClient.java ___________________________________________________________________ Name: svn:mergeinfo + = --===============4741634691471673855==-- From jboss-remoting-commits at lists.jboss.org Sun Apr 5 02:22:01 2009 Content-Type: multipart/mixed; boundary="===============2688041736645014711==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4936 - in remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servlet/mbeanserver/jboss: WEB-INF and 1 other directory. Date: Sun, 05 Apr 2009 02:22:01 -0400 Message-ID: --===============2688041736645014711== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-05 02:22:01 -0400 (Sun, 05 Apr 2009) New Revision: 4936 Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servl= et/mbeanserver/jboss/WEB-INF/ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servl= et/mbeanserver/jboss/WEB-INF/web.xml Log: JBREM-139: Moved MBeanServer tests to their own directory. Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/s= ervlet/mbeanserver/jboss/WEB-INF/web.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/serv= let/mbeanserver/jboss/WEB-INF/web.xml (rev 0) +++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/serv= let/mbeanserver/jboss/WEB-INF/web.xml 2009-04-05 06:22:01 UTC (rev 4936) @@ -0,0 +1,34 @@ + + + + + + + ServerInvokerServlet + The ServerInvokerServlet receives requests via HTTP + protocol from within a web container and passes it onto the + ServletServerInvoker for processing. + + org.jboss.remoting.transport.servlet.web.ServerInvo= kerServlet + + invokerName + jboss.remoting:host=3Dlocalhost,port=3D8080,servi= ce=3Dinvoker,transport=3Dservlet + The servlet server invoker + + + 1 + + + ServerInvokerServlet + /ServerInvokerServlet/* + + + --===============2688041736645014711==-- From jboss-remoting-commits at lists.jboss.org Sun Apr 5 02:22:22 2009 Content-Type: multipart/mixed; boundary="===============1193178492979059307==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4937 - in remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servlet/mbeanserver: platform and 1 other directories. Date: Sun, 05 Apr 2009 02:22:22 -0400 Message-ID: --===============1193178492979059307== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-05 02:22:22 -0400 (Sun, 05 Apr 2009) New Revision: 4937 Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servl= et/mbeanserver/platform/ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servl= et/mbeanserver/platform/WEB-INF/ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servl= et/mbeanserver/platform/WEB-INF/web.xml Log: JBREM-139: Moved MBeanServer tests to their own directory. Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/s= ervlet/mbeanserver/platform/WEB-INF/web.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/serv= let/mbeanserver/platform/WEB-INF/web.xml (rev 0) +++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/serv= let/mbeanserver/platform/WEB-INF/web.xml 2009-04-05 06:22:22 UTC (rev 4937) @@ -0,0 +1,34 @@ + + + + + + + ServerInvokerServlet + The ServerInvokerServlet receives requests via HTTP + protocol from within a web container and passes it onto the + ServletServerInvoker for processing. + + org.jboss.remoting.transport.servlet.web.ServerInvo= kerServlet + + invokerName + jboss.remoting:host=3Dlocalhost,port=3D8080,servi= ce=3Dinvoker,transport=3Dservlet + The servlet server invoker + + + mbeanServer + *platform* + The servlet server invoker + + 1 + + + ServerInvokerServlet + /ServerInvokerServlet/* + + + --===============1193178492979059307==-- From jboss-remoting-commits at lists.jboss.org Sun Apr 5 02:22:48 2009 Content-Type: multipart/mixed; boundary="===============0166403941703637146==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4938 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servlet/mbeanserver/platform. Date: Sun, 05 Apr 2009 02:22:47 -0400 Message-ID: --===============0166403941703637146== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-05 02:22:47 -0400 (Sun, 05 Apr 2009) New Revision: 4938 Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servl= et/mbeanserver/platform/MBeanServerPlatformTestClient.java Log: JBREM-139: Moved MBeanServer tests to their own directory. Copied: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/= servlet/mbeanserver/platform/MBeanServerPlatformTestClient.java (from rev 4= 674, remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/ser= vlet/MBeanServerPlatformTestClient.java) =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/serv= let/mbeanserver/platform/MBeanServerPlatformTestClient.java = (rev 0) +++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/serv= let/mbeanserver/platform/MBeanServerPlatformTestClient.java 2009-04-05 06:2= 2:47 UTC (rev 4938) @@ -0,0 +1,46 @@ + +/* +* JBoss, Home of Professional Open Source +* Copyright 2005, JBoss Inc., and individual contributors as indicated +* by the @authors tag. See the copyright.txt in the distribution for a +* full listing of individual contributors. +* +* This is free software; you can redistribute it and/or modify it +* under the terms of the GNU Lesser General Public License as +* published by the Free Software Foundation; either version 2.1 of +* the License, or (at your option) any later version. +* +* This software is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this software; if not, write to the Free +* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA +* 02110-1301 USA, or see the FSF site: http://www.fsf.org. +*/ +package org.jboss.test.remoting.transport.servlet.mbeanserver.platform; + +import org.jboss.test.remoting.transport.servlet.MBeanServerSelectionTestP= arent; + +/** + * = + * Used to test JBREM-746. + * = + * @author Ron Sigal + * @version $Revision: 1.1 $ + *

+ * Copyright Nov 29, 2007 + *

+ */ +public class MBeanServerPlatformTestClient extends MBeanServerSelectionTes= tParent +{ + + protected String getDefaultDomain() + { + return "platform"; + } + +} + Property changes on: remoting2/branches/2.x/src/tests/org/jboss/test/remoti= ng/transport/servlet/mbeanserver/platform/MBeanServerPlatformTestClient.java ___________________________________________________________________ Name: svn:mergeinfo + = --===============0166403941703637146==-- From jboss-remoting-commits at lists.jboss.org Sun Apr 5 02:23:24 2009 Content-Type: multipart/mixed; boundary="===============2255406599951647556==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4939 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servlet/multihome. Date: Sun, 05 Apr 2009 02:23:24 -0400 Message-ID: --===============2255406599951647556== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-05 02:23:24 -0400 (Sun, 05 Apr 2009) New Revision: 4939 Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servl= et/multihome/remoting-servlet-service.xml Removed: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servl= et/multihome/remoting-servlet-invoker-service.xml Log: JBREM-139: Renamed remoting-servlet-invoker-service.xml to remoting-servlet= -service.xml. Deleted: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport= /servlet/multihome/remoting-servlet-invoker-service.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/serv= let/multihome/remoting-servlet-invoker-service.xml 2009-04-05 06:22:47 UTC = (rev 4938) +++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/serv= let/multihome/remoting-servlet-invoker-service.xml 2009-04-05 06:23:24 UTC = (rev 4939) @@ -1,22 +0,0 @@ - - - - - - - - servlet://multihome/servlet-invoker/ServerInvokerServlet/= ?homes=3D127.0.0.1:8081!192.168.2.2:8082!10.11.14.75:8083 - - - - - - org.jboss.test.remoting= .multihome.TestInvocationHandler - - - - - - Copied: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/= servlet/multihome/remoting-servlet-service.xml (from rev 4674, remoting2/br= anches/2.x/src/tests/org/jboss/test/remoting/transport/servlet/multihome/re= moting-servlet-invoker-service.xml) =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/serv= let/multihome/remoting-servlet-service.xml (rev 0) +++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/serv= let/multihome/remoting-servlet-service.xml 2009-04-05 06:23:24 UTC (rev 493= 9) @@ -0,0 +1,22 @@ + + + + + + + + servlet://multihome/servlet-invoker/ServerInvokerServlet/= ?homes=3Dlocalhost:7071!localhost:7082!localhost:7093 + + + + + + org.jboss.test.remoting= .multihome.TestInvocationHandler + + + + + + Property changes on: remoting2/branches/2.x/src/tests/org/jboss/test/remoti= ng/transport/servlet/multihome/remoting-servlet-service.xml ___________________________________________________________________ Name: svn:mergeinfo + = --===============2255406599951647556==-- From jboss-remoting-commits at lists.jboss.org Sun Apr 5 02:25:47 2009 Content-Type: multipart/mixed; boundary="===============7022293962021410373==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4940 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servlet/multihome. Date: Sun, 05 Apr 2009 02:25:42 -0400 Message-ID: --===============7022293962021410373== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-05 02:25:42 -0400 (Sun, 05 Apr 2009) New Revision: 4940 Removed: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servl= et/multihome/server.xml Log: JBREM-139: Created a single server.xml in .../servlet directory for all ser= vlet tests. Deleted: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport= /servlet/multihome/server.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/serv= let/multihome/server.xml 2009-04-05 06:23:24 UTC (rev 4939) +++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/serv= let/multihome/server.xml 2009-04-05 06:25:42 UTC (rev 4940) @@ -1,199 +0,0 @@ - - - - - - - - - - - - - = - - - - - - - - - - = - - = - - - - - - - - - - - - - - = - - - - - - - - - = - - - - - - - - - - \ No newline at end of file --===============7022293962021410373==-- From jboss-remoting-commits at lists.jboss.org Sun Apr 5 02:26:14 2009 Content-Type: multipart/mixed; boundary="===============1564191229266989377==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4941 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servlet/multihome. Date: Sun, 05 Apr 2009 02:26:14 -0400 Message-ID: --===============1564191229266989377== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-05 02:26:14 -0400 (Sun, 05 Apr 2009) New Revision: 4941 Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servl= et/multihome/ServletMultihomeTestClient.java Log: JBREM-139: Changed InvokerLocator. Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transpor= t/servlet/multihome/ServletMultihomeTestClient.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/serv= let/multihome/ServletMultihomeTestClient.java 2009-04-05 06:25:42 UTC (rev = 4940) +++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/serv= let/multihome/ServletMultihomeTestClient.java 2009-04-05 06:26:14 UTC (rev = 4941) @@ -45,7 +45,7 @@ protected void setupServer() throws Exception { locatorURI =3D getTransport() + "://" + InvokerLocator.MULTIHOME + g= etPath() + "/?"; - locatorURI +=3D InvokerLocator.CONNECT_HOMES_KEY + "=3D127.0.0.1:808= 1!192.168.2.2:8082!10.11.14.75:8083"; + locatorURI +=3D InvokerLocator.CONNECT_HOMES_KEY + "=3Dlocalhost:707= 1!localhost:7082!localhost:7093"; serverLocator =3D new InvokerLocator(locatorURI); log.info("server locator: " + locatorURI); } --===============1564191229266989377==-- From jboss-remoting-commits at lists.jboss.org Sun Apr 5 02:26:50 2009 Content-Type: multipart/mixed; boundary="===============4201999980603461797==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4942 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servlet/nopreservelines. Date: Sun, 05 Apr 2009 02:26:50 -0400 Message-ID: --===============4201999980603461797== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-05 02:26:50 -0400 (Sun, 05 Apr 2009) New Revision: 4942 Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servl= et/nopreservelines/remoting-servlet-service.xml Removed: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servl= et/nopreservelines/remoting-servlet-invoker-service.xml Log: JBREM-139: Renamed remoting-servlet-invoker-service.xml to remoting-servlet= -service.xml. Deleted: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport= /servlet/nopreservelines/remoting-servlet-invoker-service.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/serv= let/nopreservelines/remoting-servlet-invoker-service.xml 2009-04-05 06:26:1= 4 UTC (rev 4941) +++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/serv= let/nopreservelines/remoting-servlet-invoker-service.xml 2009-04-05 06:26:5= 0 UTC (rev 4942) @@ -1,22 +0,0 @@ - - - - - - - - - localhost - 8080 - false - servlet-invoker/ServerInvokerServl= et - - - org.jboss.test.remoting.transpo= rt.servlet.lines.TestInvocationHandler - - - - - Copied: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/= servlet/nopreservelines/remoting-servlet-service.xml (from rev 4674, remoti= ng2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servlet/nopres= ervelines/remoting-servlet-invoker-service.xml) =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/serv= let/nopreservelines/remoting-servlet-service.xml (r= ev 0) +++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/serv= let/nopreservelines/remoting-servlet-service.xml 2009-04-05 06:26:50 UTC (r= ev 4942) @@ -0,0 +1,22 @@ + + + + + + + + + localhost + 8080 + false + servlet-invoker/ServerInvokerServl= et + + + org.jboss.test.remoting.transpo= rt.servlet.nopreservelines.TestInvocationHandler + + + + + Property changes on: remoting2/branches/2.x/src/tests/org/jboss/test/remoti= ng/transport/servlet/nopreservelines/remoting-servlet-service.xml ___________________________________________________________________ Name: svn:mergeinfo + = --===============4201999980603461797==-- From jboss-remoting-commits at lists.jboss.org Sun Apr 5 02:27:42 2009 Content-Type: multipart/mixed; boundary="===============2987059870678292411==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4943 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servlet/nopreservelines/WEB-INF. Date: Sun, 05 Apr 2009 02:27:41 -0400 Message-ID: --===============2987059870678292411== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-05 02:27:41 -0400 (Sun, 05 Apr 2009) New Revision: 4943 Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servl= et/nopreservelines/WEB-INF/web.xml Log: JBREM-139: Replaced locatorUrl with invokerName. Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transpor= t/servlet/nopreservelines/WEB-INF/web.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/serv= let/nopreservelines/WEB-INF/web.xml 2009-04-05 06:26:50 UTC (rev 4942) +++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/serv= let/nopreservelines/WEB-INF/web.xml 2009-04-05 06:27:41 UTC (rev 4943) @@ -15,10 +15,8 @@ org.jboss.remoting.transport.servlet.web.ServerInvo= kerServlet - locatorUrl - - servlet://localhost:8080/servlet-invoker/ServerInvokerServl= et - + invokerName + jboss.remoting:host=3Dlocalhost,port=3D8080,servi= ce=3Dinvoker,transport=3Dservlet The servlet server invoker 1 --===============2987059870678292411==-- From jboss-remoting-commits at lists.jboss.org Sun Apr 5 02:27:56 2009 Content-Type: multipart/mixed; boundary="===============7171835066726263955==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4944 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servlet/preservelines. Date: Sun, 05 Apr 2009 02:27:55 -0400 Message-ID: --===============7171835066726263955== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-05 02:27:55 -0400 (Sun, 05 Apr 2009) New Revision: 4944 Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servl= et/preservelines/remoting-servlet-service.xml Removed: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servl= et/preservelines/remoting-servlet-invoker-service.xml Log: JBREM-139: Renamed remoting-servlet-invoker-service.xml to remoting-servlet= -service.xml. Deleted: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport= /servlet/preservelines/remoting-servlet-invoker-service.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/serv= let/preservelines/remoting-servlet-invoker-service.xml 2009-04-05 06:27:41 = UTC (rev 4943) +++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/serv= let/preservelines/remoting-servlet-invoker-service.xml 2009-04-05 06:27:55 = UTC (rev 4944) @@ -1,22 +0,0 @@ - - - - - - - - - localhost - 8080 - true - servlet-invoker/ServerInvokerServl= et - - - org.jboss.test.remoting.transpo= rt.servlet.lines.TestInvocationHandler - - - - - Copied: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/= servlet/preservelines/remoting-servlet-service.xml (from rev 4674, remoting= 2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servlet/preserve= lines/remoting-servlet-invoker-service.xml) =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/serv= let/preservelines/remoting-servlet-service.xml (rev= 0) +++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/serv= let/preservelines/remoting-servlet-service.xml 2009-04-05 06:27:55 UTC (rev= 4944) @@ -0,0 +1,22 @@ + + + + + + + + + localhost + 8080 + true + servlet-invoker/ServerInvokerServl= et + + + org.jboss.test.remoting.transpo= rt.servlet.preservelines.TestInvocationHandler + + + + + Property changes on: remoting2/branches/2.x/src/tests/org/jboss/test/remoti= ng/transport/servlet/preservelines/remoting-servlet-service.xml ___________________________________________________________________ Name: svn:mergeinfo + = --===============7171835066726263955==-- From jboss-remoting-commits at lists.jboss.org Sun Apr 5 02:28:13 2009 Content-Type: multipart/mixed; boundary="===============1079806724494648947==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4945 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servlet/preservelines/WEB-INF. Date: Sun, 05 Apr 2009 02:28:12 -0400 Message-ID: --===============1079806724494648947== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-05 02:28:12 -0400 (Sun, 05 Apr 2009) New Revision: 4945 Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servl= et/preservelines/WEB-INF/web.xml Log: JBREM-139: Replaced locatorUrl with invokerName. Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transpor= t/servlet/preservelines/WEB-INF/web.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/serv= let/preservelines/WEB-INF/web.xml 2009-04-05 06:27:55 UTC (rev 4944) +++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/serv= let/preservelines/WEB-INF/web.xml 2009-04-05 06:28:12 UTC (rev 4945) @@ -15,10 +15,8 @@ org.jboss.remoting.transport.servlet.web.ServerInvo= kerServlet - locatorUrl - - servlet://localhost:8080/servlet-invoker/ServerInvokerServl= et - + invokerName + jboss.remoting:host=3Dlocalhost,port=3D8080,servi= ce=3Dinvoker,transport=3Dservlet The servlet server invoker 1 --===============1079806724494648947==-- From jboss-remoting-commits at lists.jboss.org Sun Apr 5 02:29:13 2009 Content-Type: multipart/mixed; boundary="===============5967292920107729938==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4946 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servlet/ssl. Date: Sun, 05 Apr 2009 02:29:13 -0400 Message-ID: --===============5967292920107729938== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-05 02:29:12 -0400 (Sun, 05 Apr 2009) New Revision: 4946 Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servl= et/ssl/keystore remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servl= et/ssl/truststore Removed: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servl= et/ssl/.keystore remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servl= et/ssl/.truststore remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servl= et/ssl/truststore Log: JBREM-139: Rename .keystore and .truststore to keystore and truststore. Deleted: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport= /servlet/ssl/.keystore =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D (Binary files differ) Deleted: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport= /servlet/ssl/.truststore =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D (Binary files differ) Copied: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/= servlet/ssl/keystore (from rev 4674, remoting2/branches/2.x/src/tests/org/j= boss/test/remoting/transport/servlet/ssl/.keystore) =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D (Binary files differ) Property changes on: remoting2/branches/2.x/src/tests/org/jboss/test/remoti= ng/transport/servlet/ssl/keystore ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Name: svn:mergeinfo + = Deleted: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport= /servlet/ssl/truststore =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D (Binary files differ) Copied: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/= servlet/ssl/truststore (from rev 4674, remoting2/branches/2.x/src/tests/org= /jboss/test/remoting/transport/servlet/ssl/.truststore) =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D (Binary files differ) Property changes on: remoting2/branches/2.x/src/tests/org/jboss/test/remoti= ng/transport/servlet/ssl/truststore ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Name: svn:mergeinfo + = --===============5967292920107729938==-- From jboss-remoting-commits at lists.jboss.org Sun Apr 5 02:29:31 2009 Content-Type: multipart/mixed; boundary="===============9172739413785248037==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4947 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servlet/ssl. Date: Sun, 05 Apr 2009 02:29:31 -0400 Message-ID: --===============9172739413785248037== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-05 02:29:30 -0400 (Sun, 05 Apr 2009) New Revision: 4947 Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servl= et/ssl/remoting-servlet-service.xml Removed: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servl= et/ssl/remoting-servlet-invoker-service.xml Log: JBREM-139: Renamed remoting-servlet-invoker-service.xml to remoting-servlet= -service.xml. Deleted: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport= /servlet/ssl/remoting-servlet-invoker-service.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/serv= let/ssl/remoting-servlet-invoker-service.xml 2009-04-05 06:29:12 UTC (rev 4= 946) +++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/serv= let/ssl/remoting-servlet-invoker-service.xml 2009-04-05 06:29:30 UTC (rev 4= 947) @@ -1,23 +0,0 @@ - - - - - - - - sslservlet://localhost:8443/servlet-invoker/ServerInvoker= Servlet - - - - - - org.jboss.test.remoting= .transport.web.WebInvocationHandler - - - - - - - Copied: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/= servlet/ssl/remoting-servlet-service.xml (from rev 4674, remoting2/branches= /2.x/src/tests/org/jboss/test/remoting/transport/servlet/ssl/remoting-servl= et-invoker-service.xml) =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/serv= let/ssl/remoting-servlet-service.xml (rev 0) +++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/serv= let/ssl/remoting-servlet-service.xml 2009-04-05 06:29:30 UTC (rev 4947) @@ -0,0 +1,23 @@ + + + + + + + + sslservlet://localhost:8443/servlet-invoker/ServerInvoker= Servlet + + + + + + org.jboss.test.remoting= .transport.web.WebInvocationHandler + + + + + + + Property changes on: remoting2/branches/2.x/src/tests/org/jboss/test/remoti= ng/transport/servlet/ssl/remoting-servlet-service.xml ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:mergeinfo + = Name: svn:eol-style + native --===============9172739413785248037==-- From jboss-remoting-commits at lists.jboss.org Sun Apr 5 02:31:18 2009 Content-Type: multipart/mixed; boundary="===============5142741916157592080==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4948 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servlet/ssl. Date: Sun, 05 Apr 2009 02:31:17 -0400 Message-ID: --===============5142741916157592080== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-05 02:31:17 -0400 (Sun, 05 Apr 2009) New Revision: 4948 Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servl= et/ssl/SSLServletClientAddressTestClient.java remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servl= et/ssl/SSLServletInvokerTestClient.java Log: JBREM-139: Renamed .keystore and .truststore to keystore and truststore. Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transpor= t/servlet/ssl/SSLServletClientAddressTestClient.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/serv= let/ssl/SSLServletClientAddressTestClient.java 2009-04-05 06:29:30 UTC (rev= 4947) +++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/serv= let/ssl/SSLServletClientAddressTestClient.java 2009-04-05 06:31:17 UTC (rev= 4948) @@ -21,7 +21,7 @@ protected void addExtraServerConfig(Map config) { config.put(SSLSocketBuilder.REMOTING_KEY_STORE_TYPE, "JKS"); - String keyStoreFilePath =3D this.getClass().getResource(".keystore")= .getFile(); + String keyStoreFilePath =3D this.getClass().getResource("keystore").= getFile(); config.put(SSLSocketBuilder.REMOTING_KEY_STORE_FILE_PATH, keyStoreFi= lePath); config.put(SSLSocketBuilder.REMOTING_KEY_STORE_PASSWORD, "unit-tests= -server"); } @@ -29,7 +29,7 @@ protected void addExtraClientConfig(Map config) { config.put(SSLSocketBuilder.REMOTING_TRUST_STORE_TYPE, "JKS"); - String trustStoreFilePath =3D this.getClass().getResource(".truststo= re").getFile(); + String trustStoreFilePath =3D this.getClass().getResource("truststor= e").getFile(); config.put(SSLSocketBuilder.REMOTING_TRUST_STORE_FILE_PATH, trustSto= reFilePath); config.put(SSLSocketBuilder.REMOTING_TRUST_STORE_PASSWORD, "unit-tes= ts-client"); } Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transpor= t/servlet/ssl/SSLServletInvokerTestClient.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/serv= let/ssl/SSLServletInvokerTestClient.java 2009-04-05 06:29:30 UTC (rev 4947) +++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/serv= let/ssl/SSLServletInvokerTestClient.java 2009-04-05 06:31:17 UTC (rev 4948) @@ -13,7 +13,7 @@ { // since doing basic (using default ssl server socket factory) // need to set the system properties to the truststore - String trustStoreFilePath =3D this.getClass().getResource(".truststo= re").getFile(); + String trustStoreFilePath =3D this.getClass().getResource("truststor= e").getFile(); System.setProperty("javax.net.ssl.trustStore", trustStoreFilePath); = = --===============5142741916157592080==-- From jboss-remoting-commits at lists.jboss.org Sun Apr 5 02:37:51 2009 Content-Type: multipart/mixed; boundary="===============6033237375724113868==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4949 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servlet/callback. Date: Sun, 05 Apr 2009 02:37:51 -0400 Message-ID: --===============6033237375724113868== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-05 02:37:50 -0400 (Sun, 05 Apr 2009) New Revision: 4949 Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servl= et/callback/ Log: Property changes on: remoting2/branches/2.x/src/tests/org/jboss/test/remoti= ng/transport/servlet/callback ___________________________________________________________________ Name: svn:ignore + WEB-INF --===============6033237375724113868==-- From jboss-remoting-commits at lists.jboss.org Sun Apr 5 02:38:02 2009 Content-Type: multipart/mixed; boundary="===============6526091748559283071==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4950 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servlet/marshal. Date: Sun, 05 Apr 2009 02:38:02 -0400 Message-ID: --===============6526091748559283071== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-05 02:38:02 -0400 (Sun, 05 Apr 2009) New Revision: 4950 Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servl= et/marshal/ Log: Property changes on: remoting2/branches/2.x/src/tests/org/jboss/test/remoti= ng/transport/servlet/marshal ___________________________________________________________________ Name: svn:ignore + WEB-INF --===============6526091748559283071==-- From jboss-remoting-commits at lists.jboss.org Sun Apr 5 02:42:16 2009 Content-Type: multipart/mixed; boundary="===============4169394647645836419==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4951 - in remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servlet: multihome and 2 other directories. Date: Sun, 05 Apr 2009 02:42:15 -0400 Message-ID: --===============4169394647645836419== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-05 02:42:15 -0400 (Sun, 05 Apr 2009) New Revision: 4951 Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servl= et/multihome/readme.txt remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servl= et/nopreservelines/readme.txt remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servl= et/preservelines/readme.txt remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servl= et/readme.txt Log: JBREM-139: Added not that JBREM-139 is done. Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transpor= t/servlet/multihome/readme.txt =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/serv= let/multihome/readme.txt 2009-04-05 06:38:02 UTC (rev 4950) +++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/serv= let/multihome/readme.txt 2009-04-05 06:42:15 UTC (rev 4951) @@ -2,6 +2,11 @@ manually (JBREM-139 has been created to automate this). Until then, here = are the instructions for running the tests manually. = +******************************************************* +***** JBREM-139 is done. ***** +***** See tests.functional.servlet in build.xml. ***** +******************************************************* + servlet = 1. Get JBossAS and copy remoting's servlet-invoker.war (from distro or bui= ld) to the deploy directory. Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transpor= t/servlet/nopreservelines/readme.txt =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/serv= let/nopreservelines/readme.txt 2009-04-05 06:38:02 UTC (rev 4950) +++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/serv= let/nopreservelines/readme.txt 2009-04-05 06:42:15 UTC (rev 4951) @@ -2,6 +2,11 @@ manually (JBREM-139 has been created to automate this). Until then, here = are the instructions for running the tests manually. = +******************************************************* +***** JBREM-139 is done. ***** +***** See tests.functional.servlet in build.xml. ***** +******************************************************* + servlet = 1. Get JBossAS and copy remoting's servlet-invoker.war (from distro or bui= ld) to the deploy directory. Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transpor= t/servlet/preservelines/readme.txt =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/serv= let/preservelines/readme.txt 2009-04-05 06:38:02 UTC (rev 4950) +++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/serv= let/preservelines/readme.txt 2009-04-05 06:42:15 UTC (rev 4951) @@ -2,6 +2,11 @@ manually (JBREM-139 has been created to automate this). Until then, here = are the instructions for running the tests manually. = +******************************************************* +***** JBREM-139 is done. ***** +***** See tests.functional.servlet in build.xml. ***** +******************************************************* + servlet = 1. Get JBossAS and copy remoting's servlet-invoker.war (from distro or bui= ld) to the deploy directory. Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transpor= t/servlet/readme.txt =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/serv= let/readme.txt 2009-04-05 06:38:02 UTC (rev 4950) +++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/serv= let/readme.txt 2009-04-05 06:42:15 UTC (rev 4951) @@ -2,6 +2,11 @@ manually (JBREM-139 has been created to automate this). Until then, here = are the instructions for running the tests manually. = +******************************************************* +***** JBREM-139 is done. ***** +***** See tests.functional.servlet in build.xml. ***** +******************************************************* + servlet = 1. Get JBossAS and copy remoting's servlet-invoker.war (from distro or bui= ld) to the deploy directory. --===============4169394647645836419==-- From jboss-remoting-commits at lists.jboss.org Sun Apr 5 02:49:41 2009 Content-Type: multipart/mixed; boundary="===============7951007492055364947==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4952 - remoting2/branches/2.2. Date: Sun, 05 Apr 2009 02:49:40 -0400 Message-ID: --===============7951007492055364947== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-05 02:49:39 -0400 (Sun, 05 Apr 2009) New Revision: 4952 Modified: remoting2/branches/2.2/build.xml Log: JBREM-139: Added tests for servlet transport. Modified: remoting2/branches/2.2/build.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.2/build.xml 2009-04-05 06:42:15 UTC (rev 4951) +++ remoting2/branches/2.2/build.xml 2009-04-05 06:49:39 UTC (rev 4952) @@ -30,7 +30,8 @@ = - + + = = @@ -907,6 +908,212 @@ = + + + + + + = + + jboss home: ${jboss.home} + + + + + + + = + + + + + + + + + + + = + + + + + + + + + + + + + + + + + + + + + Going to sleep for ${as.startup.time} seconds + + + + + + + + + + + + Going to sleep for ${as.startup.time} seconds + + + = + + + + + + + + + + + = + + + + = + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + = + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + = + + + + + + + + + + + + + + + + + + + = + + + + + + + + + + + + + + + + + + + + + + + + + + + + = --===============7951007492055364947==-- From jboss-remoting-commits at lists.jboss.org Sun Apr 5 02:50:48 2009 Content-Type: multipart/mixed; boundary="===============0334317121086367560==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4953 - remoting2/branches/2.2. Date: Sun, 05 Apr 2009 02:50:47 -0400 Message-ID: --===============0334317121086367560== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-05 02:50:47 -0400 (Sun, 05 Apr 2009) New Revision: 4953 Added: remoting2/branches/2.2/local.properties Log: JBREM-139: Local properties for servlet transport tests. Added: remoting2/branches/2.2/local.properties =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.2/local.properties (rev 0) +++ remoting2/branches/2.2/local.properties 2009-04-05 06:50:47 UTC (rev 49= 53) @@ -0,0 +1,4 @@ +jboss.home=3Dc://cygwin/home/rsigal/workspace.new/EAP_4_3_0_GA_CP03/build/= output/jboss-4.3.0.GA_CP03 +as.startup.time=3D220 +as.shutdown.time=3D10 +shell=3Dc:/cygwin/bin/sh.exe \ No newline at end of file --===============0334317121086367560==-- From jboss-remoting-commits at lists.jboss.org Sun Apr 5 02:55:49 2009 Content-Type: multipart/mixed; boundary="===============0841565737642872782==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4954 - remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/WEB-INF. Date: Sun, 05 Apr 2009 02:55:48 -0400 Message-ID: --===============0841565737642872782== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-05 02:55:48 -0400 (Sun, 05 Apr 2009) New Revision: 4954 Modified: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servl= et/WEB-INF/web.xml Log: JBREM-139: Removed extraneous parameters from locatorUrl. Modified: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transpor= t/servlet/WEB-INF/web.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/serv= let/WEB-INF/web.xml 2009-04-05 06:50:47 UTC (rev 4953) +++ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/serv= let/WEB-INF/web.xml 2009-04-05 06:55:48 UTC (rev 4954) @@ -16,7 +16,7 @@ org.jboss.remoting.transport.servlet.web.ServerInvo= kerServlet locatorUrl - servlet://localhost:8080/servlet-invoker/ServerIn= vokerServlet/?marshaller=3Dorg.jboss.test.remoting.marshall.config.ConfigTe= stMarshaller&unmarshaller=3Dorg.jboss.test.remoting.marshall.config.Con= figTestUnmarshaller + servlet://localhost:8080/servlet-invoker/ServerIn= vokerServlet/?createUniqueObjectName=3Dtrue The servlet server invoker locator url 1 --===============0841565737642872782==-- From jboss-remoting-commits at lists.jboss.org Sun Apr 5 02:56:08 2009 Content-Type: multipart/mixed; boundary="===============2457649188470561813==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4955 - remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet. Date: Sun, 05 Apr 2009 02:56:08 -0400 Message-ID: --===============2457649188470561813== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-05 02:56:08 -0400 (Sun, 05 Apr 2009) New Revision: 4955 Added: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servl= et/server.xml Log: JBREM-139: Created a single server.xml in .../servlet directory for all ser= vlet tests. Added: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/s= ervlet/server.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/serv= let/server.xml (rev 0) +++ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/serv= let/server.xml 2009-04-05 06:56:08 UTC (rev 4955) @@ -0,0 +1,186 @@ + + + + + + + + + + + + + = + + + + + + + + + + + + + + + + + + + + + + + + = + + + + + + + + + = + + + + + + + + + + \ No newline at end of file --===============2457649188470561813==-- From jboss-remoting-commits at lists.jboss.org Sun Apr 5 02:57:08 2009 Content-Type: multipart/mixed; boundary="===============5454795385419099668==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4956 - in remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/callback: WEB-INF and 1 other directory. Date: Sun, 05 Apr 2009 02:57:08 -0400 Message-ID: --===============5454795385419099668== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-05 02:57:08 -0400 (Sun, 05 Apr 2009) New Revision: 4956 Added: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servl= et/callback/WEB-INF/ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servl= et/callback/WEB-INF/web.xml Log: JBREM-139: Moved callback tests to their own directory. Added: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/s= ervlet/callback/WEB-INF/web.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/serv= let/callback/WEB-INF/web.xml (rev 0) +++ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/serv= let/callback/WEB-INF/web.xml 2009-04-05 06:57:08 UTC (rev 4956) @@ -0,0 +1,29 @@ + + + + + + + ServerInvokerServlet + The ServerInvokerServlet receives requests via HTTP + protocol from within a web container and passes it onto the + ServletServerInvoker for processing. + + org.jboss.remoting.transport.servlet.web.ServerInvo= kerServlet + + locatorUrl + servlet://localhost:8080/servlet-invoker/ServerIn= vokerServlet/?createUniqueObjectName=3Dtrue&useAllParams=3Dtrue&blo= ckingMode=3Dblocking + The servlet server invoker locator url + + 1 + + + ServerInvokerServlet + /ServerInvokerServlet/* + + + --===============5454795385419099668==-- From jboss-remoting-commits at lists.jboss.org Sun Apr 5 02:57:26 2009 Content-Type: multipart/mixed; boundary="===============4694864243362352018==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4957 - remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/ssl. Date: Sun, 05 Apr 2009 02:57:26 -0400 Message-ID: --===============4694864243362352018== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-05 02:57:26 -0400 (Sun, 05 Apr 2009) New Revision: 4957 Removed: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servl= et/ssl/server.xml Log: JBREM-139: Created a single server.xml in .../servlet directory for all ser= vlet tests. Deleted: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport= /servlet/ssl/server.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/serv= let/ssl/server.xml 2009-04-05 06:57:08 UTC (rev 4956) +++ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/serv= let/ssl/server.xml 2009-04-05 06:57:26 UTC (rev 4957) @@ -1,169 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - = - - - - - - - - - = - - - - - - - - - - \ No newline at end of file --===============4694864243362352018==-- From jboss-remoting-commits at lists.jboss.org Sun Apr 5 02:58:01 2009 Content-Type: multipart/mixed; boundary="===============8848914632882048576==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4958 - remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/ssl/WEB-INF. Date: Sun, 05 Apr 2009 02:58:01 -0400 Message-ID: --===============8848914632882048576== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-05 02:58:00 -0400 (Sun, 05 Apr 2009) New Revision: 4958 Modified: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servl= et/ssl/WEB-INF/web.xml Log: JBREM-139: Removed commented locatorUrl entry. Modified: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transpor= t/servlet/ssl/WEB-INF/web.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/serv= let/ssl/WEB-INF/web.xml 2009-04-05 06:57:26 UTC (rev 4957) +++ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/serv= let/ssl/WEB-INF/web.xml 2009-04-05 06:58:00 UTC (rev 4958) @@ -18,11 +18,6 @@ locatorUrl sslservlet://localhost:8443/servlet-invoker/Serve= rInvokerServlet/?createUniqueObjectName=3Dtrue The servlet server invoker locator url - 1 --===============8848914632882048576==-- From jboss-remoting-commits at lists.jboss.org Sun Apr 5 02:58:47 2009 Content-Type: multipart/mixed; boundary="===============8392435437664556189==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4959 - remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/ssl. Date: Sun, 05 Apr 2009 02:58:47 -0400 Message-ID: --===============8392435437664556189== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-05 02:58:47 -0400 (Sun, 05 Apr 2009) New Revision: 4959 Modified: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servl= et/ssl/SSLServletInvokerTestClient.java Log: JBREM-139: Renamed .truststore to truststore. Modified: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transpor= t/servlet/ssl/SSLServletInvokerTestClient.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/serv= let/ssl/SSLServletInvokerTestClient.java 2009-04-05 06:58:00 UTC (rev 4958) +++ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/serv= let/ssl/SSLServletInvokerTestClient.java 2009-04-05 06:58:47 UTC (rev 4959) @@ -13,7 +13,7 @@ { // since doing basic (using default ssl server socket factory) // need to set the system properties to the truststore - String trustStoreFilePath =3D this.getClass().getResource(".truststo= re").getFile(); + String trustStoreFilePath =3D this.getClass().getResource("truststor= e").getFile(); System.setProperty("javax.net.ssl.trustStore", trustStoreFilePath); = = --===============8392435437664556189==-- From jboss-remoting-commits at lists.jboss.org Sun Apr 5 02:59:03 2009 Content-Type: multipart/mixed; boundary="===============8233957367904508128==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4960 - remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet. Date: Sun, 05 Apr 2009 02:59:03 -0400 Message-ID: --===============8233957367904508128== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-05 02:59:03 -0400 (Sun, 05 Apr 2009) New Revision: 4960 Modified: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servl= et/readme.txt Log: JBREM-139: Added note that JBREM-139 is done. Modified: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transpor= t/servlet/readme.txt =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/serv= let/readme.txt 2009-04-05 06:58:47 UTC (rev 4959) +++ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/serv= let/readme.txt 2009-04-05 06:59:03 UTC (rev 4960) @@ -2,6 +2,11 @@ manually (JBREM-139 has been created to automate this). Until then, here = are the instructions for running the tests manually. = +******************************************************* +***** JBREM-139 is done. ***** +***** See tests.functional.servlet in build.xml. ***** +******************************************************* + servlet = 1. Get JBossAS and copy remoting's servlet-invoker.war (from distro or bui= ld) to the deploy directory. --===============8233957367904508128==-- From jboss-remoting-commits at lists.jboss.org Tue Apr 7 03:55:05 2009 Content-Type: multipart/mixed; boundary="===============8547746510809243711==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4961 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/connection. Date: Tue, 07 Apr 2009 03:55:05 -0400 Message-ID: --===============8547746510809243711== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-07 03:55:05 -0400 (Tue, 07 Apr 2009) New Revision: 4961 Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/connection/Conn= ectionValidatorDisconnectTimeoutTestCase.java Log: JBREM-1112: Doubled lease period to 2000 ms. Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/connecti= on/ConnectionValidatorDisconnectTimeoutTestCase.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/connection/Con= nectionValidatorDisconnectTimeoutTestCase.java 2009-04-05 06:59:03 UTC (rev= 4960) +++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/connection/Con= nectionValidatorDisconnectTimeoutTestCase.java 2009-04-07 07:55:05 UTC (rev= 4961) @@ -490,7 +490,7 @@ log.info("Starting remoting server with locator uri of: " + locatorU= RI); HashMap config =3D new HashMap(); config.put(InvokerLocator.FORCE_REMOTE, "true"); - config.put("leasePeriod", "1000"); + config.put("leasePeriod", "2000"); addExtraServerConfig(config); connector =3D new Connector(serverLocator, config); connector.create(); --===============8547746510809243711==-- From jboss-remoting-commits at lists.jboss.org Wed Apr 8 03:34:23 2009 Content-Type: multipart/mixed; boundary="===============6333339976091949509==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4962 - in remoting2/branches/2.2/src/tests/org/jboss/test/remoting: datatype and 1 other directory. Date: Wed, 08 Apr 2009 03:34:23 -0400 Message-ID: --===============6333339976091949509== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-08 03:34:23 -0400 (Wed, 08 Apr 2009) New Revision: 4962 Added: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/datatype/ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/datatype/DataTy= peRaceTestCase.java Log: JBREM-1109: New unit test. Added: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/datatype/Da= taTypeRaceTestCase.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/datatype/DataT= ypeRaceTestCase.java (rev 0) +++ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/datatype/DataT= ypeRaceTestCase.java 2009-04-08 07:34:23 UTC (rev 4962) @@ -0,0 +1,252 @@ +/* +* JBoss, Home of Professional Open Source +* Copyright 2009, 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.datatype; + +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.remoting.Client; +import org.jboss.remoting.InvocationRequest; +import org.jboss.remoting.InvokerLocator; +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.ClientInvoker; +import org.jboss.remoting.transport.Connector; +import org.jboss.remoting.transport.PortUtil; + +import EDU.oswego.cs.dl.util.concurrent.Rendezvous; + + +/** + * Unit test for JBREM-1109. + * = + * @author Ron Sigal + * @version = + *

+ * Copyright Apr 8, 2009 + *

+ */ +public class DataTypeRaceTestCase extends TestCase +{ + private static Logger log =3D Logger.getLogger(DataTypeRaceTestCase.cla= ss); + = + private static boolean firstTime =3D true; + protected static String dataType; + = + protected String host; + protected int port; + protected String locatorURI; + protected InvokerLocator serverLocator; + protected Connector connector; + protected TestInvocationHandler invocationHandler; + protected Object lock =3D new Object(); + + = + public void setUp() throws Exception + { + if (firstTime) + { + firstTime =3D false; + Logger.getLogger("org.jboss.remoting").setLevel(Level.INFO); + Logger.getLogger("org.jboss.test.remoting").setLevel(Level.INFO); + String pattern =3D "[%d{ABSOLUTE}] [%t] %5p (%F:%L) - %m%n"; + PatternLayout layout =3D new PatternLayout(pattern); + ConsoleAppender consoleAppender =3D new ConsoleAppender(layout); + Logger.getRootLogger().addAppender(consoleAppender); = + } + } + + = + public void tearDown() + { + } + = + = + public void testDataTypeRace() throws Throwable + { + log.info("entering " + getName()); + = + // Start server. + setupServer(); + = + // Create client. + InvokerLocator clientLocator =3D new InvokerLocator(locatorURI); + HashMap clientConfig =3D new HashMap(); + clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); + addExtraClientConfig(clientConfig); + Client client =3D new Client(clientLocator, clientConfig); + client.connect(); + log.info("client is connected"); + = + // Test datatype race. + MicroRemoteClientInvoker clientInvoker =3D (MicroRemoteClientInvoker= ) client.getInvoker(); + = + int THREADS =3D 2000; + TestThread[] threads =3D new TestThread[THREADS]; + Rendezvous startBarrier =3D new Rendezvous(THREADS); + Rendezvous stopBarrier =3D new Rendezvous(THREADS + 1); + = + log.info(getName() + " creating " + THREADS + " threads"); + for (int i =3D 0; i < THREADS; i++) + { + threads[i] =3D new TestThread(clientInvoker, startBarrier, stopBa= rrier, i); + threads[i].start(); + } + = + log.info(getName() + " waiting on stopBarrier"); + rendezvous(stopBarrier); + log.info(getName() + " checking threads"); + = + for (int i =3D 0; i < THREADS; i++) + { + assertTrue("failure in " + threads[i], threads[i].ok); + } + = + 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 =3D InetAddress.getLocalHost().getHostAddress(); + port =3D PortUtil.findFreePort(host); + locatorURI =3D getTransport() + "://" + host + ":" + port; + String metadata =3D System.getProperty("remoting.metadata"); + if (metadata !=3D null) + { + locatorURI +=3D "/?" + metadata; + } + serverLocator =3D new InvokerLocator(locatorURI); + log.info("Starting remoting server with locator uri of: " + locatorU= RI); + HashMap config =3D new HashMap(); + config.put(InvokerLocator.FORCE_REMOTE, "true"); + addExtraServerConfig(config); + connector =3D new Connector(serverLocator, config); + connector.create(); + invocationHandler =3D new TestInvocationHandler(); + connector.addInvocationHandler("test", invocationHandler); + connector.start(); + } + = + = + protected void shutdownServer() throws Exception + { + if (connector !=3D null) + connector.stop(); + } + = + = + protected static void rendezvous(Rendezvous barrier) + { + while (true) + { + try + { + barrier.rendezvous(null); + break; + } + catch (InterruptedException e1) + { + + } + } + } + = + = + static class TestInvocationHandler implements ServerInvocationHandler + { + public void addListener(InvokerCallbackHandler callbackHandler) {} + public Object invoke(final InvocationRequest invocation) throws Thro= wable + { + return invocation.getParameter(); + } + public void removeListener(InvokerCallbackHandler callbackHandler) {} + public void setMBeanServer(MBeanServer server) {} + public void setInvoker(ServerInvoker invoker) {} + } + = + static class TestThread extends Thread + { + String name; + ClientInvoker clientInvoker; + Rendezvous startBarrier; + Rendezvous stopBarrier; + InvocationRequest request =3D new InvocationRequest(null, null, "abc= ", null, null, null); + boolean ok; + = + public TestThread(ClientInvoker clientInvoker, Rendezvous startBarri= er, Rendezvous stopBarrier, int number) + { + this.clientInvoker =3D clientInvoker; + this.startBarrier =3D startBarrier; + this.stopBarrier =3D stopBarrier; + name =3D "TestThread[" + number + "]"; + } + = + public void run() + { +// log.debug(this + " waiting on startBarrier"); + rendezvous(startBarrier); +// log.debug(this + " executing"); + try + { + clientInvoker.invoke(request); +// log.debug(this + " waiting on stopBarrier"); + ok =3D true; + rendezvous(stopBarrier); +// log.debug(this + " done"); + } + catch (Throwable t) + { + t.printStackTrace(); + rendezvous(stopBarrier); + } + } + = + public String toString() + { + return name; + } + } +} \ No newline at end of file --===============6333339976091949509==-- From jboss-remoting-commits at lists.jboss.org Wed Apr 8 03:36:16 2009 Content-Type: multipart/mixed; boundary="===============7237780534661991096==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4963 - remoting2/branches/2.x/src/main/org/jboss/remoting. Date: Wed, 08 Apr 2009 03:36:16 -0400 Message-ID: --===============7237780534661991096== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-08 03:36:16 -0400 (Wed, 08 Apr 2009) New Revision: 4963 Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/MicroRemoteClientInvo= ker.java Log: JBREM-1109: getDataType() uses localDataType to avoid race. Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/MicroRemoteCli= entInvoker.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/MicroRemoteClientInv= oker.java 2009-04-08 07:34:23 UTC (rev 4962) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/MicroRemoteClientInv= oker.java 2009-04-08 07:36:16 UTC (rev 4963) @@ -509,11 +509,12 @@ { if (dataType =3D=3D null) { - dataType =3D getDataType(getLocator()); - if (dataType =3D=3D null) + String localDataType =3D getDataType(getLocator()); + if (localDataType =3D=3D null) { - dataType =3D getDefaultDataType(); + localDataType =3D getDefaultDataType(); } + dataType =3D localDataType; } return dataType; } --===============7237780534661991096==-- From jboss-remoting-commits at lists.jboss.org Wed Apr 8 03:38:22 2009 Content-Type: multipart/mixed; boundary="===============8792006447907748463==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4964 - in remoting2/branches/2.x/src/tests/org/jboss/test/remoting: datatype and 1 other directory. Date: Wed, 08 Apr 2009 03:38:22 -0400 Message-ID: --===============8792006447907748463== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-08 03:38:21 -0400 (Wed, 08 Apr 2009) New Revision: 4964 Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/datatype/ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/datatype/DataTy= peRaceTestCase.java Log: JBREM-1109: New unit test. Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/datatype/Da= taTypeRaceTestCase.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/datatype/DataT= ypeRaceTestCase.java (rev 0) +++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/datatype/DataT= ypeRaceTestCase.java 2009-04-08 07:38:21 UTC (rev 4964) @@ -0,0 +1,252 @@ +/* +* JBoss, Home of Professional Open Source +* Copyright 2009, 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.datatype; + +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.remoting.Client; +import org.jboss.remoting.InvocationRequest; +import org.jboss.remoting.InvokerLocator; +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.ClientInvoker; +import org.jboss.remoting.transport.Connector; +import org.jboss.remoting.transport.PortUtil; + +import EDU.oswego.cs.dl.util.concurrent.Rendezvous; + + +/** + * Unit test for JBREM-1109. + * = + * @author Ron Sigal + * @version = + *

+ * Copyright Apr 8, 2009 + *

+ */ +public class DataTypeRaceTestCase extends TestCase +{ + private static Logger log =3D Logger.getLogger(DataTypeRaceTestCase.cla= ss); + = + private static boolean firstTime =3D true; + protected static String dataType; + = + protected String host; + protected int port; + protected String locatorURI; + protected InvokerLocator serverLocator; + protected Connector connector; + protected TestInvocationHandler invocationHandler; + protected Object lock =3D new Object(); + + = + public void setUp() throws Exception + { + if (firstTime) + { + firstTime =3D false; + Logger.getLogger("org.jboss.remoting").setLevel(Level.INFO); + Logger.getLogger("org.jboss.test.remoting").setLevel(Level.INFO); + String pattern =3D "[%d{ABSOLUTE}] [%t] %5p (%F:%L) - %m%n"; + PatternLayout layout =3D new PatternLayout(pattern); + ConsoleAppender consoleAppender =3D new ConsoleAppender(layout); + Logger.getRootLogger().addAppender(consoleAppender); = + } + } + + = + public void tearDown() + { + } + = + = + public void testDataTypeRace() throws Throwable + { + log.info("entering " + getName()); + = + // Start server. + setupServer(); + = + // Create client. + InvokerLocator clientLocator =3D new InvokerLocator(locatorURI); + HashMap clientConfig =3D new HashMap(); + clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); + addExtraClientConfig(clientConfig); + Client client =3D new Client(clientLocator, clientConfig); + client.connect(); + log.info("client is connected"); + = + // Test datatype race. + MicroRemoteClientInvoker clientInvoker =3D (MicroRemoteClientInvoker= ) client.getInvoker(); + = + int THREADS =3D 2000; + TestThread[] threads =3D new TestThread[THREADS]; + Rendezvous startBarrier =3D new Rendezvous(THREADS); + Rendezvous stopBarrier =3D new Rendezvous(THREADS + 1); + = + log.info(getName() + " creating " + THREADS + " threads"); + for (int i =3D 0; i < THREADS; i++) + { + threads[i] =3D new TestThread(clientInvoker, startBarrier, stopBa= rrier, i); + threads[i].start(); + } + = + log.info(getName() + " waiting on stopBarrier"); + rendezvous(stopBarrier); + log.info(getName() + " checking threads"); + = + for (int i =3D 0; i < THREADS; i++) + { + assertTrue("failure in " + threads[i], threads[i].ok); + } + = + 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 =3D InetAddress.getLocalHost().getHostAddress(); + port =3D PortUtil.findFreePort(host); + locatorURI =3D getTransport() + "://" + host + ":" + port; + String metadata =3D System.getProperty("remoting.metadata"); + if (metadata !=3D null) + { + locatorURI +=3D "/?" + metadata; + } + serverLocator =3D new InvokerLocator(locatorURI); + log.info("Starting remoting server with locator uri of: " + locatorU= RI); + HashMap config =3D new HashMap(); + config.put(InvokerLocator.FORCE_REMOTE, "true"); + addExtraServerConfig(config); + connector =3D new Connector(serverLocator, config); + connector.create(); + invocationHandler =3D new TestInvocationHandler(); + connector.addInvocationHandler("test", invocationHandler); + connector.start(); + } + = + = + protected void shutdownServer() throws Exception + { + if (connector !=3D null) + connector.stop(); + } + = + = + protected static void rendezvous(Rendezvous barrier) + { + while (true) + { + try + { + barrier.rendezvous(null); + break; + } + catch (InterruptedException e1) + { + + } + } + } + = + = + static class TestInvocationHandler implements ServerInvocationHandler + { + public void addListener(InvokerCallbackHandler callbackHandler) {} + public Object invoke(final InvocationRequest invocation) throws Thro= wable + { + return invocation.getParameter(); + } + public void removeListener(InvokerCallbackHandler callbackHandler) {} + public void setMBeanServer(MBeanServer server) {} + public void setInvoker(ServerInvoker invoker) {} + } + = + static class TestThread extends Thread + { + String name; + ClientInvoker clientInvoker; + Rendezvous startBarrier; + Rendezvous stopBarrier; + InvocationRequest request =3D new InvocationRequest(null, null, "abc= ", null, null, null); + boolean ok; + = + public TestThread(ClientInvoker clientInvoker, Rendezvous startBarri= er, Rendezvous stopBarrier, int number) + { + this.clientInvoker =3D clientInvoker; + this.startBarrier =3D startBarrier; + this.stopBarrier =3D stopBarrier; + name =3D "TestThread[" + number + "]"; + } + = + public void run() + { +// log.debug(this + " waiting on startBarrier"); + rendezvous(startBarrier); +// log.debug(this + " executing"); + try + { + clientInvoker.invoke(request); +// log.debug(this + " waiting on stopBarrier"); + ok =3D true; + rendezvous(stopBarrier); +// log.debug(this + " done"); + } + catch (Throwable t) + { + t.printStackTrace(); + rendezvous(stopBarrier); + } + } + = + public String toString() + { + return name; + } + } +} \ No newline at end of file --===============8792006447907748463==-- From jboss-remoting-commits at lists.jboss.org Wed Apr 8 23:19:15 2009 Content-Type: multipart/mixed; boundary="===============5910448096533719720==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4965 - remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3. Date: Wed, 08 Apr 2009 23:19:15 -0400 Message-ID: --===============5910448096533719720== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: david.lloyd(a)jboss.com Date: 2009-04-08 23:19:15 -0400 (Wed, 08 Apr 2009) New Revision: 4965 Added: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Service= NotFoundException.java Log: Add a specific exception for the service-not-found situation Added: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Ser= viceNotFoundException.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Servic= eNotFoundException.java (rev 0) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Servic= eNotFoundException.java 2009-04-09 03:19:15 UTC (rev 4965) @@ -0,0 +1,101 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2009, 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.remoting3; + +import java.net.URI; + +/** + * Service not found. This exception is thrown when a service is looked u= p which is not registered anywhere. + */ +public final class ServiceNotFoundException extends RemotingException { + + private static final long serialVersionUID =3D -998858276817298658L; + + private final URI serviceUri; + + /** + * Constructs a ServiceNotFoundException with no detail messa= ge. The cause is not initialized, and may + * subsequently be initialized by a call to {@link #initCause(Throwabl= e) initCause}. + * + * @param uri the service URI that could not be found + */ + public ServiceNotFoundException(final URI uri) { + serviceUri =3D uri; + } + + /** + * Constructs a ServiceNotFoundException with the specified d= etail message. The cause is not initialized, and + * may subsequently be initialized by a call to {@link #initCause(Thro= wable) initCause}. + * + * @param uri the service URI that could not be found + * @param msg the detail message + */ + public ServiceNotFoundException(final URI uri, final String msg) { + super(msg); + serviceUri =3D uri; + } + + /** + * Constructs a ServiceNotFoundException with the specified c= ause. The detail message is set to: + *
+     *  (cause =3D=3D null ? null : cause.toString())
+ * (which typically contains the class and detail message of cause= ). + * + * @param uri the service URI that could not be found + * @param cause the cause (which is saved for later retrieval by the {= @link #getCause()} method) + */ + public ServiceNotFoundException(final URI uri, final Throwable cause) { + super(cause); + serviceUri =3D uri; + } + + /** + * Constructs a ServiceNotFoundException with the specified d= etail message and cause. + * + * @param uri the service URI that could not be found + * @param msg the detail message + * @param cause the cause (which is saved for later retrieval by the {= @link #getCause()} method) + */ + public ServiceNotFoundException(final URI uri, final String msg, final= Throwable cause) { + super(msg, cause); + serviceUri =3D uri; + } + + /** + * Get the service URI which could not be found. + * + * @return the service URI + */ + public URI getServiceUri() { + return serviceUri; + } + + /** + * Returns the detail message string of this throwable. + * + * @return the detail message string of this throwable + */ + public String getMessage() { + return super.getMessage() + ": " + serviceUri; + } +} --===============5910448096533719720==-- From jboss-remoting-commits at lists.jboss.org Thu Apr 9 14:41:35 2009 Content-Type: multipart/mixed; boundary="===============0369943792960852590==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4966 - remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3. Date: Thu, 09 Apr 2009 14:41:34 -0400 Message-ID: --===============0369943792960852590== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: david.lloyd(a)jboss.com Date: 2009-04-09 14:41:34 -0400 (Thu, 09 Apr 2009) New Revision: 4966 Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Handlea= bleCloseable.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Request= CancelHandler.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Request= Context.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Request= Listener.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Service= Context.java Log: Copyright Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/= HandleableCloseable.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Handle= ableCloseable.java 2009-04-09 03:19:15 UTC (rev 4965) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Handle= ableCloseable.java 2009-04-09 18:41:34 UTC (rev 4966) @@ -1,3 +1,25 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2009, 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.remoting3; = import java.io.Closeable; Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/= RequestCancelHandler.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Reques= tCancelHandler.java 2009-04-09 03:19:15 UTC (rev 4965) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Reques= tCancelHandler.java 2009-04-09 18:41:34 UTC (rev 4966) @@ -1,3 +1,25 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2009, 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.remoting3; = /** Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/= RequestContext.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Reques= tContext.java 2009-04-09 03:19:15 UTC (rev 4965) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Reques= tContext.java 2009-04-09 18:41:34 UTC (rev 4966) @@ -1,3 +1,25 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2009, 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.remoting3; = import java.io.IOException; Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/= RequestListener.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Reques= tListener.java 2009-04-09 03:19:15 UTC (rev 4965) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Reques= tListener.java 2009-04-09 18:41:34 UTC (rev 4966) @@ -1,3 +1,25 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2009, 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.remoting3; = /** Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/= ServiceContext.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Servic= eContext.java 2009-04-09 03:19:15 UTC (rev 4965) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Servic= eContext.java 2009-04-09 18:41:34 UTC (rev 4966) @@ -1,3 +1,25 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2009, 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.remoting3; = import java.util.concurrent.ConcurrentMap; --===============0369943792960852590==-- From jboss-remoting-commits at lists.jboss.org Thu Apr 9 15:02:54 2009 Content-Type: multipart/mixed; boundary="===============3762217317924499016==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4967 - remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3. Date: Thu, 09 Apr 2009 15:02:54 -0400 Message-ID: --===============3762217317924499016== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: david.lloyd(a)jboss.com Date: 2009-04-09 15:02:54 -0400 (Thu, 09 Apr 2009) New Revision: 4967 Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Abstrac= tRequestListener.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Client.= java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/ClientC= ontext.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/ClientS= ource.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/CloseHa= ndler.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Endpoin= tImpl.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/QueueEx= ecutor.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Remotin= g.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Service= URI.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Version= .java Log: copyright Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/= AbstractRequestListener.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Abstra= ctRequestListener.java 2009-04-09 18:41:34 UTC (rev 4966) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Abstra= ctRequestListener.java 2009-04-09 19:02:54 UTC (rev 4967) @@ -1,3 +1,25 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2009, 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.remoting3; = /** Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/= Client.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Client= .java 2009-04-09 18:41:34 UTC (rev 4966) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Client= .java 2009-04-09 19:02:54 UTC (rev 4967) @@ -1,3 +1,25 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2009, 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.remoting3; = import java.io.IOException; Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/= ClientContext.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Client= Context.java 2009-04-09 18:41:34 UTC (rev 4966) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Client= Context.java 2009-04-09 19:02:54 UTC (rev 4967) @@ -1,3 +1,25 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2009, 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.remoting3; = import java.util.concurrent.ConcurrentMap; Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/= ClientSource.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Client= Source.java 2009-04-09 18:41:34 UTC (rev 4966) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Client= Source.java 2009-04-09 19:02:54 UTC (rev 4967) @@ -1,3 +1,25 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2009, 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.remoting3; = import java.io.IOException; Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/= CloseHandler.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/CloseH= andler.java 2009-04-09 18:41:34 UTC (rev 4966) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/CloseH= andler.java 2009-04-09 19:02:54 UTC (rev 4967) @@ -1,3 +1,25 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2009, 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.remoting3; = /** Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/= EndpointImpl.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Endpoi= ntImpl.java 2009-04-09 18:41:34 UTC (rev 4966) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Endpoi= ntImpl.java 2009-04-09 19:02:54 UTC (rev 4967) @@ -1,3 +1,25 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2009, 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.remoting3; = import java.io.Closeable; Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/= QueueExecutor.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/QueueE= xecutor.java 2009-04-09 18:41:34 UTC (rev 4966) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/QueueE= xecutor.java 2009-04-09 19:02:54 UTC (rev 4967) @@ -1,3 +1,25 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2009, 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.remoting3; = import java.util.LinkedList; Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/= Remoting.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Remoti= ng.java 2009-04-09 18:41:34 UTC (rev 4966) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Remoti= ng.java 2009-04-09 19:02:54 UTC (rev 4967) @@ -1,3 +1,25 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2009, 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.remoting3; = import java.io.IOException; Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/= ServiceURI.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Servic= eURI.java 2009-04-09 18:41:34 UTC (rev 4966) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Servic= eURI.java 2009-04-09 19:02:54 UTC (rev 4967) @@ -1,3 +1,25 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2009, 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.remoting3; = import java.net.URI; Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/= Version.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Versio= n.java 2009-04-09 18:41:34 UTC (rev 4966) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Versio= n.java 2009-04-09 19:02:54 UTC (rev 4967) @@ -1,3 +1,25 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2009, 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.remoting3; = /** --===============3762217317924499016==-- From jboss-remoting-commits at lists.jboss.org Sat Apr 11 21:44:36 2009 Content-Type: multipart/mixed; boundary="===============1858877029343195295==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4968 - remoting2/branches/2.x/src/main/org/jboss/remoting/detection/multicast. Date: Sat, 11 Apr 2009 21:44:36 -0400 Message-ID: --===============1858877029343195295== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-11 21:44:36 -0400 (Sat, 11 Apr 2009) New Revision: 4968 Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/detection/multicast/M= ulticastDetector.java remoting2/branches/2.x/src/main/org/jboss/remoting/detection/multicast/M= ulticastDetectorMBean.java Log: JBREM-1099: Added bufferSize attribute. Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/detection/mult= icast/MulticastDetector.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/detection/multicast/= MulticastDetector.java 2009-04-09 19:02:54 UTC (rev 4967) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/detection/multicast/= MulticastDetector.java 2009-04-12 01:44:36 UTC (rev 4968) @@ -59,6 +59,7 @@ private int port =3D 2410; private MulticastSocket socket; private Listener listener =3D new Listener("Remoting Multicast Detector= - Listener Thread: " + threadCounter++); + private int bufferSize =3D 10000; = = /** @@ -137,6 +138,17 @@ this.port =3D port; } = + + public int getBufferSize() + { + return bufferSize; + } + + public void setBufferSize(int bufferSize) + { + this.bufferSize =3D bufferSize; + } + = /** * called by MBeanServer to start the mbean lifecycle * @@ -347,7 +359,8 @@ = public void run() { - byte[] buf =3D new byte[4000]; + log.debug("using bufferSize: " + bufferSize); + byte[] buf =3D new byte[bufferSize]; DatagramPacket p =3D new DatagramPacket(buf, 0, buf.length); //p.setAddress(addr); //p.setPort(port); Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/detection/mult= icast/MulticastDetectorMBean.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/detection/multicast/= MulticastDetectorMBean.java 2009-04-09 19:02:54 UTC (rev 4967) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/detection/multicast/= MulticastDetectorMBean.java 2009-04-12 01:44:36 UTC (rev 4968) @@ -84,5 +84,15 @@ * @param defaultIP The IP that is used to broadcast detection messages= on via multicast. */ void setDefaultIP(String defaultIP); + = + /** + * @return The size of the byte array in the DatagramPacket. + */ + int getBufferSize(); + = + /** + * @param bufferSize The size of the byte array in the DatagramPacket. + */ + void setBufferSize(int bufferSize); = } --===============1858877029343195295==-- From jboss-remoting-commits at lists.jboss.org Sat Apr 11 21:46:00 2009 Content-Type: multipart/mixed; boundary="===============4185313674516225280==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4969 - remoting2/branches/2.2/src/main/org/jboss/remoting/detection/multicast. Date: Sat, 11 Apr 2009 21:46:00 -0400 Message-ID: --===============4185313674516225280== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-11 21:46:00 -0400 (Sat, 11 Apr 2009) New Revision: 4969 Modified: remoting2/branches/2.2/src/main/org/jboss/remoting/detection/multicast/M= ulticastDetector.java remoting2/branches/2.2/src/main/org/jboss/remoting/detection/multicast/M= ulticastDetectorMBean.java Log: JBREM-1099: Added bufferSize attribute. Modified: remoting2/branches/2.2/src/main/org/jboss/remoting/detection/mult= icast/MulticastDetector.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.2/src/main/org/jboss/remoting/detection/multicast/= MulticastDetector.java 2009-04-12 01:44:36 UTC (rev 4968) +++ remoting2/branches/2.2/src/main/org/jboss/remoting/detection/multicast/= MulticastDetector.java 2009-04-12 01:46:00 UTC (rev 4969) @@ -55,6 +55,7 @@ private int port =3D 2410; private MulticastSocket socket; private Listener listener =3D new Listener("Remoting Multicast Detector= - Listener Thread: " + threadCounter++); + private int bufferSize =3D 10000; = = /** @@ -133,6 +134,17 @@ this.port =3D port; } = + + public int getBufferSize() + { + return bufferSize; + } + + public void setBufferSize(int bufferSize) + { + this.bufferSize =3D bufferSize; + } + = /** * called by MBeanServer to start the mbean lifecycle * @@ -210,6 +222,9 @@ if(socket !=3D null) { Detection msg =3D createDetection(); + if (msg =3D=3D null) + return; + = try { if(log.isTraceEnabled()) @@ -324,7 +339,8 @@ = public void run() { - byte[] buf =3D new byte[4000]; + log.debug("Using bufferSize: " + bufferSize); + byte[] buf =3D new byte[bufferSize]; DatagramPacket p =3D new DatagramPacket(buf, 0, buf.length); //p.setAddress(addr); //p.setPort(port); Modified: remoting2/branches/2.2/src/main/org/jboss/remoting/detection/mult= icast/MulticastDetectorMBean.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.2/src/main/org/jboss/remoting/detection/multicast/= MulticastDetectorMBean.java 2009-04-12 01:44:36 UTC (rev 4968) +++ remoting2/branches/2.2/src/main/org/jboss/remoting/detection/multicast/= MulticastDetectorMBean.java 2009-04-12 01:46:00 UTC (rev 4969) @@ -84,5 +84,15 @@ * @param defaultIP The IP that is used to broadcast detection messages= on via multicast. */ void setDefaultIP(String defaultIP); + = + /** + * @return The size of the byte array in the DatagramPacket. + */ + int getBufferSize(); + = + /** + * @param bufferSize The size of the byte array in the DatagramPacket. + */ + void setBufferSize(int bufferSize); = } --===============4185313674516225280==-- From jboss-remoting-commits at lists.jboss.org Sat Apr 11 22:09:48 2009 Content-Type: multipart/mixed; boundary="===============5820504028413657750==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4970 - remoting2/branches/2.2/docs/guide/en. Date: Sat, 11 Apr 2009 22:09:48 -0400 Message-ID: --===============5820504028413657750== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-11 22:09:48 -0400 (Sat, 11 Apr 2009) New Revision: 4970 Modified: remoting2/branches/2.2/docs/guide/en/chap5.xml Log: JBREM-1099: Added bufferSize attribute for MulticastDetector. Modified: remoting2/branches/2.2/docs/guide/en/chap5.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.2/docs/guide/en/chap5.xml 2009-04-12 01:46:00 UTC = (rev 4969) +++ remoting2/branches/2.2/docs/guide/en/chap5.xml 2009-04-12 02:09:48 UTC = (rev 4970) @@ -801,6 +801,9 @@ Address - The IP of the multi= cast group that the detector will join. The default will be that of the DefaultIP if not explicitly set. + = + BufferSize - The size of the = buffer used + by the MulticastSocket. The default is 10000. = If any of these are set programmatically, need to be done before= the detector is started (otherwise will use default values). --===============5820504028413657750==-- From jboss-remoting-commits at lists.jboss.org Sat Apr 11 22:16:29 2009 Content-Type: multipart/mixed; boundary="===============4788283566400792475==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4971 - remoting2/branches/2.x/docs/guide/en. Date: Sat, 11 Apr 2009 22:16:28 -0400 Message-ID: --===============4788283566400792475== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-11 22:16:28 -0400 (Sat, 11 Apr 2009) New Revision: 4971 Modified: remoting2/branches/2.x/docs/guide/en/chap5.xml Log: JBREM-1099: Added "bufferSize" attribute for MulticastDetector; JBREM-1046:= Added "unmarshalNullStream" for HTTPClientInvoker. Modified: remoting2/branches/2.x/docs/guide/en/chap5.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/docs/guide/en/chap5.xml 2009-04-12 02:09:48 UTC = (rev 4970) +++ remoting2/branches/2.x/docs/guide/en/chap5.xml 2009-04-12 02:16:28 UTC = (rev 4971) @@ -900,6 +900,9 @@ Address - The IP of the multi= cast group that the detector will join. The default will be that of the DefaultIP if not explicitly set. + = + BufferSize - The size of the = buffer used + by the MulticastSocket. The default is 10000. = If any of these are set programmatically, need to be done before= the detector is started (otherwise will use default values). @@ -6266,12 +6269,18 @@ =
org.jboss.remoting.transport.http.HTTPClientInvoker - + = NUMBER_OF_CALL_ATTEMPTS = (actual value is "numberOfCallAttempts"): This parameter is relevant only = on the client side, where it determines the maximum number of attempts th= at will be made to complete an invocation. The default value is 1. = + UNMARSHAL_NULL_STREAM (ac= tual value + is "unmarshalNullStream") - key indicating if + org.jboss.remoting.transport.http.HTTPClientInvoker + should make the call to UnMarshaller.read() when + the InputStream is null. The default value = is + "true".
=
--===============4788283566400792475==-- From jboss-remoting-commits at lists.jboss.org Sun Apr 12 01:33:54 2009 Content-Type: multipart/mixed; boundary="===============8737415494227945345==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4972 - remoting2/branches/2.x/src/main/org/jboss/remoting. Date: Sun, 12 Apr 2009 01:33:53 -0400 Message-ID: --===============8737415494227945345== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-12 01:33:53 -0400 (Sun, 12 Apr 2009) New Revision: 4972 Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/LeasePinger.java Log: JBREM-1111: Wrapped timer.schedule() in try/catch in case Timer has shut it= self down and needs to be recreated. Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/LeasePinger.ja= va =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/LeasePinger.java 200= 9-04-12 02:16:28 UTC (rev 4971) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/LeasePinger.java 200= 9-04-12 05:33:53 UTC (rev 4972) @@ -96,7 +96,17 @@ if(trace) { log.trace(this + " starting lease timer with ping period= of " + pingPeriod); } = timerTask =3D new LeaseTimerTask(this); - timer.schedule(timerTask, pingPeriod, pingPeriod); + + try + { + timer.schedule(timerTask, pingPeriod, pingPeriod); + } + catch (IllegalStateException e) + { + log.debug("Unable to schedule TimerTask on existing Timer", e); + timer =3D new Timer(true); + timer.schedule(timerTask, pingPeriod, pingPeriod); + } } = public void stopPing() --===============8737415494227945345==-- From jboss-remoting-commits at lists.jboss.org Sun Apr 12 01:37:05 2009 Content-Type: multipart/mixed; boundary="===============1840019920311106447==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4973 - remoting2/branches/2.2/src/main/org/jboss/remoting. Date: Sun, 12 Apr 2009 01:37:01 -0400 Message-ID: --===============1840019920311106447== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-12 01:37:01 -0400 (Sun, 12 Apr 2009) New Revision: 4973 Modified: remoting2/branches/2.2/src/main/org/jboss/remoting/LeasePinger.java Log: JBREM-1111: Wrapped timer.schedule() in try/catch in case Timer has shut it= self down and needs to be recreated. Modified: remoting2/branches/2.2/src/main/org/jboss/remoting/LeasePinger.ja= va =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.2/src/main/org/jboss/remoting/LeasePinger.java 200= 9-04-12 05:33:53 UTC (rev 4972) +++ remoting2/branches/2.2/src/main/org/jboss/remoting/LeasePinger.java 200= 9-04-12 05:37:01 UTC (rev 4973) @@ -62,7 +62,17 @@ if(trace) { log.trace(this + " starting lease timer with ping period= of " + pingPeriod); } = timerTask =3D new LeaseTimerTask(this); - timer.schedule(timerTask, pingPeriod, pingPeriod); + + try + { + timer.schedule(timerTask, pingPeriod, pingPeriod); + } + catch (IllegalStateException e) + { + log.debug("Unable to schedule TimerTask on existing Timer", e); + timer =3D new Timer(true); + timer.schedule(timerTask, pingPeriod, pingPeriod); + } } = public void stopPing() --===============1840019920311106447==-- From jboss-remoting-commits at lists.jboss.org Sun Apr 12 03:22:16 2009 Content-Type: multipart/mixed; boundary="===============7367827585201131453==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4974 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket. Date: Sun, 12 Apr 2009 03:22:16 -0400 Message-ID: --===============7367827585201131453== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-12 03:22:16 -0400 (Sun, 12 Apr 2009) New Revision: 4974 Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/Sock= etServerInvoker.java Log: JBREM-1076: If loop in processInvocation() ends with running =3D=3D false, = returns immediately. Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/sock= et/SocketServerInvoker.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/Soc= ketServerInvoker.java 2009-04-12 05:37:01 UTC (rev 4973) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/Soc= ketServerInvoker.java 2009-04-12 07:22:16 UTC (rev 4974) @@ -753,6 +753,10 @@ } } = + if (!running) + { + return; + } clientpool.insert(worker, worker); } = --===============7367827585201131453==-- From jboss-remoting-commits at lists.jboss.org Sun Apr 12 03:24:19 2009 Content-Type: multipart/mixed; boundary="===============4490163330480151827==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4975 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/socket/shutdown. Date: Sun, 12 Apr 2009 03:24:18 -0400 Message-ID: --===============4490163330480151827== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-12 03:24:18 -0400 (Sun, 12 Apr 2009) New Revision: 4975 Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/socke= t/shutdown/ProcessInvocationShutdownTestCase.java Log: JBREM-1076: New unit test. Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/s= ocket/shutdown/ProcessInvocationShutdownTestCase.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/sock= et/shutdown/ProcessInvocationShutdownTestCase.java = (rev 0) +++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/sock= et/shutdown/ProcessInvocationShutdownTestCase.java 2009-04-12 07:24:18 UTC = (rev 4975) @@ -0,0 +1,241 @@ +/* +* JBoss, Home of Professional Open Source +* Copyright 2009, JBoss Inc., and individual contributors as indicated +* by the @authors tag. See the copyright.txt in the distribution for a +* full listing of individual contributors. +* +* This is free software; you can redistribute it and/or modify it +* under the terms of the GNU Lesser General Public License as +* published by the Free Software Foundation; either version 2.1 of +* the License, or (at your option) any later version. +* +* This software is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this software; if not, write to the Free +* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA +* 02110-1301 USA, or see the FSF site: http://www.fsf.org. +*/ +package org.jboss.test.remoting.transport.socket.shutdown; + +import java.io.IOException; +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.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.InvokerCallbackHandler; +import org.jboss.remoting.transport.Connector; +import org.jboss.remoting.transport.PortUtil; +import org.jboss.remoting.transport.ServerFactory; +import org.jboss.remoting.transport.socket.LRUPool; +import org.jboss.remoting.transport.socket.SocketServerInvoker; +import org.jboss.remoting.transport.socket.TransportClientFactory; + + +/** + * Unit test for JBREM-1076. + * = + * @author Ron Sigal + * @version $Rev$ + *

+ * Copyright Apr 12, 2009 + *

+ */ +public class ProcessInvocationShutdownTestCase extends TestCase +{ + private static Logger log =3D Logger.getLogger(ProcessInvocationShutdow= nTestCase.class); + = + private static boolean firstTime =3D true; + = + protected String host; + protected int port; + protected String locatorURI; + protected InvokerLocator serverLocator; + protected Connector connector; + protected TestInvocationHandler invocationHandler; + protected SocketServerInvoker socketServerInvoker; + + = + public void setUp() throws Exception + { + if (firstTime) + { + firstTime =3D false; + Logger.getLogger("org.jboss.remoting").setLevel(Level.INFO); + Logger.getLogger("org.jboss.test.remoting").setLevel(Level.INFO); + String pattern =3D "[%d{ABSOLUTE}] [%t] %5p (%F:%L) - %m%n"; + PatternLayout layout =3D new PatternLayout(pattern); + ConsoleAppender consoleAppender =3D new ConsoleAppender(layout); + Logger.getRootLogger().addAppender(consoleAppender); = + } + } + + = + public void tearDown() + { + } + = + = + public void testShutdown() throws Throwable + { + log.info("entering " + getName()); + = + // Start server. + setupServer(); + assertTrue(connector.getServerInvoker() instanceof TestServerInvoker= ); + log.info("using a TestServerInvoker"); + = + // Create client. + InvokerLocator clientLocator =3D new InvokerLocator(locatorURI); + HashMap clientConfig =3D new HashMap(); + clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); + addExtraClientConfig(clientConfig); + final Client client =3D new Client(clientLocator, clientConfig); + client.connect(); + log.info("client is connected"); + = + // Start SocketServerInvoker.processInvocation(). + new Thread() + { + public void run() + { + try + { + client.invoke("abc"); + } + catch (Throwable e) + { + e.printStackTrace(); + } + } + }.start(); + = + Thread.sleep(4000); + shutdownServer(); + Thread.sleep(4000); + assertFalse(TestLRUPool.called); + log.info(getName() + " PASSES"); + } + = + = + protected String getTransport() + { + return "test"; + } + = + = + protected void addExtraClientConfig(Map config) {} + protected void addExtraServerConfig(Map config) {} + = + + protected void setupServer() throws Exception + { + InvokerRegistry.registerInvokerFactories(getTransport(), TransportCl= ientFactory.class, TestTransportServerFactory.class); + host =3D InetAddress.getLocalHost().getHostAddress(); + port =3D PortUtil.findFreePort(host); + locatorURI =3D getTransport() + "://" + host + ":" + port; + String metadata =3D System.getProperty("remoting.metadata"); + if (metadata !=3D null) + { + locatorURI +=3D "/?" + metadata; + } + serverLocator =3D new InvokerLocator(locatorURI); + log.info("Starting remoting server with locator uri of: " + locatorU= RI); + HashMap config =3D new HashMap(); + config.put(InvokerLocator.FORCE_REMOTE, "true"); + addExtraServerConfig(config); + connector =3D new Connector(serverLocator, config); + connector.create(); + invocationHandler =3D new TestInvocationHandler(); + connector.addInvocationHandler("test", invocationHandler); + connector.start(); + socketServerInvoker =3D (SocketServerInvoker) connector.getServerInv= oker(); + socketServerInvoker.setMaxPoolSize(0); + } + = + = + protected void shutdownServer() throws Exception + { + if (connector !=3D null) + connector.stop(); + } + = + = + static class TestInvocationHandler implements ServerInvocationHandler + { + public void addListener(InvokerCallbackHandler callbackHandler) {} + public Object invoke(final InvocationRequest invocation) throws Thro= wable + { + return invocation.getParameter(); + } + public void removeListener(InvokerCallbackHandler callbackHandler) {} + public void setMBeanServer(MBeanServer server) {} + public void setInvoker(ServerInvoker invoker) {} + } + + static class TestLRUPool extends LRUPool + { + static public boolean called; + = + public TestLRUPool(int min, int max) + { + super(min, max); + } = + public void insert(Object key, Object o) + { + log.info(this + ".insert() called"); + called =3D true; + } + } + = + static class TestServerInvoker extends SocketServerInvoker + { + public TestServerInvoker(InvokerLocator locator, Map configuration) + { + super(locator, configuration); + } + public TestServerInvoker(InvokerLocator locator) + { + super(locator); + } + public synchronized void start() throws IOException + { + super.start(); + clientpool =3D new TestLRUPool(2, maxPoolSize); + clientpool.create(); = + } + } + = + static public class TestTransportServerFactory implements ServerFactory + { + public boolean called; + = + public ServerInvoker createServerInvoker(InvokerLocator locator, Map= config) + { + called =3D true; + log.info(this + ".createServerInvoker() called"); + return new TestServerInvoker(locator, config); + } + public boolean supportsSSL() + { + return false; + } + } +} \ No newline at end of file --===============4490163330480151827==-- From jboss-remoting-commits at lists.jboss.org Sun Apr 12 21:39:56 2009 Content-Type: multipart/mixed; boundary="===============7669771384025851173==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4976 - remoting2/branches/2.x/src/main/org/jboss/remoting. Date: Sun, 12 Apr 2009 21:39:51 -0400 Message-ID: --===============7669771384025851173== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-12 21:39:51 -0400 (Sun, 12 Apr 2009) New Revision: 4976 Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/Client.java Log: JBREM-1083: (1) Made invokerDestructionTimer and invokerDestructionTimerLoc= k static; (2) made invoker reference in InvokerDesctructionTimerTask a Weak= Reference. Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/Client.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/Client.java 2009-04-= 12 07:24:18 UTC (rev 4975) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/Client.java 2009-04-= 13 01:39:51 UTC (rev 4976) @@ -51,6 +51,7 @@ import java.io.ObjectInput; import java.io.ObjectOutput; import java.io.StreamCorruptedException; +import java.lang.ref.WeakReference; import java.net.InetAddress; import java.net.SocketTimeoutException; import java.rmi.MarshalException; @@ -172,6 +173,9 @@ private static final Logger log =3D Logger.getLogger(Client.class); = private static final long serialVersionUID =3D 5679279425009837934L; + = + private static Timer invokerDestructionTimer; + private static Object invokerDestructionTimerLock =3D new Object(); = // Static -------------------------------------------------------------= -------------------------- = @@ -205,8 +209,6 @@ private boolean connected =3D false; = private int invokerDestructionDelay =3D 0; - private Timer invokerDestructionTimer; - private Object invokerDestructionTimerLock =3D new Object(); = // Constructors -------------------------------------------------------= -------------------------- = @@ -1843,17 +1845,20 @@ // Inner classes ------------------------------------------------------= -------------------------- class InvokerDestructionTimerTask extends TimerTask { - private ClientInvoker invoker; + private WeakReference ref; = public InvokerDestructionTimerTask(ClientInvoker invoker) { - this.invoker =3D invoker; + ref =3D new WeakReference(invoker); } = public void run() { - log.trace("calling InvokerRegistry.destroyClientInvoker() for " += invoker); + ClientInvoker invoker =3D (ClientInvoker) ref.get(); + log.trace(this + " calling InvokerRegistry.destroyClientInvoker()= for " + invoker); InvokerRegistry.destroyClientInvoker(invoker.getLocator(), config= uration); + ref.clear(); + ref =3D null; } } } --===============7669771384025851173==-- From jboss-remoting-commits at lists.jboss.org Sun Apr 12 21:49:39 2009 Content-Type: multipart/mixed; boundary="===============3954137892273649935==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4977 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/invoker. Date: Sun, 12 Apr 2009 21:49:39 -0400 Message-ID: --===============3954137892273649935== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-12 21:49:38 -0400 (Sun, 12 Apr 2009) New Revision: 4977 Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/invoker/ClientI= nvokerDelayedDestructionTestCase.java Log: JBREM-1083: Added testStaticTimer(). Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/invoker/= ClientInvokerDelayedDestructionTestCase.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/invoker/Client= InvokerDelayedDestructionTestCase.java 2009-04-13 01:39:51 UTC (rev 4976) +++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/invoker/Client= InvokerDelayedDestructionTestCase.java 2009-04-13 01:49:38 UTC (rev 4977) @@ -21,9 +21,11 @@ */ package org.jboss.test.remoting.invoker; = +import java.lang.reflect.Field; import java.net.InetAddress; import java.util.HashMap; import java.util.Map; +import java.util.Timer; = import javax.management.MBeanServer; = @@ -33,7 +35,6 @@ 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; @@ -76,7 +77,7 @@ if (firstTime) { firstTime =3D false; - Logger.getLogger("org.jboss.remoting").setLevel(XLevel.INFO); + Logger.getLogger("org.jboss.remoting").setLevel(Level.INFO); Logger.getLogger("org.jboss.test.remoting").setLevel(Level.INFO); String pattern =3D "[%d{ABSOLUTE}] [%t] %5p (%F:%L) - %m%n"; PatternLayout layout =3D new PatternLayout(pattern); @@ -262,6 +263,49 @@ } = = + public void testStaticTimer() throws Throwable + { + log.info("entering " + getName()); + = + // Start server. + setupServer(); + = + = + // Get static Timer. + Field field =3D Client.class.getDeclaredField("invokerDestructionTim= er"); + field.setAccessible(true); + Timer invokerDestructionTimer =3D (Timer) field.get(null); + = + // Create client. + InvokerLocator clientLocator =3D new InvokerLocator(locatorURI); + HashMap clientConfig =3D new HashMap(); + clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); + clientConfig.put(Client.INVOKER_DESTRUCTION_DELAY, "5000"); + addExtraClientConfig(clientConfig); + Client[] clients =3D new Client[50]; + + for (int i =3D 0; i < 50; i++) + { + clients[i] =3D new Client(clientLocator, clientConfig); + clients[i].connect(); + assertEquals("abc", clients[i].invoke("abc")); + clients[i].disconnect(); + } + = + // Verify all Clients are using the same Timer. + for (int i =3D 0; i < 50; i++) + { + assertEquals("Should be the same Timer", invokerDestructionTimer,= field.get(clients[i])); + } + = + Thread.sleep(10000); + assertEquals(0, InvokerRegistry.getClientInvokers().length); + + shutdownServer(); + log.info(getName() + " PASSES"); + } + = + = protected String getTransport() { return "socket"; --===============3954137892273649935==-- From jboss-remoting-commits at lists.jboss.org Sun Apr 12 23:47:59 2009 Content-Type: multipart/mixed; boundary="===============3759754770238199173==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4978 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/datatype. Date: Sun, 12 Apr 2009 23:47:59 -0400 Message-ID: --===============3759754770238199173== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-12 23:47:59 -0400 (Sun, 12 Apr 2009) New Revision: 4978 Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/datatype/DataTy= peRaceTestCase.java Log: JBREM-1109: Reduced number of threads to 1000 to avoid "java.lang.OutOfMemo= ryError: unable to create new native thread". Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/datatype= /DataTypeRaceTestCase.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/datatype/DataT= ypeRaceTestCase.java 2009-04-13 01:49:38 UTC (rev 4977) +++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/datatype/DataT= ypeRaceTestCase.java 2009-04-13 03:47:59 UTC (rev 4978) @@ -111,7 +111,7 @@ // Test datatype race. MicroRemoteClientInvoker clientInvoker =3D (MicroRemoteClientInvoker= ) client.getInvoker(); = - int THREADS =3D 2000; + int THREADS =3D 1000; TestThread[] threads =3D new TestThread[THREADS]; Rendezvous startBarrier =3D new Rendezvous(THREADS); Rendezvous stopBarrier =3D new Rendezvous(THREADS + 1); --===============3759754770238199173==-- From jboss-remoting-commits at lists.jboss.org Sun Apr 12 23:50:22 2009 Content-Type: multipart/mixed; boundary="===============4469712482188387530==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4979 - remoting2/branches/2.2/src/tests/org/jboss/test/remoting/datatype. Date: Sun, 12 Apr 2009 23:50:22 -0400 Message-ID: --===============4469712482188387530== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-12 23:50:21 -0400 (Sun, 12 Apr 2009) New Revision: 4979 Modified: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/datatype/DataTy= peRaceTestCase.java Log: JBREM-1109: Reduced number of threads to 1000 to avoid "java.lang.OutOfMemo= ryError: unable to create new native thread". Modified: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/datatype= /DataTypeRaceTestCase.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/datatype/DataT= ypeRaceTestCase.java 2009-04-13 03:47:59 UTC (rev 4978) +++ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/datatype/DataT= ypeRaceTestCase.java 2009-04-13 03:50:21 UTC (rev 4979) @@ -111,7 +111,7 @@ // Test datatype race. MicroRemoteClientInvoker clientInvoker =3D (MicroRemoteClientInvoker= ) client.getInvoker(); = - int THREADS =3D 2000; + int THREADS =3D 1000; TestThread[] threads =3D new TestThread[THREADS]; Rendezvous startBarrier =3D new Rendezvous(THREADS); Rendezvous stopBarrier =3D new Rendezvous(THREADS + 1); --===============4469712482188387530==-- From jboss-remoting-commits at lists.jboss.org Mon Apr 13 02:23:57 2009 Content-Type: multipart/mixed; boundary="===============3997594461979462440==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4980 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport/servlet. Date: Mon, 13 Apr 2009 02:23:57 -0400 Message-ID: --===============3997594461979462440== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-13 02:23:56 -0400 (Mon, 13 Apr 2009) New Revision: 4980 Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/servlet/Ser= vletServerInvoker.java Log: JBREM-1114: (1) Added "unwrapSingletonArray" parameter; (2) creates new Inv= ocationRequest if request body is null. Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/serv= let/ServletServerInvoker.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/servlet/Se= rvletServerInvoker.java 2009-04-13 03:50:21 UTC (rev 4979) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/servlet/Se= rvletServerInvoker.java 2009-04-13 06:23:56 UTC (rev 4980) @@ -48,10 +48,6 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.net.InetAddress; -import java.net.UnknownHostException; -import java.security.AccessController; -import java.security.PrivilegedActionException; -import java.security.PrivilegedExceptionAction; import java.util.Enumeration; import java.util.HashMap; import java.util.Map; @@ -66,22 +62,47 @@ */ public class ServletServerInvoker extends WebServerInvoker implements Serv= letServerInvokerMBean { + public static final String UNWRAP_SINGLETON_ARRAYS =3D "unwrapSingleton= Arrays"; + = private static final Logger log =3D Logger.getLogger(ServletServerInvok= er.class); + = + private boolean unwrapSingletonArrays; = public ServletServerInvoker(InvokerLocator locator) { super(locator); + init(); } = public ServletServerInvoker(InvokerLocator locator, Map configuration) { super(locator, configuration); + init(); } = protected String getDefaultDataType() { return HTTPMarshaller.DATATYPE; } + = + protected void init() + { + Object val =3D configuration.get(UNWRAP_SINGLETON_ARRAYS); + if (val !=3D null) + { + try + { + unwrapSingletonArrays =3D Boolean.valueOf((String)val).boolean= Value(); + log.debug(this + " setting unwrapSingletonArrays to " + unwrap= SingletonArrays); + } + catch (Exception e) + { + log.warn(this + " could not convert " + = + UNWRAP_SINGLETON_ARRAYS + " value of " + + val + " to a boolean value."); + } + } + } = public void processRequest(HttpServletRequest request, HttpServletRespo= nse response) throws ServletException, IOException { @@ -97,8 +118,37 @@ } = Map urlParams =3D request.getParameterMap(); - metadata.putAll(urlParams); + if (unwrapSingletonArrays) + { + Iterator it =3D urlParams.keySet().iterator(); + while (it.hasNext()) + { + Object key =3D it.next(); + Object value =3D urlParams.get(key); + String[] valueArray =3D (String[]) value; + if (valueArray.length =3D=3D 1) + { + value =3D valueArray[0]; + } + metadata.put(key, value); + } + } + else + { + metadata.putAll(urlParams); + } = + if(log.isTraceEnabled()) + { + log.trace("metadata:"); + Iterator it =3D metadata.keySet().iterator(); + while (it.hasNext()) + { + Object key =3D it.next(); + log.trace(" " + key + ": " + metadata.get(key)); + } + } + = // UnMarshaller may not be an HTTPUnMarshaller, in which case it // can ignore this parameter. Object o =3D configuration.get(HTTPUnMarshaller.PRESERVE_LINES); @@ -222,7 +272,25 @@ } = Map urlParams =3D request.getParameterMap(); - metadata.putAll(urlParams); + if (unwrapSingletonArrays) + { + Iterator it =3D urlParams.keySet().iterator(); + while (it.hasNext()) + { + Object key =3D it.next(); + Object value =3D urlParams.get(key); + String[] valueArray =3D (String[]) value; + if (valueArray.length =3D=3D 1) + { + value =3D valueArray[0]; + } + metadata.put(key, value); + } + } + else + { + metadata.putAll(urlParams); + } = metadata.put(HTTPMetadataConstants.METHODTYPE, request.getMethod()); = @@ -250,43 +318,50 @@ = try { + InvocationRequest invocationRequest =3D null; Object responseObject =3D null; - - ServletInputStream inputStream =3D request.getInputStream(); - UnMarshaller unmarshaller =3D getUnMarshaller(); - Object obj =3D null; - if (unmarshaller instanceof VersionedUnMarshaller) - obj =3D ((VersionedUnMarshaller)unmarshaller).read(new ByteArr= ayInputStream(requestByte), metadata, getVersion()); - else - obj =3D unmarshaller.read(new ByteArrayInputStream(requestByte= ), metadata); - inputStream.close(); - boolean isError =3D false; - InvocationRequest invocationRequest =3D null; = - if(obj instanceof InvocationRequest) + String method =3D request.getMethod(); + if (method.equals("GET") || method.equals("HEAD") || (method.equa= ls("OPTIONS") && request.getContentLength() <=3D 0)) { - invocationRequest =3D (InvocationRequest) obj; - = - Map requestMap =3D invocationRequest.getRequestPayload(); - if (requestMap =3D=3D null) - { - invocationRequest.setRequestPayload(metadata); - } - else - { - requestMap.putAll(metadata); - } + invocationRequest =3D createNewInvocationRequest(metadata, nul= l); } else { - if(WebUtil.isBinary(requestContentType)) + ServletInputStream inputStream =3D request.getInputStream(); + UnMarshaller unmarshaller =3D getUnMarshaller(); + Object obj =3D null; + if (unmarshaller instanceof VersionedUnMarshaller) + obj =3D ((VersionedUnMarshaller)unmarshaller).read(new Byte= ArrayInputStream(requestByte), metadata, getVersion()); + else + obj =3D unmarshaller.read(new ByteArrayInputStream(requestB= yte), metadata); + inputStream.close(); + + if(obj instanceof InvocationRequest) { - invocationRequest =3D getInvocationRequest(metadata, obj); + invocationRequest =3D (InvocationRequest) obj; + + Map requestMap =3D invocationRequest.getRequestPayload(); + if (requestMap =3D=3D null) + { + invocationRequest.setRequestPayload(metadata); + } + else + { + requestMap.putAll(metadata); + } } else { - invocationRequest =3D createNewInvocationRequest(metadata, = obj); + if(WebUtil.isBinary(requestContentType)) + { + invocationRequest =3D getInvocationRequest(metadata, obj= ); + } + else + { + invocationRequest =3D createNewInvocationRequest(metadat= a, obj); + } } } = --===============3997594461979462440==-- From jboss-remoting-commits at lists.jboss.org Mon Apr 13 02:24:32 2009 Content-Type: multipart/mixed; boundary="===============5122290177706366925==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4981 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport/servlet/web. Date: Mon, 13 Apr 2009 02:24:32 -0400 Message-ID: --===============5122290177706366925== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-13 02:24:32 -0400 (Mon, 13 Apr 2009) New Revision: 4981 Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/servlet/web= /ServerInvokerServlet.java Log: JBREM-1114: Added some logging. Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/serv= let/web/ServerInvokerServlet.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/servlet/we= b/ServerInvokerServlet.java 2009-04-13 06:23:56 UTC (rev 4980) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/servlet/we= b/ServerInvokerServlet.java 2009-04-13 06:24:32 UTC (rev 4981) @@ -75,7 +75,15 @@ { throw new ServletException("Could not find init parameter for = 'locatorUrl' or 'locatorName' - one of which must be supplied for ServerInv= okerServlet to function."); } + else + { + log.debug("Got ServletServerInvoker from InvokerName: " + conf= ig.getInitParameter("invokerName")); + } } + else + { + log.debug("Got ServletServerInvoker from InvokerLocator: " + conf= ig.getInitParameter("locatorUrl")); + } } = /** --===============5122290177706366925==-- From jboss-remoting-commits at lists.jboss.org Mon Apr 13 02:49:47 2009 Content-Type: multipart/mixed; boundary="===============4574751920893515459==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4982 - remoting2/branches/2.x/docs/guide/en. Date: Mon, 13 Apr 2009 02:49:46 -0400 Message-ID: --===============4574751920893515459== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-13 02:49:46 -0400 (Mon, 13 Apr 2009) New Revision: 4982 Modified: remoting2/branches/2.x/docs/guide/en/chap5.xml Log: JBREM-1114: Added description of "unwrapSingletonArray" parameter. Modified: remoting2/branches/2.x/docs/guide/en/chap5.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/docs/guide/en/chap5.xml 2009-04-13 06:24:32 UTC = (rev 4981) +++ remoting2/branches/2.x/docs/guide/en/chap5.xml 2009-04-13 06:49:46 UTC = (rev 4982) @@ -2065,6 +2065,14 @@ ServerInvokerServlet will still use "jboss" a= s the default domain. = +
+ Configuration + = + unwrapSingletonArrays - I= f the map + returned by javax.servlet.http.HttpServletRequest.getP= arameterMap() + maps a String key to an array of length one, the value in the arra= y will be extracted + and associated with the key. +
=
@@ -6444,6 +6452,16 @@
=
+ org.jboss.remoting.transport.servlet.ServletServerInvoker</titl= e> + + <para><emphasis role=3D"bold">UNWRAP_SINGLETON_ARRAYS</emphasis> (actu= al value + is 'unwrapSingletonArrays') - If the map returned by + <methodname>javax.servlet.http.HttpServletRequest.getParameterMap()</m= ethodname> + maps a String key to an array of length one, the value in the array wi= ll be + extracted and associated with the key.</para> + </section> = + = + <section> <title>org.jboss.remoting.transport.socket.MicroSocketClientInvoker</t= itle> = <para><emphasis role=3D"bold">TCP_NODELAY_FLAG</emphasis> (actual valu= e is --===============4574751920893515459==-- From jboss-remoting-commits at lists.jboss.org Mon Apr 13 06:29:48 2009 Content-Type: multipart/mixed; boundary="===============1554388745830044270==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4983 - remoting2/branches/2.x/src/main/org/jboss/remoting. Date: Mon, 13 Apr 2009 06:29:48 -0400 Message-ID: <E1LtJQC-0002SQ-56@committer01.frg.pub.inap.atl.jboss.com> --===============1554388745830044270== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-13 06:29:47 -0400 (Mon, 13 Apr 2009) New Revision: 4983 Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/ConnectionNotifier.ja= va Log: JBREM-1113: Use copies of lists to avoid ConcurrentModificationException. Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/ConnectionNoti= fier.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/ConnectionNotifier.j= ava 2009-04-13 06:49:46 UTC (rev 4982) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/ConnectionNotifier.j= ava 2009-04-13 10:29:47 UTC (rev 4983) @@ -47,14 +47,17 @@ Client client =3D new Client(new InvokerLocator(locatorurl), requ= estPayload); client.setSessionId(clientSessionId); = + ArrayList localListeners =3D null; synchronized (listeners) { - Iterator it =3D listeners.iterator(); - while (it.hasNext()) - { - ((ConnectionListener) it.next()).handleConnectionException(= null, client); - } + localListeners =3D new ArrayList(listeners); } + = + Iterator it =3D localListeners.iterator(); + while (it.hasNext()) + { + ((ConnectionListener) it.next()).handleConnectionException(nul= l, client); + } } catch(Exception e) { @@ -74,14 +77,17 @@ client.setSessionId(clientSessionId); ClientDisconnectedException ex =3D new ClientDisconnectedExceptio= n(); = + ArrayList localListeners =3D null; synchronized (listeners) { - Iterator it =3D listeners.iterator(); - while (it.hasNext()) - { - ((ConnectionListener) it.next()).handleConnectionException(= ex, client); - } + localListeners =3D new ArrayList(listeners); } + = + Iterator it =3D localListeners.iterator(); + while (it.hasNext()) + { + ((ConnectionListener) it.next()).handleConnectionException(ex,= client); + } } catch(Exception e) { --===============1554388745830044270==-- From jboss-remoting-commits at lists.jboss.org Mon Apr 13 06:31:35 2009 Content-Type: multipart/mixed; boundary="===============8714193765507815904==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4984 - remoting2/branches/2.x/src/main/org/jboss/remoting. Date: Mon, 13 Apr 2009 06:31:34 -0400 Message-ID: <E1LtJRu-0003tE-PT@committer01.frg.pub.inap.atl.jboss.com> --===============8714193765507815904== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-13 06:31:34 -0400 (Mon, 13 Apr 2009) New Revision: 4984 Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/ServerInvoker.java Log: JBREM-1113: (1) Made removeCallbackHandler() public; (2) added shutdownCall= backHandler(). Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/ServerInvoker.= java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/ServerInvoker.java 2= 009-04-13 10:29:47 UTC (rev 4983) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/ServerInvoker.java 2= 009-04-13 10:31:34 UTC (rev 4984) @@ -867,28 +867,7 @@ //then it will just use that without having to do a lookup or = HashMap iteration over //values = - ServerInvocationHandler handler =3D null; - = - if (singleHandler !=3D null) - { - handler =3D singleHandler; - } - else - { = - if (subsystem !=3D null) - { - handler =3D (ServerInvocationHandler)handlers.get(subsys= tem.toUpperCase()); - } - else - { - // subsystem not specified, so will hope for a default o= ne being set - if (!handlers.isEmpty()) - { - if (trace) { log.trace(this + " handling invocation w= ith no subsystem explicitely specified, using the default handler"); } - handler =3D (ServerInvocationHandler)handlers.values(= ).iterator().next(); - } - } - } + ServerInvocationHandler handler =3D findInvocationHandler(subs= ystem); = if (param instanceof InternalInvocation) { @@ -1664,6 +1643,10 @@ if (registerCallbackListeners) { connectionNotifier.addListenerFirst(callbackHandler); + if(leasePeriod > 0) + { + leaseManagement =3D true; + } } handler.addListener(callbackHandler); } @@ -1672,6 +1655,14 @@ ServerInvokerCallbackHandler callbackHandler =3D removeCallbackHa= ndler(invocation); if(callbackHandler !=3D null) { + if (registerCallbackListeners) + { +// connectionNotifier.removeListener(callbackHandler); + removeConnectionListener(callbackHandler); + } + = + callbackHandler.destroy(); + = if(handler =3D=3D null) { throw new InvalidConfigurationException( @@ -1679,15 +1670,10 @@ "registered. Please add via xml configuration or via th= e Connector's " + "addInvocationHandler() method."); } - if (registerCallbackListeners) - { - connectionNotifier.removeListener(callbackHandler); - } + = handler.removeListener(callbackHandler); = if(trace) { log.trace("ServerInvoker (" + this + ") removing s= erver callback handler " + callbackHandler + "."); } - - callbackHandler.destroy(); } else { @@ -1815,7 +1801,34 @@ } return result; } + = + protected ServerInvocationHandler findInvocationHandler(String subsyste= m) + { + ServerInvocationHandler handler =3D null; = + if (singleHandler !=3D null) + { + handler =3D singleHandler; + } + else + { = + if (subsystem !=3D null) + { + handler =3D (ServerInvocationHandler)handlers.get(subsystem.to= UpperCase()); + } + else + { + // subsystem not specified, so will hope for a default one bei= ng set + if (!handlers.isEmpty()) + { + if (trace) { log.trace(this + " handling invocation with no= subsystem explicitely specified, using the default handler"); } + handler =3D (ServerInvocationHandler)handlers.values().iter= ator().next(); + } + } + } + return handler; + } + = /** * Called prior to an invocation. * TODO is sending in the arg appropriate? @@ -2049,7 +2062,7 @@ return callbackHandler; } = - private ServerInvokerCallbackHandler removeCallbackHandler(InvocationRe= quest invocation) + public ServerInvokerCallbackHandler removeCallbackHandler(InvocationReq= uest invocation) { String id =3D ServerInvokerCallbackHandler.getId(invocation); ServerInvokerCallbackHandler callbackHandler =3D null; @@ -2060,6 +2073,25 @@ } return callbackHandler; } + = + public void shutdownCallbackHandler(ServerInvokerCallbackHandler callba= ckHandler, InvocationRequest invocation) + { + removeCallbackHandler(invocation); + if (registerCallbackListeners) + { + removeConnectionListener(callbackHandler); + } + ServerInvocationHandler handler =3D findInvocationHandler(invocation= .getSessionId()); + if (handler !=3D null) + { + handler.removeListener(callbackHandler); + if(trace) { log.trace(this + " removing server callback handler "= + callbackHandler + "."); } + } + else + { + log.debug(this + " cannot remove " + callbackHandler + ": associa= ted ServerInvocationHandler not longer exists"); + } + } = // Inner classes ------------------------------------------------------= -------------------------- = --===============8714193765507815904==-- From jboss-remoting-commits at lists.jboss.org Mon Apr 13 06:32:33 2009 Content-Type: multipart/mixed; boundary="===============8869241488028637610==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4985 - remoting2/branches/2.x/src/main/org/jboss/remoting/callback. Date: Mon, 13 Apr 2009 06:32:32 -0400 Message-ID: <E1LtJSq-0003tP-6e@committer01.frg.pub.inap.atl.jboss.com> --===============8869241488028637610== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-13 06:32:31 -0400 (Mon, 13 Apr 2009) New Revision: 4985 Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/callback/ServerInvoke= rCallbackHandler.java Log: JBREM-1113: Added shutdown() method. Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/callback/Serve= rInvokerCallbackHandler.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/callback/ServerInvok= erCallbackHandler.java 2009-04-13 10:31:34 UTC (rev 4984) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/callback/ServerInvok= erCallbackHandler.java 2009-04-13 10:32:31 UTC (rev 4985) @@ -85,6 +85,7 @@ = private SerializableStore callbackStore =3D null; private CallbackErrorHandler callbackErrorHandler =3D null; + private ServerInvoker serverInvoker; = /** * The map key to use when looking up any callback store that @@ -170,6 +171,7 @@ = private void init(InvocationRequest invocation, ServerInvoker owner) th= rows Exception { + serverInvoker =3D owner; clientSessionId =3D invocation.getSessionId(); sessionId =3D invocation.getSessionId(); = @@ -1025,12 +1027,18 @@ } } = + public void shutdown() + { + serverInvoker.shutdownCallbackHandler(this, invocation); + destroy(); + log.debug(this + " shut down"); + } + = public void handleConnectionException(Throwable throwable, Client clien= t) { if (clientSessionId.equals(client.getSessionId())) { - destroy(); - log.debug(this + " shut down"); + shutdown(); } } = --===============8869241488028637610==-- From jboss-remoting-commits at lists.jboss.org Mon Apr 13 06:33:48 2009 Content-Type: multipart/mixed; boundary="===============6203905399594608048==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4986 - in remoting2/branches/2.x/src/tests/org/jboss/test/remoting/callback: leak and 1 other directory. Date: Mon, 13 Apr 2009 06:33:47 -0400 Message-ID: <E1LtJU3-0003tY-Nj@committer01.frg.pub.inap.atl.jboss.com> --===============6203905399594608048== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-13 06:33:46 -0400 (Mon, 13 Apr 2009) New Revision: 4986 Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/callback/leak/ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/callback/leak/S= erverInvokerCallbackHandlerLeakTestCase.java Log: JBREM-1113: New unit tests. Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/callback/le= ak/ServerInvokerCallbackHandlerLeakTestCase.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/callback/leak/= ServerInvokerCallbackHandlerLeakTestCase.java (rev = 0) +++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/callback/leak/= ServerInvokerCallbackHandlerLeakTestCase.java 2009-04-13 10:33:46 UTC (rev = 4986) @@ -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=3D"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 =3D Logger.getLogger(ServerInvokerCallbackHan= dlerLeakTestCase.class); + = + private static boolean firstTime =3D true; + private static int COUNT =3D 10; + private static Object lock =3D 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 =3D false; + Logger.getLogger("org.jboss.remoting").setLevel(Level.INFO); + Logger.getLogger("org.jboss.test.remoting").setLevel(Level.INFO); + String pattern =3D "[%d{ABSOLUTE}] [%t] %5p (%F:%L) - %m%n"; + PatternLayout layout =3D new PatternLayout(pattern); + ConsoleAppender consoleAppender =3D new ConsoleAppender(layout); + Logger.getRootLogger().addAppender(consoleAppender); = + } + TestConnectionListener.count =3D 0; + } + + = + public void tearDown() + { + } + = + = + public void testLeakWithCallbackHandlersListening() throws Throwable + { + doLeakTest(true); + } + = + = + public void testLeakWithoutCallbackHandlersListening() throws Throwable + { + doLeakTest(false); + } + = + = + public void doLeakTest(boolean registerCallbackListener) throws Throwab= le + { + log.info("entering " + getName()); + setupServer(registerCallbackListener); + = + // Get fields. + ServerInvoker serverInvoker =3D connector.getServerInvoker(); + Field field =3D ServerInvoker.class.getDeclaredField("connectionNoti= fier"); + field.setAccessible(true); + ConnectionNotifier connectionNotifier =3D (ConnectionNotifier) field= .get(serverInvoker); + field =3D ServerInvoker.class.getDeclaredField("callbackHandlers"); + field.setAccessible(true); + Map callbackHandlers =3D (Map) field.get(serverInvoker); + = + // Create client. + HashMap clientConfig =3D new HashMap(); + clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); + addExtraClientConfig(clientConfig); + Client client =3D null; + = + for (int i =3D 0; i < COUNT; i++) + { + client =3D 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 =3D new TestCallbackHandler(); + client.addListener(callbackHandler, null, null, true); + } + = + field =3D MicroRemoteClientInvoker.class.getDeclaredField("leasePing= er"); + field.setAccessible(true); + LeasePinger pinger =3D (LeasePinger) field.get(client.getInvoker()); + field =3D LeasePinger.class.getDeclaredField("timerTask"); + field.setAccessible(true); + TimerTask timerTask =3D (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 Exc= eption + { + host =3D InetAddress.getLocalHost().getHostAddress(); + port =3D PortUtil.findFreePort(host); + locatorURI =3D getTransport() + "://" + host + ":" + port; + locatorURI +=3D "/?leasing=3Dtrue"; + if (registerCallbackListener) + { + locatorURI +=3D "&" + ServerInvoker.REGISTER_CALLBACK_LISTENER + = "=3Dtrue"; + } + else + { + locatorURI +=3D "&" + ServerInvoker.REGISTER_CALLBACK_LISTENER + = "=3Dfalse"; + } + serverLocator =3D new InvokerLocator(locatorURI); + log.info("Starting remoting server with locator uri of: " + locatorU= RI); + HashMap config =3D new HashMap(); + config.put(InvokerLocator.FORCE_REMOTE, "true"); + addExtraServerConfig(config); + connector =3D new Connector(serverLocator, config); + connector.create(); + invocationHandler =3D new TestInvocationHandler(); + connector.addInvocationHandler("test", invocationHandler); + connector.start(); + connector.setLeasePeriod(2000); + TestConnectionListener listener =3D new TestConnectionListener(!regi= sterCallbackListener); + connector.addConnectionListener(listener); + } + = + = + protected void shutdownServer() throws Exception + { + if (connector !=3D null) + connector.stop(); + } + = + = + static class TestInvocationHandler implements ServerInvocationHandler + { + static public Set callbackHandlers =3D new HashSet(); + public void addListener(InvokerCallbackHandler callbackHandler) + { + callbackHandlers.add(callbackHandler); + } + public Object invoke(final InvocationRequest invocation) throws Thro= wable + { + 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 HandleCallbackE= xception + { + log.info("received callback"); + } = + } + = + = + static class TestConnectionListener implements ConnectionListener + { + static public int count; + boolean shutdownCallbackHandlers; + = + public TestConnectionListener(boolean shutdownCallbackHandlers) + { + this.shutdownCallbackHandlers =3D shutdownCallbackHandlers; + } + + public synchronized void handleConnectionException(Throwable throwab= le, Client client) + { + log.info("got connection exception"); + if(++count =3D=3D COUNT) + { + if (shutdownCallbackHandlers) + { + Iterator it =3D TestInvocationHandler.callbackHandlers.iter= ator(); + while (it.hasNext()) + { + ServerInvokerCallbackHandler callbackHandler =3D (Server= InvokerCallbackHandler) it.next(); + callbackHandler.shutdown(); + log.info("shut down: " + callbackHandler); + } + TestInvocationHandler.callbackHandlers.clear(); + } + synchronized(lock) + { + lock.notify(); + } + } + } = + } +} \ No newline at end of file --===============6203905399594608048==-- From jboss-remoting-commits at lists.jboss.org Tue Apr 14 01:01:04 2009 Content-Type: multipart/mixed; boundary="===============4083455518106773190==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4987 - in remoting2/branches/2.x/lib: jbossweb and 1 other directories. Date: Tue, 14 Apr 2009 01:01:03 -0400 Message-ID: <E1Ltalb-0004SM-G5@committer01.frg.pub.inap.atl.jboss.com> --===============4083455518106773190== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-14 01:01:03 -0400 (Tue, 14 Apr 2009) New Revision: 4987 Added: remoting2/branches/2.x/lib/trove/lib/README Modified: remoting2/branches/2.x/lib/jboss/README remoting2/branches/2.x/lib/jboss/jboss-common-core.jar remoting2/branches/2.x/lib/jboss/jboss-j2se.jar remoting2/branches/2.x/lib/jboss/jboss-jmx.jar remoting2/branches/2.x/lib/jboss/jboss-logging-log4j.jar remoting2/branches/2.x/lib/jboss/jnpserver.jar remoting2/branches/2.x/lib/jbossweb/README remoting2/branches/2.x/lib/jbossweb/jbossweb.jar Log: JBREM-1115: Updating jars to match AS 5.1.0.CR1. Modified: remoting2/branches/2.x/lib/jboss/README =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/lib/jboss/README 2009-04-13 10:33:46 UTC (rev 49= 86) +++ remoting2/branches/2.x/lib/jboss/README 2009-04-14 05:01:03 UTC (rev 49= 87) @@ -1,15 +1,15 @@ The jars included in this directory are from the JBossAS sub-projects and = are needed by JBossRemoting. -The files currently listed are from a build of jboss-as-parent from 11/19/= 08, shortly before the release of AS 5.0.0.GA. +The files currently listed match the versions on https://svn.jboss.org/rep= os/jbossas/branches/Branch_5_x on 4/13/09. = File Version From = ------- ------- ---- -jboss-common-core.jar 2.2.10.GA http://repository.jboss.com/ma= ven2/org/jboss/jboss-common-core/2.2.10.GA/ -jboss-j2se.jar 5.0.0.GA built from jboss-as-parent 11/= 19/08 -jboss-jmx.jar 5.0.0.GA built from jboss-as-parent 11/= 19/08 -jboss-logging-log4j.jar 2.0.5.GA http://repository.jboss.com/ma= ven2/org/jboss/logging/jboss-logging-log4j/2.0.5.GA/ +jboss-common-core.jar 2.2.12.GA http://repository.jboss.com/ma= ven2/org/jboss/jboss-common-core/2.2.12.GA/ +jboss-j2se.jar 5.1.0.CR1 build: SVNTag=3DJBoss_5_1_0_CR= 1 date=3D200904131335 +jboss-jmx.jar 5.1.0.CR1 build: SVNTag=3DJBoss_5_1_0_CR= 1 date=3D200904131335 +jboss-logging-log4j.jar 2.0.6.GA http://repository.jboss.com/ma= ven2/org/jboss/logging/jboss-logging-log4j/2.0.6.GA/ jboss-logging-spi.jar 2.0.5.GA http://repository.jboss.com/ma= ven2/org/jboss/logging/jboss-logging-spi/2.0.5.GA/ jboss-serialization.jar 1.0.3.GA http://repository.jboss.com/ma= ven2/jboss/jboss-serialization/1.0.3.GA/ -jnpserver.jar 5.0.0.GA http://repository.jboss.com/ma= ven2/org/jboss/naming/jnpserver/5.0.0.GA/ +jnpserver.jar 5.0.1.GA http://repository.jboss.com/ma= ven2/org/jboss/naming/jnpserver/5.0.1.GA/ = = = Modified: remoting2/branches/2.x/lib/jboss/jboss-common-core.jar =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D (Binary files differ) Modified: remoting2/branches/2.x/lib/jboss/jboss-j2se.jar =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D (Binary files differ) Modified: remoting2/branches/2.x/lib/jboss/jboss-jmx.jar =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D (Binary files differ) Modified: remoting2/branches/2.x/lib/jboss/jboss-logging-log4j.jar =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D (Binary files differ) Modified: remoting2/branches/2.x/lib/jboss/jnpserver.jar =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D (Binary files differ) Modified: remoting2/branches/2.x/lib/jbossweb/README =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/lib/jbossweb/README 2009-04-13 10:33:46 UTC (rev= 4986) +++ remoting2/branches/2.x/lib/jbossweb/README 2009-04-14 05:01:03 UTC (rev= 4987) @@ -1,3 +1,3 @@ File Version From = ------- ------- ---- -jbossweb.jar 2.1.1.GA http://repository.jboss.com/ma= ven2/jboss/web/jbossweb/2.1.1.GA/ +jbossweb.jar 2.1.2.GA http://repository.jboss.com/ma= ven2/jboss/web/jbossweb/2.1.2.GA/ Modified: remoting2/branches/2.x/lib/jbossweb/jbossweb.jar =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D (Binary files differ) Added: remoting2/branches/2.x/lib/trove/lib/README =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/lib/trove/lib/README (re= v 0) +++ remoting2/branches/2.x/lib/trove/lib/README 2009-04-14 05:01:03 UTC (re= v 4987) @@ -0,0 +1 @@ +Implementation-Version: 1.0.2 --===============4083455518106773190==-- From jboss-remoting-commits at lists.jboss.org Tue Apr 14 01:58:19 2009 Content-Type: multipart/mixed; boundary="===============8456070375232763604==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4988 - remoting2/branches/2.2/src/main/org/jboss/remoting. Date: Tue, 14 Apr 2009 01:58:19 -0400 Message-ID: <E1Ltbf1-0004XS-2O@committer01.frg.pub.inap.atl.jboss.com> --===============8456070375232763604== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-14 01:58:18 -0400 (Tue, 14 Apr 2009) New Revision: 4988 Modified: remoting2/branches/2.2/src/main/org/jboss/remoting/Client.java Log: JBREM-1103: Updated javadoc for invokeOneway() methods. Modified: remoting2/branches/2.2/src/main/org/jboss/remoting/Client.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.2/src/main/org/jboss/remoting/Client.java 2009-04-= 14 05:01:03 UTC (rev 4987) +++ remoting2/branches/2.2/src/main/org/jboss/remoting/Client.java 2009-04-= 14 05:58:18 UTC (rev 4988) @@ -566,17 +566,18 @@ * client will not wait for a return. * <b> * This is done one of two ways. The first is to pass true as the clien= tSide param. This will - * cause the execution of the remote call to be excuted in a new thread= on the client side and + * cause the execution of the remote call to be executed in a new threa= d on the client side and * will return the calling thread before making call to server side. A= lthough, this is optimal * for performance, will not know about any problems contacting server. * <p/> * The second, is to pass false as the clientSide param. This will allo= w the current calling * thread to make the call to the remote server, at which point, the se= rver side processing of * the thread will be executed on the remote server in a new executing = thread and the client - * thread will return. This is a little slower, but will know that the= call made it to the - * server. - * - * NOTE: false case is not accurate. + * thread will return. + * <p> + * NOTE: The treatment of server side oneway invocations may vary with= the transport. The + * client side transport is not required to wait for a reply from the s= erver. In particular, + * the socket and bisocket transports return immediately after writing = the invocation. */ public void invokeOneway(final Object param, final Map sendPayload, boo= lean clientSide) throws Throwable @@ -780,8 +781,7 @@ = /** * Same as calling invokeOneway(Object param, Map sendPayload, boolean = clientSide) with - * clientSide param being false and a null sendPayload. Therefore, clie= nt thread will not return - * till it has made remote call. + * clientSide param being false and a null sendPayload. */ public void invokeOneway(Object param) throws Throwable { @@ -790,8 +790,7 @@ = /** * Same as calling invokeOneway(Object param, Map sendPayload, boolean = clientSide) with - * clientSide param being false. Therefore, client thread will not ret= urn till it has made - * remote call. + * clientSide param being false. */ public void invokeOneway(Object param, Map sendPayload) throws Throwable { --===============8456070375232763604==-- From jboss-remoting-commits at lists.jboss.org Tue Apr 14 01:59:17 2009 Content-Type: multipart/mixed; boundary="===============0222659943532673498==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4989 - remoting2/branches/2.x/src/main/org/jboss/remoting. Date: Tue, 14 Apr 2009 01:59:17 -0400 Message-ID: <E1Ltbfx-0004Zp-87@committer01.frg.pub.inap.atl.jboss.com> --===============0222659943532673498== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-14 01:59:17 -0400 (Tue, 14 Apr 2009) New Revision: 4989 Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/Client.java Log: JBREM-1103: Updated javadoc for invokeOneway() methods. Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/Client.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/Client.java 2009-04-= 14 05:58:18 UTC (rev 4988) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/Client.java 2009-04-= 14 05:59:17 UTC (rev 4989) @@ -632,7 +632,7 @@ * client will not wait for a return. * <b> * This is done one of two ways. The first is to pass true as the clien= tSide param. This will - * cause the execution of the remote call to be excuted in a new thread= on the client side and + * cause the execution of the remote call to be executed in a new threa= d on the client side and * will return the calling thread before making call to server side. * <p/> * The second, is to pass false as the clientSide param. This will allo= w the current calling @@ -640,7 +640,8 @@ * the thread will be executed on the remote server in a new executing = thread. * <p> * NOTE: The treatment of server side oneway invocations may vary with= the transport. The - * client side transport is not required to wait for a reply from the s= erver. + * client side transport is not required to wait for a reply from the s= erver. In particular, + * the socket and bisocket transports return immediately after writing = the invocation. */ public void invokeOneway(final Object param, final Map sendPayload, boo= lean clientSide) = throws Throwable @@ -844,8 +845,7 @@ = /** * Same as calling invokeOneway(Object param, Map sendPayload, boolean = clientSide) with - * clientSide param being false and a null sendPayload. Therefore, clie= nt thread will not return - * till it has made remote call. + * clientSide param being false and a null sendPayload. */ public void invokeOneway(Object param) throws Throwable { @@ -854,8 +854,7 @@ = /** * Same as calling invokeOneway(Object param, Map sendPayload, boolean = clientSide) with - * clientSide param being false. Therefore, client thread will not ret= urn till it has made - * remote call. + * clientSide param being false. */ public void invokeOneway(Object param, Map sendPayload) throws Throwable { --===============0222659943532673498==-- From jboss-remoting-commits at lists.jboss.org Tue Apr 14 02:28:35 2009 Content-Type: multipart/mixed; boundary="===============6440735150519243911==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4990 - remoting2/branches/2.x/docs/guide/en. Date: Tue, 14 Apr 2009 02:28:35 -0400 Message-ID: <E1Ltc8J-0005Wu-1d@committer01.frg.pub.inap.atl.jboss.com> --===============6440735150519243911== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-14 02:28:34 -0400 (Tue, 14 Apr 2009) New Revision: 4990 Modified: remoting2/branches/2.x/docs/guide/en/chap11.xml Log: JBREM-1103: Updated oneway invocation example. Modified: remoting2/branches/2.x/docs/guide/en/chap11.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/docs/guide/en/chap11.xml 2009-04-14 05:59:17 UTC= (rev 4989) +++ remoting2/branches/2.x/docs/guide/en/chap11.xml 2009-04-14 06:28:34 UTC= (rev 4990) @@ -290,6 +290,13 @@ server. This is faster of the two modes, but if there is a problem mak= ing the request on the server, the original caller will be unaware.</para> = + <para><emphasis role=3D"bold">NOTE.</emphasis> In the interest of perf= ormance, + the behavior of the various transports is not required to conform to t= he + preceding description of the first, "server side", mode, in which the = invocation + is made on the calling thread. In particular, the socket and bisocket= transports + return immediately after writing the invocation, without waiting for a = + response from the server.</para> + = <para>The OnewayServer is exactly the same as the SimpleServer from the previous example, with the exception that invocation handler returns n= ull (since even if did return a response, would not be delivered to the --===============6440735150519243911==-- From jboss-remoting-commits at lists.jboss.org Tue Apr 14 02:29:01 2009 Content-Type: multipart/mixed; boundary="===============8659003428212577364==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4991 - remoting2/branches/2.2/docs/guide/en. Date: Tue, 14 Apr 2009 02:29:01 -0400 Message-ID: <E1Ltc8j-0005YS-PK@committer01.frg.pub.inap.atl.jboss.com> --===============8659003428212577364== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-14 02:29:01 -0400 (Tue, 14 Apr 2009) New Revision: 4991 Modified: remoting2/branches/2.2/docs/guide/en/chap10.xml Log: JBREM-1103: Updated oneway invocation example. Modified: remoting2/branches/2.2/docs/guide/en/chap10.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.2/docs/guide/en/chap10.xml 2009-04-14 06:28:34 UTC= (rev 4990) +++ remoting2/branches/2.2/docs/guide/en/chap10.xml 2009-04-14 06:29:01 UTC= (rev 4991) @@ -289,6 +289,13 @@ worker thread on the client side will make the actual invocation on the server. This is faster of the two modes, but if there is a problem mak= ing the request on the server, the original caller will be unaware.</para> + = + <para><emphasis role=3D"bold">NOTE.</emphasis> In the interest of perf= ormance, + the behavior of the various transports is not required to conform to t= he + preceding description of the first, "server side", mode, in which the = invocation + is made on the calling thread. In particular, the socket and bisocket= transports + return immediately after writing the invocation, without waiting for a = + response from the server.</para> = <para>The OnewayServer is exactly the same as the SimpleServer from the previous example, with the exception that invocation handler returns n= ull --===============8659003428212577364==-- From jboss-remoting-commits at lists.jboss.org Tue Apr 14 06:09:06 2009 Content-Type: multipart/mixed; boundary="===============4658006236632299486==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4992 - remoting2/branches/2.x/src/main/org/jboss/remoting. Date: Tue, 14 Apr 2009 06:09:06 -0400 Message-ID: <E1LtfZi-0007Va-2g@committer01.frg.pub.inap.atl.jboss.com> --===============4658006236632299486== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-14 06:09:05 -0400 (Tue, 14 Apr 2009) New Revision: 4992 Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/Client.java Log: JBREM-1116: Eliminated dependence on SecurityUtility. Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/Client.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/Client.java 2009-04-= 14 06:29:01 UTC (rev 4991) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/Client.java 2009-04-= 14 10:09:05 UTC (rev 4992) @@ -54,9 +54,12 @@ import java.lang.ref.WeakReference; import java.net.InetAddress; import java.net.SocketTimeoutException; +import java.net.UnknownHostException; import java.rmi.MarshalException; import java.security.AccessController; import java.security.PrivilegedAction; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; @@ -952,7 +955,7 @@ } if (host =3D=3D null) { - host =3D SecurityUtility.getLocalHost().getHostAddress(); + host =3D getLocalHost().getHostAddress(); metadata.put(CALLBACK_SERVER_HOST, host); } if (port =3D=3D -1) @@ -1860,4 +1863,41 @@ ref =3D null; } } + = + static private InetAddress getLocalHost() throws UnknownHostException + { + if (SecurityUtility.skipAccessControl()) + { + try + { + return InetAddress.getLocalHost(); + } + catch (IOException e) + { + return InetAddress.getByName("127.0.0.1"); + } + } + + try + { + return (InetAddress) AccessController.doPrivileged( new Privilege= dExceptionAction() + { + public Object run() throws IOException + { + try + { + return InetAddress.getLocalHost(); + } + catch (IOException e) + { + return InetAddress.getByName("127.0.0.1"); + } + } + }); + } + catch (PrivilegedActionException e) + { + throw (UnknownHostException) e.getCause(); + } + } } --===============4658006236632299486==-- From jboss-remoting-commits at lists.jboss.org Tue Apr 14 06:09:35 2009 Content-Type: multipart/mixed; boundary="===============5208581182440785676==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4993 - remoting2/branches/2.x/src/main/org/jboss/remoting. Date: Tue, 14 Apr 2009 06:09:35 -0400 Message-ID: <E1LtfaB-0007Xk-7s@committer01.frg.pub.inap.atl.jboss.com> --===============5208581182440785676== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-14 06:09:35 -0400 (Tue, 14 Apr 2009) New Revision: 4993 Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/InvokerLocator.java Log: JBREM-1116: Eliminated dependence on SecurityUtility. Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/InvokerLocator= .java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/InvokerLocator.java = 2009-04-14 10:09:05 UTC (rev 4992) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/InvokerLocator.java = 2009-04-14 10:09:35 UTC (rev 4993) @@ -369,7 +369,7 @@ } else = { - String s =3D SecurityUtility.getSystemProperty(LEGACY_PARSING); + String s =3D getSystemProperty(LEGACY_PARSING); doLegacyParsing =3D "true".equalsIgnoreCase(s); } = @@ -511,14 +511,14 @@ } else if(host.indexOf("0.0.0.0") !=3D -1) { - String bindAddress =3D SecurityUtility.getSystemProperty(SERVER_B= IND_ADDRESS, "0.0.0.0"); = + String bindAddress =3D getSystemProperty(SERVER_BIND_ADDRESS, "0.= 0.0.0"); = if(bindAddress.equals("0.0.0.0")) { host =3D fixRemoteAddress(host); } else { - host =3D host.replaceAll("0\\.0\\.0\\.0", SecurityUtility.getS= ystemProperty(SERVER_BIND_ADDRESS)); + host =3D host.replaceAll("0\\.0\\.0\\.0", getSystemProperty(SE= RVER_BIND_ADDRESS)); } } return host; @@ -941,4 +941,52 @@ sb.append(s.substring(fromIndex)); return sb.toString(); } + = + static private String getSystemProperty(final String name, final String= defaultValue) + { + if (SecurityUtility.skipAccessControl()) + return System.getProperty(name, defaultValue); + = + String value =3D null; + try + { + value =3D (String)AccessController.doPrivileged( new PrivilegedEx= ceptionAction() + { + public Object run() throws Exception + { + return System.getProperty(name, defaultValue); + } + }); + } + catch (PrivilegedActionException e) + { + throw (RuntimeException) e.getCause(); + } + = + return value; + } + = + static private String getSystemProperty(final String name) + { + if (SecurityUtility.skipAccessControl()) + return System.getProperty(name); + = + String value =3D null; + try + { + value =3D (String)AccessController.doPrivileged( new PrivilegedEx= ceptionAction() + { + public Object run() throws Exception + { + return System.getProperty(name); + } + }); + } + catch (PrivilegedActionException e) + { + throw (RuntimeException) e.getCause(); + } + = + return value; + } } --===============5208581182440785676==-- From jboss-remoting-commits at lists.jboss.org Tue Apr 14 06:09:59 2009 Content-Type: multipart/mixed; boundary="===============7246464723437389150==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4994 - remoting2/branches/2.x/src/main/org/jboss/remoting. Date: Tue, 14 Apr 2009 06:09:59 -0400 Message-ID: <E1LtfaZ-0007Yd-LJ@committer01.frg.pub.inap.atl.jboss.com> --===============7246464723437389150== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-14 06:09:59 -0400 (Tue, 14 Apr 2009) New Revision: 4994 Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/InvokerRegistry.java Log: JBREM-1116: Eliminated dependence on SecurityUtility. Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/InvokerRegistr= y.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/InvokerRegistry.java= 2009-04-14 10:09:35 UTC (rev 4993) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/InvokerRegistry.java= 2009-04-14 10:09:59 UTC (rev 4994) @@ -33,6 +33,9 @@ = import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; +import java.security.AccessController; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; @@ -444,9 +447,9 @@ if(transportFactoryClass !=3D null) { ClientFactory transportFactory =3D (ClientFactory)transportFactor= yClass.newInstance(); - Method getClientInvokerMethod =3D SecurityUtility.getMethod(trans= portFactoryClass, - "create= ClientInvoker", - new Cla= ss[] {InvokerLocator.class, Map.class}); + Method getClientInvokerMethod =3D getMethod(transportFactoryClass, + "createClientInvoker", + new Class[] {InvokerLoc= ator.class, Map.class}); clientInvoker =3D (ClientInvoker)getClientInvokerMethod.invoke(tr= ansportFactory, new Object[] {locator, configuration}); } else @@ -465,9 +468,9 @@ if(transportFactoryClass !=3D null) { ServerFactory transportFactory =3D (ServerFactory)transportFactor= yClass.newInstance(); - Method getServerInvokerMethod =3D SecurityUtility.getMethod(trans= portFactoryClass, - "create= ServerInvoker", - new Cla= ss[] {InvokerLocator.class, Map.class}); = + Method getServerInvokerMethod =3D getMethod(transportFactoryClass, + "createServerInvoker", + new Class[] {InvokerLoc= ator.class, Map.class}); = serverInvoker =3D (ServerInvoker)getServerInvokerMethod.invoke(tr= ansportFactory, new Object[] {locator, configuration}); } else @@ -675,7 +678,7 @@ transportFactoryClass =3D getTransportClientFactory(transport); } ClientFactory clientFactory =3D (ClientFactory)transportFactoryCl= ass.newInstance(); - Method meth =3D SecurityUtility.getMethod(transportFactoryClass, = "supportsSSL", new Class[]{}); = + Method meth =3D getMethod(transportFactoryClass, "supportsSSL", n= ew Class[]{}); = Boolean boolVal =3D (Boolean)meth.invoke(clientFactory, null); isSSLSupported =3D boolVal.booleanValue(); } @@ -783,4 +786,28 @@ } = } + = + static private Method getMethod(final Class c, final String name, final= Class[] parameterTypes) + throws NoSuchMethodException + { + if (SecurityUtility.skipAccessControl()) + { + return c.getMethod(name, parameterTypes); + } + + try + { + return (Method) AccessController.doPrivileged( new PrivilegedExce= ptionAction() + { + public Object run() throws NoSuchMethodException + { + return c.getMethod(name, parameterTypes); + } + }); + } + catch (PrivilegedActionException e) + { + throw (NoSuchMethodException) e.getCause(); + } + } } --===============7246464723437389150==-- From jboss-remoting-commits at lists.jboss.org Tue Apr 14 06:10:28 2009 Content-Type: multipart/mixed; boundary="===============8844317309835169594==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4995 - remoting2/branches/2.x/src/main/org/jboss/remoting. Date: Tue, 14 Apr 2009 06:10:28 -0400 Message-ID: <E1Ltfb2-0000Vr-DZ@committer01.frg.pub.inap.atl.jboss.com> --===============8844317309835169594== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-14 06:10:28 -0400 (Tue, 14 Apr 2009) New Revision: 4995 Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/MicroRemoteClientInvo= ker.java Log: JBREM-1116: Eliminated dependence on SecurityUtility. Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/MicroRemoteCli= entInvoker.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/MicroRemoteClientInv= oker.java 2009-04-14 10:09:59 UTC (rev 4994) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/MicroRemoteClientInv= oker.java 2009-04-14 10:10:28 UTC (rev 4995) @@ -13,6 +13,10 @@ import org.jboss.util.id.GUID; = import java.io.IOException; +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -120,7 +124,7 @@ // class loader. This allows to load remoting classes as well as= user's // classes. If possible, will simply reset context classloader o= n existing // RemotingClassLoader. - final ClassLoader contextClassLoader =3D SecurityUtility.getConte= xtClassLoader(Thread.currentThread()); + final ClassLoader contextClassLoader =3D getContextClassLoader(Th= read.currentThread()); if (unmarshaller instanceof UpdateableClassloaderUnMarshaller) { UpdateableClassloaderUnMarshaller uclum =3D (UpdateableClasslo= aderUnMarshaller) unmarshaller; @@ -132,13 +136,13 @@ } else { - rcl =3D SecurityUtility.createRemotingClassLoader(getClassL= oader(), contextClassLoader, parentFirstClassLoading); + rcl =3D createRemotingClassLoader(getClassLoader(), context= ClassLoader, parentFirstClassLoading); unmarshaller.setClassLoader(rcl); } } else { - rcl =3D SecurityUtility.createRemotingClassLoader(getClassLoad= er(), contextClassLoader, parentFirstClassLoading); + rcl =3D createRemotingClassLoader(getClassLoader(), contextCla= ssLoader, parentFirstClassLoading); unmarshaller.setClassLoader(rcl); = } } @@ -364,13 +368,13 @@ = public void setUnMarshaller(UnMarshaller unmarshaller) { - ClassLoader classLoader =3D SecurityUtility.getContextClassLoader(Th= read.currentThread()); + ClassLoader classLoader =3D getContextClassLoader(Thread.currentThre= ad()); unmarshallers.put(classLoader, unmarshaller); } = public UnMarshaller getUnMarshaller() { - ClassLoader classLoader =3D SecurityUtility.getContextClassLoader(Th= read.currentThread()); + ClassLoader classLoader =3D getContextClassLoader(Thread.currentThre= ad()); return (UnMarshaller)unmarshallers.get(classLoader); } = @@ -545,7 +549,7 @@ if(flag =3D=3D null) { // Fallback to the system property - flag =3D SecurityUtility.getSystemProperty(Remoting.CLASSLOADING_= PARENT_FIRST_DELEGATION_PROP); + flag =3D getSystemProperty(Remoting.CLASSLOADING_PARENT_FIRST_DEL= EGATION_PROP); } boolean parentFirst =3D true; if (flag !=3D null) @@ -628,5 +632,61 @@ disconnect(); super.finalize(); } + = + static private String getSystemProperty(final String name) + { + if (SecurityUtility.skipAccessControl()) + return System.getProperty(name); + = + String value =3D null; + try + { + value =3D (String)AccessController.doPrivileged( new PrivilegedEx= ceptionAction() + { + public Object run() throws Exception + { + return System.getProperty(name); + } + }); + } + catch (PrivilegedActionException e) + { + throw (RuntimeException) e.getCause(); + } + = + return value; + } + = + static private RemotingClassLoader createRemotingClassLoader(final Clas= sLoader remotingClassLoader, + final ClassLoader userClassLoader, final boolean parentFirstDeleg= ation) + { + if (SecurityUtility.skipAccessControl()) + { + return new RemotingClassLoader(remotingClassLoader, userClassLoad= er, parentFirstDelegation); + } = + return (RemotingClassLoader)AccessController.doPrivileged( new Privi= legedAction() + { + public Object run() + { + return new RemotingClassLoader(remotingClassLoader, userClassL= oader, parentFirstDelegation); + } + }); + } + = + static private ClassLoader getContextClassLoader(final Thread thread) + { + if (SecurityUtility.skipAccessControl()) + { + return thread.getContextClassLoader(); + } + + return (ClassLoader) AccessController.doPrivileged( new PrivilegedAc= tion() + { + public Object run() + { + return thread.getContextClassLoader(); + } + }); + } } --===============8844317309835169594==-- From jboss-remoting-commits at lists.jboss.org Tue Apr 14 06:11:02 2009 Content-Type: multipart/mixed; boundary="===============4391870998520712755==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4996 - remoting2/branches/2.x/src/main/org/jboss/remoting. Date: Tue, 14 Apr 2009 06:11:02 -0400 Message-ID: <E1Ltfba-0000Y0-IA@committer01.frg.pub.inap.atl.jboss.com> --===============4391870998520712755== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-14 06:11:02 -0400 (Tue, 14 Apr 2009) New Revision: 4996 Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/ServerInvoker.java Log: JBREM-1116: Eliminated dependence on SecurityUtility. Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/ServerInvoker.= java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/ServerInvoker.java 2= 009-04-14 10:10:28 UTC (rev 4995) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/ServerInvoker.java 2= 009-04-14 10:11:02 UTC (rev 4996) @@ -55,6 +55,10 @@ import java.io.IOException; import java.lang.reflect.Constructor; import java.net.InetAddress; +import java.net.UnknownHostException; +import java.security.AccessController; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; @@ -1188,11 +1192,11 @@ InetAddress addr =3D null; if(locatorhost !=3D null) { - addr =3D SecurityUtility.getAddressByName(locatorhost); + addr =3D getAddressByName(locatorhost); } else { - addr =3D SecurityUtility.getLocalHost(); + addr =3D getLocalHost(); } = int port =3D locator.getPort(); @@ -1209,7 +1213,7 @@ if(clientConnectAddress !=3D null) { // can't use uri address, as is for client only - serverBindAddress =3D SecurityUtility.getLocalHost().getHostAd= dress(); + serverBindAddress =3D getLocalHost().getHostAddress(); } else { @@ -2124,5 +2128,64 @@ return handleObject; } } + = + static private InetAddress getLocalHost() throws UnknownHostException + { + if (SecurityUtility.skipAccessControl()) + { + try + { + return InetAddress.getLocalHost(); + } + catch (IOException e) + { + return InetAddress.getByName("127.0.0.1"); + } + } = + try + { + return (InetAddress) AccessController.doPrivileged( new Privilege= dExceptionAction() + { + public Object run() throws IOException + { + try + { + return InetAddress.getLocalHost(); + } + catch (IOException e) + { + return InetAddress.getByName("127.0.0.1"); + } + } + }); + } + catch (PrivilegedActionException e) + { + throw (UnknownHostException) e.getCause(); + } + } + = + static private InetAddress getAddressByName(final String host) throws U= nknownHostException + { + if (SecurityUtility.skipAccessControl()) + { + return InetAddress.getByName(host); + } + = + try + { + return (InetAddress)AccessController.doPrivileged( new Privileged= ExceptionAction() + { + public Object run() throws IOException + { + return InetAddress.getByName(host); + } + }); + } + catch (PrivilegedActionException e) + { + throw (UnknownHostException) e.getCause(); + } + } } --===============4391870998520712755==-- From jboss-remoting-commits at lists.jboss.org Tue Apr 14 06:11:33 2009 Content-Type: multipart/mixed; boundary="===============1705579871148787030==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4997 - remoting2/branches/2.x/src/main/org/jboss/remoting. Date: Tue, 14 Apr 2009 06:11:33 -0400 Message-ID: <E1Ltfc5-0000Zn-OP@committer01.frg.pub.inap.atl.jboss.com> --===============1705579871148787030== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-14 06:11:33 -0400 (Tue, 14 Apr 2009) New Revision: 4997 Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/Version.java Log: JBREM-1116: Eliminated dependence on SecurityUtility. Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/Version.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/Version.java 2009-04= -14 10:11:02 UTC (rev 4996) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/Version.java 2009-04= -14 10:11:33 UTC (rev 4997) @@ -22,6 +22,10 @@ = package org.jboss.remoting; = +import java.security.AccessController; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; + import org.jboss.remoting.util.SecurityUtility; = /** @@ -50,7 +54,7 @@ static { boolean precompatibleFlag =3D false; - String precompatible =3D SecurityUtility.getSystemProperty(PRE_2_0_= COMPATIBLE); + String precompatible =3D getSystemProperty(PRE_2_0_COMPATIBLE); = if(precompatible !=3D null && precompatible.length() > 0) { @@ -64,7 +68,7 @@ } else { - String userDefinedVersion =3D SecurityUtility.getSystemProperty(R= EMOTING_VERSION_TO_USE); + String userDefinedVersion =3D getSystemProperty(REMOTING_VERSION_= TO_USE); = if(userDefinedVersion !=3D null && userDefinedVersion.length() > = 0) { @@ -85,7 +89,7 @@ } else { - SecurityUtility.setSystemProperty(REMOTING_VERSION_TO_USE, new= Byte(defaultByteVersion).toString()); + setSystemProperty(REMOTING_VERSION_TO_USE, new Byte(defaultByt= eVersion).toString()); } } } @@ -114,4 +118,52 @@ { return version =3D=3D VERSION_1 || version =3D=3D VERSION_2 || versi= on =3D=3D VERSION_2_2; } + = + static private String getSystemProperty(final String name) + { + if (SecurityUtility.skipAccessControl()) + return System.getProperty(name); + = + String value =3D null; + try + { + value =3D (String)AccessController.doPrivileged( new PrivilegedEx= ceptionAction() + { + public Object run() throws Exception + { + return System.getProperty(name); + } + }); + } + catch (PrivilegedActionException e) + { + throw (RuntimeException) e.getCause(); + } + = + return value; + } + = + static private void setSystemProperty(final String name, final String v= alue) + { + if (SecurityUtility.skipAccessControl()) + { + System.setProperty(name, value); + return; + } + = + try + { + AccessController.doPrivileged( new PrivilegedExceptionAction() + { + public Object run() throws Exception + { + return System.setProperty(name, value); + } + }); + } + catch (PrivilegedActionException e) + { + throw (RuntimeException) e.getCause(); + } + } } \ No newline at end of file --===============1705579871148787030==-- From jboss-remoting-commits at lists.jboss.org Tue Apr 14 06:12:28 2009 Content-Type: multipart/mixed; boundary="===============8867314080607864487==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4998 - remoting2/branches/2.x/src/main/org/jboss/remoting/callback. Date: Tue, 14 Apr 2009 06:12:27 -0400 Message-ID: <E1Ltfcx-0000d5-QO@committer01.frg.pub.inap.atl.jboss.com> --===============8867314080607864487== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-14 06:12:27 -0400 (Tue, 14 Apr 2009) New Revision: 4998 Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/callback/CallbackStor= e.java remoting2/branches/2.x/src/main/org/jboss/remoting/callback/ServerInvoke= rCallbackHandler.java Log: JBREM-1116: Eliminated dependence on SecurityUtility. Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/callback/Callb= ackStore.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/callback/CallbackSto= re.java 2009-04-14 10:11:33 UTC (rev 4997) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/callback/CallbackSto= re.java 2009-04-14 10:12:27 UTC (rev 4998) @@ -123,7 +123,7 @@ { try { - filePath =3D SecurityUtility.getSystemProperty("jboss.serve= r.data.dir", "data"); + filePath =3D getSystemProperty("jboss.server.data.dir", "da= ta"); } catch (Exception e) { @@ -134,7 +134,7 @@ File storeFile =3D new File(filePath); if (!storeFile.exists()) { - boolean madeDir =3D SecurityUtility.mkdirs(storeFile); + boolean madeDir =3D mkdirs(storeFile); if (!madeDir) { throw new IOException("Can not create directory for store. = Path given: " + filePath); @@ -202,7 +202,7 @@ { try { - String separator =3D SecurityUtility.getSystemProperty("file.s= eparator"); + String separator =3D getSystemProperty("file.separator"); fileToDelete =3D filePath + separator + fileList[x]; final File currentFile =3D new File(fileToDelete); = @@ -352,9 +352,9 @@ { // only getting the first one, which will be first one ente= red since the getting // of the list is automatically ordered by the OS and all f= ile names are numeric by time. - String separator =3D SecurityUtility.getSystemProperty("fil= e.separator"); + String separator =3D getSystemProperty("file.separator"); objectFilePath =3D filePath + separator + objectFileList[0]; - inFile =3D SecurityUtility.getFileInputStream(objectFilePat= h); + inFile =3D getFileInputStream(objectFilePath); in =3D SerializationStreamFactory.getManagerInstance(serial= izationType).createRegularInput(inFile); = try @@ -456,7 +456,7 @@ } = StringBuffer path =3D new StringBuffer(filePath); - String separator =3D SecurityUtility.getSystemProperty("file.sepa= rator"); + String separator =3D getSystemProperty("file.separator"); path.append(separator).append(String.valueOf(currentTimestamp)); path.append("-").append(timestampCounter).append(".").append(file= Suffix); final File storeFile =3D new File(path.toString()); @@ -465,7 +465,7 @@ = try { = - outFile =3D SecurityUtility.getFileOutputStream(storeFile, fal= se); + outFile =3D getFileOutputStream(storeFile, false); if (serializationType.indexOf("jboss") > 0) { out =3D SerializationStreamFactory.getManagerInstance(seria= lizationType).createOutput(outFile); @@ -545,5 +545,115 @@ } } } - + = + static private boolean mkdirs(final File dir) + { + if (SecurityUtility.skipAccessControl()) + { + return dir.mkdirs(); + } + = + return ((Boolean) AccessController.doPrivileged( new PrivilegedActio= n() + { + public Object run() + { + return new Boolean(dir.mkdirs()); + } + })).booleanValue(); + } + = + static private FileInputStream getFileInputStream(final String path) th= rows FileNotFoundException + { + if (SecurityUtility.skipAccessControl()) + { + return new FileInputStream(path); + } + = + try + { + return (FileInputStream)AccessController.doPrivileged( new Privil= egedExceptionAction() + { + public Object run() throws FileNotFoundException + { + return new FileInputStream(path); + } + }); + } + catch (PrivilegedActionException e) + { + throw (FileNotFoundException) e.getCause(); + } + } + = + static private FileOutputStream getFileOutputStream(final File file, fi= nal boolean append) + throws FileNotFoundException + { + if (SecurityUtility.skipAccessControl()) + { + return new FileOutputStream(file, append); + } + = + try + { + return (FileOutputStream)AccessController.doPrivileged( new Privi= legedExceptionAction() + { + public Object run() throws FileNotFoundException + { + return new FileOutputStream(file, append); + } + }); + } + catch (PrivilegedActionException e) + { + throw (FileNotFoundException) e.getCause(); + } + } + = + static private String getSystemProperty(final String name, final String= defaultValue) + { + if (SecurityUtility.skipAccessControl()) + return System.getProperty(name, defaultValue); + = + String value =3D null; + try + { + value =3D (String)AccessController.doPrivileged( new PrivilegedEx= ceptionAction() + { + public Object run() throws Exception + { + return System.getProperty(name, defaultValue); + } + }); + } + catch (PrivilegedActionException e) + { + throw (RuntimeException) e.getCause(); + } + = + return value; + } + = + static private String getSystemProperty(final String name) + { + if (SecurityUtility.skipAccessControl()) + return System.getProperty(name); + = + String value =3D null; + try + { + value =3D (String)AccessController.doPrivileged( new PrivilegedEx= ceptionAction() + { + public Object run() throws Exception + { + return System.getProperty(name); + } + }); + } + catch (PrivilegedActionException e) + { + throw (RuntimeException) e.getCause(); + } + = + return value; + } } Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/callback/Serve= rInvokerCallbackHandler.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/callback/ServerInvok= erCallbackHandler.java 2009-04-14 10:11:33 UTC (rev 4997) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/callback/ServerInvok= erCallbackHandler.java 2009-04-14 10:12:27 UTC (rev 4998) @@ -36,6 +36,7 @@ import org.jboss.remoting.security.SSLSocketFactoryService; import org.jboss.remoting.util.SecurityUtility; = +import javax.management.InstanceNotFoundException; import javax.management.MBeanServer; import javax.management.MBeanServerInvocationHandler; import javax.management.MalformedObjectNameException; @@ -295,10 +296,10 @@ if (server !=3D null) { String className =3D SSLServerSocketFactoryServiceMBean.cla= ss.getName(); - boolean isCorrectType =3D SecurityUtility.isInstanceOf(serv= er, serverSocketFactoryObjName, className); + boolean isCorrectType =3D isInstanceOf(server, serverSocket= FactoryObjName, className); if (isCorrectType) { - Object o =3D SecurityUtility.getMBeanAttribute(server, s= erverSocketFactoryObjName, "SSLSocketBuilder"); = + Object o =3D getMBeanAttribute(server, serverSocketFacto= ryObjName, "SSLSocketBuilder"); = SSLSocketBuilderMBean sslSocketBuilder =3D (SSLSocketBui= lderMBean) o; = if (sslSocketBuilder !=3D null) @@ -428,10 +429,10 @@ String filePath =3D (String) storeConfig.get(CallbackStore.FILE_P= ATH_KEY); if(filePath =3D=3D null) { - filePath =3D SecurityUtility.getSystemProperty("jboss.server.d= ata.dir", "data"); + filePath =3D getSystemProperty("jboss.server.data.dir", "data"= ); } = - String separator =3D SecurityUtility.getSystemProperty("file.sepa= rator"); + String separator =3D getSystemProperty("file.separator"); String newFilePath =3D filePath + separator + "remoting" + separa= tor + sessionId; storeConfig.put(CallbackStore.FILE_PATH_KEY, newFilePath); callbackStore.setConfig(storeConfig); @@ -1051,4 +1052,100 @@ { this.shouldPersist =3D shouldPersist; } + = + static private Object getMBeanAttribute(final MBeanServer server, final= ObjectName objectName, final String attribute) + throws Exception + { + if (SecurityUtility.skipAccessControl()) + { + return server.getAttribute(objectName, attribute); + } + = + try + { + return AccessController.doPrivileged( new PrivilegedExceptionActi= on() + { + public Object run() throws Exception + { + return server.getAttribute(objectName, attribute); + } + }); + } + catch (PrivilegedActionException e) + { + throw (Exception) e.getCause(); + } = + } + = + static private boolean isInstanceOf(final MBeanServer server, final Obj= ectName objectName, final String className) + throws InstanceNotFoundException + { + if (SecurityUtility.skipAccessControl()) + { + return server.isInstanceOf(objectName, className); + } + = + try + { + return ((Boolean)AccessController.doPrivileged( new PrivilegedExc= eptionAction() + { + public Object run() throws Exception + { + return new Boolean(server.isInstanceOf(objectName, classNam= e)); + } + })).booleanValue(); + } + catch (PrivilegedActionException e) + { + throw (InstanceNotFoundException) e.getCause(); + } + } + = + static private String getSystemProperty(final String name, final String= defaultValue) + { + if (SecurityUtility.skipAccessControl()) + return System.getProperty(name, defaultValue); + = + String value =3D null; + try + { + value =3D (String)AccessController.doPrivileged( new PrivilegedEx= ceptionAction() + { + public Object run() throws Exception + { + return System.getProperty(name, defaultValue); + } + }); + } + catch (PrivilegedActionException e) + { + throw (RuntimeException) e.getCause(); + } + = + return value; + } + = + static private String getSystemProperty(final String name) + { + if (SecurityUtility.skipAccessControl()) + return System.getProperty(name); + = + String value =3D null; + try + { + value =3D (String)AccessController.doPrivileged( new PrivilegedEx= ceptionAction() + { + public Object run() throws Exception + { + return System.getProperty(name); + } + }); + } + catch (PrivilegedActionException e) + { + throw (RuntimeException) e.getCause(); + } + = + return value; + } } --===============8867314080607864487==-- From jboss-remoting-commits at lists.jboss.org Tue Apr 14 06:13:01 2009 Content-Type: multipart/mixed; boundary="===============4654677688430262500==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r4999 - remoting2/branches/2.x/src/main/org/jboss/remoting/detection/jndi. Date: Tue, 14 Apr 2009 06:13:00 -0400 Message-ID: <E1LtfdU-0000ex-Sf@committer01.frg.pub.inap.atl.jboss.com> --===============4654677688430262500== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-14 06:13:00 -0400 (Tue, 14 Apr 2009) New Revision: 4999 Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/detection/jndi/JNDIDe= tector.java Log: JBREM-1116: Eliminated dependence on SecurityUtility. Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/detection/jndi= /JNDIDetector.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/detection/jndi/JNDID= etector.java 2009-04-14 10:12:27 UTC (rev 4998) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/detection/jndi/JNDID= etector.java 2009-04-14 10:13:00 UTC (rev 4999) @@ -39,9 +39,14 @@ import javax.naming.NamingEnumeration; import javax.naming.NamingException; = +import java.io.IOException; import java.lang.reflect.Method; +import java.net.InetAddress; +import java.net.UnknownHostException; import java.security.AccessController; import java.security.PrivilegedAction; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; import java.util.Map; import java.util.Properties; = @@ -277,7 +282,7 @@ cleanDetectionCount++; boolean cleanDetect =3D cleanDetectionCount > detectionNumber; String bindName =3D ""; - NamingEnumeration enumeration =3D SecurityUtility.listBindings(co= ntext, bindName); + NamingEnumeration enumeration =3D listBindings(context, bindName); while(enumeration.hasMore()) { Binding binding =3D (Binding) enumeration.next(); @@ -414,7 +419,7 @@ { try { - SecurityUtility.rebind(context, sId, msg); + rebind(context, sId, msg); log.info("Added " + sId + " to registry."); } catch(NameAlreadyBoundException nabex) @@ -447,7 +452,7 @@ namingBeanImplClass =3D Class.forName("org.jnp.server.Namin= gBeanImpl"); namingBean =3D namingBeanImplClass.newInstance(); Method startMethod =3D namingBeanImplClass.getMethod("start= ", new Class[] {}); - SecurityUtility.setSystemProperty("java.naming.factory.init= ial", "org.jnp.interfaces.NamingContextFactory"); + setSystemProperty("java.naming.factory.initial", "org.jnp.i= nterfaces.NamingContextFactory"); startMethod.invoke(namingBean, new Object[] {}); } catch (Exception e) @@ -455,7 +460,7 @@ log.debug("Cannot find NamingBeanImpl: must be running jdk = 1.4"); } = - host =3D SecurityUtility.getLocalHostName(); + host =3D getLocalHostName(); port =3D PortUtil.findFreePort(host); = log.info("Remoting JNDI detector starting JNDI server instance= since none where specified via configuration."); @@ -502,18 +507,18 @@ InitialContext initialContext =3D new InitialContext(env); try { - context =3D SecurityUtility.initialContextLookup(initialContext, = subContextName); + context =3D initialContextLookup(initialContext, subContextName); } catch(NamingException e) { try { - context =3D SecurityUtility.createSubcontext(initialContext, s= ubContextName); + context =3D createSubcontext(initialContext, subContextName); } catch(NameAlreadyBoundException e1) { log.debug("The sub context " + subContextName + " was created = before we could."); - context =3D SecurityUtility.initialContextLookup(initialContex= t, subContextName); + context =3D initialContextLookup(initialContext, subContextNam= e); } } } @@ -545,6 +550,224 @@ { log.trace("unregistering detector " + sId); } - SecurityUtility.unbind(context, sId); + unbind(context, sId); } + = + static private void setSystemProperty(final String name, final String v= alue) + { + if (SecurityUtility.skipAccessControl()) + { + System.setProperty(name, value); + return; + } + = + try + { + AccessController.doPrivileged( new PrivilegedExceptionAction() + { + public Object run() throws Exception + { + return System.setProperty(name, value); + } + }); + } + catch (PrivilegedActionException e) + { + throw (RuntimeException) e.getCause(); + } + } + = + static private InetAddress getLocalHost() throws UnknownHostException + { + if (SecurityUtility.skipAccessControl()) + { + try + { + return InetAddress.getLocalHost(); + } + catch (IOException e) + { + return InetAddress.getByName("127.0.0.1"); + } + } + + try + { + return (InetAddress) AccessController.doPrivileged( new Privilege= dExceptionAction() + { + public Object run() throws IOException + { + try + { + return InetAddress.getLocalHost(); + } + catch (IOException e) + { + return InetAddress.getByName("127.0.0.1"); + } + } + }); + } + catch (PrivilegedActionException e) + { + throw (UnknownHostException) e.getCause(); + } + } + = + static private String getLocalHostName() throws UnknownHostException + { + if (SecurityUtility.skipAccessControl()) + { + return getLocalHost().getHostName(); + } + + try + { + return (String) AccessController.doPrivileged( new PrivilegedExce= ptionAction() + { + public Object run() throws IOException + { + InetAddress address =3D null; + try + { + address =3D InetAddress.getLocalHost(); + } + catch (IOException e) + { + address =3D InetAddress.getByName("127.0.0.1"); + } + = + return address.getHostName(); + } + }); + } + catch (PrivilegedActionException e) + { + throw (UnknownHostException) e.getCause(); + } + } + = + static private Context createSubcontext(final InitialContext initialCon= text, final String subContextName) + throws NamingException + { + if (SecurityUtility.skipAccessControl()) + { + return initialContext.createSubcontext(subContextName); + } + + try + { + return (Context) AccessController.doPrivileged( new PrivilegedExc= eptionAction() = + { + public Object run() throws NamingException + { + return initialContext.createSubcontext(subContextName); + } + }); + } + catch (PrivilegedActionException e) + { + throw (NamingException) e.getCause(); + } + } + = + static private Context initialContextLookup(final InitialContext initia= lContext, final String subContextName) + throws NamingException + { + if (SecurityUtility.skipAccessControl()) + { + return (Context) initialContext.lookup(subContextName); + } + + try + { + return (Context) AccessController.doPrivileged( new PrivilegedExc= eptionAction() = + { + public Object run() throws NamingException + { + return initialContext.lookup(subContextName); + } + }); + } + catch (PrivilegedActionException e) + { + throw (NamingException) e.getCause(); + } + } + = + static private NamingEnumeration listBindings(final Context context, fi= nal String bindName) + throws NamingException + { + if (SecurityUtility.skipAccessControl()) + { + return context.listBindings(bindName); + } + + try + { + return (NamingEnumeration) AccessController.doPrivileged( new Pri= vilegedExceptionAction() = + { + public Object run() throws NamingException + { + return context.listBindings(bindName); + } + }); + } + catch (PrivilegedActionException e) + { + throw (NamingException) e.getCause(); + } + } + = + static private void rebind(final Context context, final String name, fi= nal Object object) + throws NamingException + { + if (SecurityUtility.skipAccessControl()) + { + context.rebind(name, object); + return; + } + + try + { + AccessController.doPrivileged( new PrivilegedExceptionAction() = + { + public Object run() throws NamingException + { + context.rebind(name, object); + return null; + } + }); + } + catch (PrivilegedActionException e) + { + throw (NamingException) e.getCause(); + } + } + = + static private void unbind(final Context context, final String name) + throws NamingException + { + if (SecurityUtility.skipAccessControl()) + { + context.unbind(name); + return; + } + + try + { + AccessController.doPrivileged( new PrivilegedExceptionAction() = + { + public Object run() throws NamingException + { + context.unbind(name); + return null; + } + }); + } + catch (PrivilegedActionException e) + { + throw (NamingException) e.getCause(); + } + } } --===============4654677688430262500==-- From jboss-remoting-commits at lists.jboss.org Tue Apr 14 06:13:24 2009 Content-Type: multipart/mixed; boundary="===============7117537461579357410==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5000 - remoting2/branches/2.x/src/main/org/jboss/remoting/detection/multicast. Date: Tue, 14 Apr 2009 06:13:24 -0400 Message-ID: <E1Ltfds-0000g5-Gf@committer01.frg.pub.inap.atl.jboss.com> --===============7117537461579357410== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-14 06:13:24 -0400 (Tue, 14 Apr 2009) New Revision: 5000 Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/detection/multicast/M= ulticastDetector.java Log: JBREM-1116: Eliminated dependence on SecurityUtility. Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/detection/mult= icast/MulticastDetector.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/detection/multicast/= MulticastDetector.java 2009-04-14 10:13:00 UTC (rev 4999) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/detection/multicast/= MulticastDetector.java 2009-04-14 10:13:24 UTC (rev 5000) @@ -35,6 +35,7 @@ import java.net.InetSocketAddress; import java.net.MulticastSocket; import java.net.SocketAddress; +import java.net.UnknownHostException; import java.security.AccessController; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; @@ -158,11 +159,11 @@ { if(addr =3D=3D null) { - addr =3D SecurityUtility.getAddressByName(defaultIP); + addr =3D getAddressByName(defaultIP); } = // check to see if we're running on a machine with loopback and no N= IC - InetAddress localHost =3D SecurityUtility.getLocalHost(); + InetAddress localHost =3D getLocalHost(); if(bindAddr =3D=3D null && localHost.getHostAddress().equals("127.0.= 0.1")) { // use this to bind so multicast will work w/o network @@ -370,4 +371,64 @@ } } } + = + static private InetAddress getLocalHost() throws UnknownHostException + { + if (SecurityUtility.skipAccessControl()) + { + try + { + return InetAddress.getLocalHost(); + } + catch (IOException e) + { + return InetAddress.getByName("127.0.0.1"); + } + } + + try + { + return (InetAddress) AccessController.doPrivileged( new Privilege= dExceptionAction() + { + public Object run() throws IOException + { + try + { + return InetAddress.getLocalHost(); + } + catch (IOException e) + { + return InetAddress.getByName("127.0.0.1"); + } + } + }); + } + catch (PrivilegedActionException e) + { + throw (UnknownHostException) e.getCause(); + } + } + = + static private InetAddress getAddressByName(final String host) throws U= nknownHostException + { + if (SecurityUtility.skipAccessControl()) + { + return InetAddress.getByName(host); + } + = + try + { + return (InetAddress)AccessController.doPrivileged( new Privileged= ExceptionAction() + { + public Object run() throws IOException + { + return InetAddress.getByName(host); + } + }); + } + catch (PrivilegedActionException e) + { + throw (UnknownHostException) e.getCause(); + } + } } --===============7117537461579357410==-- From jboss-remoting-commits at lists.jboss.org Tue Apr 14 06:13:51 2009 Content-Type: multipart/mixed; boundary="===============4880446569393864505==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5001 - remoting2/branches/2.x/src/main/org/jboss/remoting/detection/util. Date: Tue, 14 Apr 2009 06:13:51 -0400 Message-ID: <E1LtfeJ-0000hf-Gy@committer01.frg.pub.inap.atl.jboss.com> --===============4880446569393864505== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-14 06:13:51 -0400 (Tue, 14 Apr 2009) New Revision: 5001 Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/detection/util/Detect= orUtil.java Log: JBREM-1116: Eliminated dependence on SecurityUtility. Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/detection/util= /DetectorUtil.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/detection/util/Detec= torUtil.java 2009-04-14 10:13:24 UTC (rev 5000) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/detection/util/Detec= torUtil.java 2009-04-14 10:13:51 UTC (rev 5001) @@ -21,7 +21,12 @@ */ package org.jboss.remoting.detection.util; = +import java.security.AccessController; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; + import javax.management.MBeanServer; +import javax.management.MBeanServerFactory; import javax.management.ObjectName; import org.apache.log4j.Level; import org.jboss.logging.Logger; @@ -99,11 +104,11 @@ org.apache.log4j.Category.getRoot().setLevel(Level.DEBUG); Logger log =3D Logger.getLogger(getClass()); = - SecurityUtility.setSystemProperty("jboss.identity", String.valueO= f(System.currentTimeMillis())); + setSystemProperty("jboss.identity", String.valueOf(System.current= TimeMillis())); = - MBeanServer server =3D SecurityUtility.createMBeanServer(); + MBeanServer server =3D createMBeanServer(); NetworkRegistry registry =3D NetworkRegistry.getInstance(); - SecurityUtility.registerMBean(server, registry, new ObjectName("r= emoting:type=3DNetworkRegistry")); + registerMBean(server, registry, new ObjectName("remoting:type=3DN= etworkRegistry")); = InvokerLocator locator =3D new InvokerLocator("socket://localhost= "); //ClassLoader clsLoader =3D Thread.currentThread().getContextClas= sLoader(); @@ -115,7 +120,7 @@ Connector connector =3D new Connector(); connector.setInvokerLocator(locator.getLocatorURI()); ObjectName obj =3D new ObjectName("jboss.remoting:type=3DConnecto= r,transport=3D" + locator.getProtocol()); - SecurityUtility.registerMBean(server, connector, obj); + registerMBean(server, connector, obj); //connector.create(); connector.start(); = @@ -140,7 +145,7 @@ objName =3D new ObjectName("remoting:type=3DDetector,transport= =3Djndi"); } = - SecurityUtility.registerMBean(server, detector, objName); + registerMBean(server, detector, objName); detector.start(); System.err.println("Starting Detector"); = @@ -214,5 +219,76 @@ return type; } = - + static private MBeanServer createMBeanServer() throws Exception + { + if (SecurityUtility.skipAccessControl()) + { + return MBeanServerFactory.createMBeanServer(); + } + = + try + { + return (MBeanServer) AccessController.doPrivileged( new Privilege= dExceptionAction() + { + public Object run() throws Exception + { + return MBeanServerFactory.createMBeanServer(); + } + }); + } + catch (PrivilegedActionException e) + { + throw (Exception) e.getCause(); + } = + } + = + static private void registerMBean(final MBeanServer server, final Objec= t o, final ObjectName name) + throws Exception + { + if (SecurityUtility.skipAccessControl()) + { + server.registerMBean(o, name); + return; + } + = + try + { + AccessController.doPrivileged( new PrivilegedExceptionAction() + { + public Object run() throws Exception + { + server.registerMBean(o, name); + return null; + } + }); + } + catch (PrivilegedActionException e) + { + throw (Exception) e.getCause(); + } + } + = + static private void setSystemProperty(final String name, final String v= alue) + { + if (SecurityUtility.skipAccessControl()) + { + System.setProperty(name, value); + return; + } + = + try + { + AccessController.doPrivileged( new PrivilegedExceptionAction() + { + public Object run() throws Exception + { + return System.setProperty(name, value); + } + }); + } + catch (PrivilegedActionException e) + { + throw (RuntimeException) e.getCause(); + } + } } --===============4880446569393864505==-- From jboss-remoting-commits at lists.jboss.org Tue Apr 14 06:14:29 2009 Content-Type: multipart/mixed; boundary="===============7295648108772883234==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5002 - remoting2/branches/2.x/src/main/org/jboss/remoting/ident. Date: Tue, 14 Apr 2009 06:14:29 -0400 Message-ID: <E1Ltfev-0000kQ-5Q@committer01.frg.pub.inap.atl.jboss.com> --===============7295648108772883234== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-14 06:14:29 -0400 (Tue, 14 Apr 2009) New Revision: 5002 Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/ident/Identity.java Log: JBREM-1116: Eliminated dependence on SecurityUtility. Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/ident/Identity= .java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/ident/Identity.java = 2009-04-14 10:13:51 UTC (rev 5001) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/ident/Identity.java = 2009-04-14 10:14:29 UTC (rev 5002) @@ -28,12 +28,14 @@ import javax.management.ObjectName; import java.io.File; import java.io.FileInputStream; +import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.Serializable; import java.net.InetAddress; +import java.net.UnknownHostException; import java.rmi.dgc.VMID; import java.security.AccessController; import java.security.PrivilegedAction; @@ -60,7 +62,7 @@ = static { - _domain =3D SecurityUtility.getSystemProperty("jboss.identity.domain= ", DEFAULT_DOMAIN); + _domain =3D getSystemProperty("jboss.identity.domain", DEFAULT_DOMAI= N); } = private static transient Map identities =3D new WeakHashMap(2); @@ -100,7 +102,7 @@ } ident.calcHashCode(); } - SecurityUtility.setSystemProperty("jboss.identity.domain", domain); + setSystemProperty("jboss.identity.domain", domain); _domain =3D domain; NetworkRegistry.getInstance().changeDomain(domain); } @@ -213,9 +215,9 @@ } try { - InetAddress localHost =3D SecurityUtility.getLocalHost(); + InetAddress localHost =3D getLocalHost(); ObjectName objectName =3D new ObjectName("JMImplementation:type= =3DMBeanServerDelegate"); - String serverid =3D (String) SecurityUtility.getMBeanAttribute(se= rver, objectName, "MBeanServerId"); + String serverid =3D (String) getMBeanAttribute(server, objectName= , "MBeanServerId"); Identity identity =3D new Identity(localHost, createId(server), s= erverid); identities.put(server, identity); return identity; @@ -232,7 +234,7 @@ private static final synchronized String createId(final MBeanServer ser= ver) { // we can set as a system property - String myid =3D SecurityUtility.getSystemProperty("jboss.identity"); + String myid =3D getSystemProperty("jboss.identity"); if(myid !=3D null) { return myid; @@ -243,12 +245,12 @@ { // FIRST TRY THE JBOSS guy to determine our data directory final ObjectName obj =3D new ObjectName("jboss.system:type=3DServ= erConfig"); - File dir =3D (File) SecurityUtility.getMBeanAttribute(server, obj= , "ServerDataDir"); + File dir =3D (File) getMBeanAttribute(server, obj, "ServerDataDir= "); if(dir !=3D null) { - if(SecurityUtility.fileExists(dir) =3D=3D false) + if(fileExists(dir) =3D=3D false) { - SecurityUtility.mkdirs(dir); + mkdirs(dir); } file =3D new File(dir, "jboss.identity"); } @@ -259,23 +261,23 @@ if(file =3D=3D null) { // we may not have that mbean, which is OK - String fl =3D SecurityUtility.getSystemProperty("jboss.identity.d= ir", "."); + String fl =3D getSystemProperty("jboss.identity.dir", "."); = File dir =3D new File(fl); - if(SecurityUtility.fileExists(dir) =3D=3D false) + if(fileExists(dir) =3D=3D false) { - SecurityUtility.mkdirs(dir); + mkdirs(dir); } file =3D new File(dir, "jboss.identity"); } = - boolean canRead =3D SecurityUtility.canRead(file); - if(SecurityUtility.fileExists(file) && canRead) + boolean canRead =3D canRead(file); + if(fileExists(file) && canRead) { InputStream is =3D null; try { - is =3D SecurityUtility.getFileInputStream(file); + is =3D getFileInputStream(file); byte buf[] =3D new byte[800]; int c =3D is.read(buf); id =3D new String(buf, 0, c); @@ -304,12 +306,12 @@ try { id =3D createUniqueID(); - if(SecurityUtility.fileExists(file) =3D=3D false) + if(fileExists(file) =3D=3D false) { - SecurityUtility.createNewFile(file); + createNewFile(file); } = - out =3D SecurityUtility.getFileOutputStream(file); + out =3D getFileOutputStream(file); out.write(id.getBytes()); } catch(Exception ex) @@ -332,7 +334,7 @@ } } = - SecurityUtility.setSystemProperty("jboss.identity", id); + setSystemProperty("jboss.identity", id); = return id; } @@ -343,4 +345,258 @@ // colons don't work in JMX return id.replace(':', 'x') + random.nextInt(1000); } + = + static private boolean fileExists(final File file) + { + if (file =3D=3D null) + return false; + = + if (SecurityUtility.skipAccessControl()) + { + return file.exists(); + } + + return ((Boolean)AccessController.doPrivileged( new PrivilegedAction= () + { + public Object run() + { + return new Boolean(file.exists()); + } + })).booleanValue(); + } + = + static private boolean mkdirs(final File dir) + { + if (SecurityUtility.skipAccessControl()) + { + return dir.mkdirs(); + } + = + return ((Boolean) AccessController.doPrivileged( new PrivilegedActio= n() + { + public Object run() + { + return new Boolean(dir.mkdirs()); + } + })).booleanValue(); + } + = + static private FileInputStream getFileInputStream(final File file) thro= ws FileNotFoundException + { + if (SecurityUtility.skipAccessControl()) + { + return new FileInputStream(file); + } + = + try + { + return (FileInputStream)AccessController.doPrivileged( new Privil= egedExceptionAction() + { + public Object run() throws FileNotFoundException + { + return new FileInputStream(file); + } + }); + } + catch (PrivilegedActionException e) + { + throw (FileNotFoundException) e.getCause(); + } + } + = + static private FileOutputStream getFileOutputStream(final File file) + throws FileNotFoundException + { + if (SecurityUtility.skipAccessControl()) + { + return new FileOutputStream(file); + } + = + try + { + return (FileOutputStream)AccessController.doPrivileged( new Privi= legedExceptionAction() + { + public Object run() throws FileNotFoundException + { + return new FileOutputStream(file); + } + }); + } + catch (PrivilegedActionException e) + { + throw (FileNotFoundException) e.getCause(); + } + } + = + static private boolean canRead(final File file) + { + if (SecurityUtility.skipAccessControl()) + { + return file.canRead(); + } + = + return ((Boolean)AccessController.doPrivileged( new PrivilegedAction= () + { + public Object run() + { + return new Boolean(file.canRead()); + } + })).booleanValue(); + } + = + static private boolean createNewFile(final File file) throws IOException + { + if (SecurityUtility.skipAccessControl()) + { + return file.createNewFile(); + } + = + try + { + return ((Boolean)AccessController.doPrivileged( new PrivilegedExc= eptionAction() + { + public Object run() throws Exception + { + return new Boolean(file.createNewFile()); + } + })).booleanValue(); + } + catch (Exception e) + { + throw (IOException) e.getCause(); + } + } + = + static private Object getMBeanAttribute(final MBeanServer server, final= ObjectName objectName, final String attribute) + throws Exception + { + if (SecurityUtility.skipAccessControl()) + { + return server.getAttribute(objectName, attribute); + } + = + try + { + return AccessController.doPrivileged( new PrivilegedExceptionActi= on() + { + public Object run() throws Exception + { + return server.getAttribute(objectName, attribute); + } + }); + } + catch (PrivilegedActionException e) + { + throw (Exception) e.getCause(); + } = + } + = + static private String getSystemProperty(final String name, final String= defaultValue) + { + if (SecurityUtility.skipAccessControl()) + return System.getProperty(name, defaultValue); + = + String value =3D null; + try + { + value =3D (String)AccessController.doPrivileged( new PrivilegedEx= ceptionAction() + { + public Object run() throws Exception + { + return System.getProperty(name, defaultValue); + } + }); + } + catch (PrivilegedActionException e) + { + throw (RuntimeException) e.getCause(); + } + = + return value; + } + = + static private String getSystemProperty(final String name) + { + if (SecurityUtility.skipAccessControl()) + return System.getProperty(name); + = + String value =3D null; + try + { + value =3D (String)AccessController.doPrivileged( new PrivilegedEx= ceptionAction() + { + public Object run() throws Exception + { + return System.getProperty(name); + } + }); + } + catch (PrivilegedActionException e) + { + throw (RuntimeException) e.getCause(); + } + = + return value; + } + = + static private void setSystemProperty(final String name, final String v= alue) + { + if (SecurityUtility.skipAccessControl()) + { + System.setProperty(name, value); + return; + } + = + try + { + AccessController.doPrivileged( new PrivilegedExceptionAction() + { + public Object run() throws Exception + { + return System.setProperty(name, value); + } + }); + } + catch (PrivilegedActionException e) + { + throw (RuntimeException) e.getCause(); + } + } + = + static private InetAddress getLocalHost() throws UnknownHostException + { + if (SecurityUtility.skipAccessControl()) + { + try + { + return InetAddress.getLocalHost(); + } + catch (IOException e) + { + return InetAddress.getByName("127.0.0.1"); + } + } + + try + { + return (InetAddress) AccessController.doPrivileged( new Privilege= dExceptionAction() + { + public Object run() throws IOException + { + try + { + return InetAddress.getLocalHost(); + } + catch (IOException e) + { + return InetAddress.getByName("127.0.0.1"); + } + } + }); + } + catch (PrivilegedActionException e) + { + throw (UnknownHostException) e.getCause(); + } + } } --===============7295648108772883234==-- From jboss-remoting-commits at lists.jboss.org Tue Apr 14 06:15:04 2009 Content-Type: multipart/mixed; boundary="===============8759130095519055877==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5003 - remoting2/branches/2.x/src/main/org/jboss/remoting/loading. Date: Tue, 14 Apr 2009 06:15:03 -0400 Message-ID: <E1LtffT-0000ma-RX@committer01.frg.pub.inap.atl.jboss.com> --===============8759130095519055877== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-14 06:15:03 -0400 (Tue, 14 Apr 2009) New Revision: 5003 Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/loading/ClassByteClas= sLoader.java remoting2/branches/2.x/src/main/org/jboss/remoting/loading/ObjectInputSt= reamWithClassLoader.java Log: JBREM-1116: Eliminated dependence on SecurityUtility. Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/loading/ClassB= yteClassLoader.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/loading/ClassByteCla= ssLoader.java 2009-04-14 10:14:29 UTC (rev 5002) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/loading/ClassByteCla= ssLoader.java 2009-04-14 10:15:03 UTC (rev 5003) @@ -26,12 +26,19 @@ import org.jboss.remoting.util.SecurityUtility; = import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.lang.ref.Reference; import java.lang.ref.ReferenceQueue; import java.lang.ref.WeakReference; +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; import java.util.Collections; import java.util.HashMap; import java.util.Map; @@ -180,7 +187,7 @@ { return cl; } - cl =3D Class.forName(className, false, SecurityUtility.getSystemClas= sLoader()); + cl =3D Class.forName(className, false, getSystemClassLoaderPrivate()= ); if(cl !=3D null) { return cl; @@ -208,12 +215,12 @@ File file =3D null; try { - file =3D SecurityUtility.createTempFile("cbc", ".class", true); + file =3D createTempFile("cbc", ".class", true); if(log.isTraceEnabled()) { log.trace("adding resource at: " + name + " to file: " + file); } - out =3D SecurityUtility.getFileOutputStream(file); + out =3D getFileOutputStream(file); out.write(buf); out.flush(); } @@ -253,11 +260,11 @@ { log.trace("getResourceAsStream =3D>" + denormalized + " =3D " + f= ile); } - if(file !=3D null && SecurityUtility.fileExists(file)) + if(file !=3D null && fileExists(file)) { try { - InputStream is =3D SecurityUtility.getFileInputStream(file); + InputStream is =3D getFileInputStream(file); return new java.io.BufferedInputStream(is); } catch(Exception ex) @@ -424,4 +431,113 @@ = return loadedClass; } + = + static private File createTempFile(final String prefix, final String su= ffix, final boolean deleteOnExit) throws IOException + { + if (SecurityUtility.skipAccessControl()) + { + File file =3D File.createTempFile(prefix, suffix); + if (deleteOnExit) file.deleteOnExit(); + return file; + } + = + try + { + return (File)AccessController.doPrivileged( new PrivilegedExcepti= onAction() + { + public Object run() throws IOException + { + File file =3D File.createTempFile(prefix, suffix); + if (deleteOnExit) file.deleteOnExit(); + return file; + } + }); + } + catch (PrivilegedActionException e) + { + throw (IOException) e.getCause(); + } + } + = + static private boolean fileExists(final File file) + { + if (file =3D=3D null) + return false; + = + if (SecurityUtility.skipAccessControl()) + { + return file.exists(); + } + + return ((Boolean)AccessController.doPrivileged( new PrivilegedAction= () + { + public Object run() + { + return new Boolean(file.exists()); + } + })).booleanValue(); + } + = + static private FileInputStream getFileInputStream(final File file) thro= ws FileNotFoundException + { + if (SecurityUtility.skipAccessControl()) + { + return new FileInputStream(file); + } + = + try + { + return (FileInputStream)AccessController.doPrivileged( new Privil= egedExceptionAction() + { + public Object run() throws FileNotFoundException + { + return new FileInputStream(file); + } + }); + } + catch (PrivilegedActionException e) + { + throw (FileNotFoundException) e.getCause(); + } + } + = + static private FileOutputStream getFileOutputStream(final File file) + throws FileNotFoundException + { + if (SecurityUtility.skipAccessControl()) + { + return new FileOutputStream(file); + } + = + try + { + return (FileOutputStream)AccessController.doPrivileged( new Privi= legedExceptionAction() + { + public Object run() throws FileNotFoundException + { + return new FileOutputStream(file); + } + }); + } + catch (PrivilegedActionException e) + { + throw (FileNotFoundException) e.getCause(); + } + } + = + static private ClassLoader getSystemClassLoaderPrivate() + { + if (SecurityUtility.skipAccessControl()) + { + return ClassLoader.getSystemClassLoader(); + } + + return (ClassLoader)AccessController.doPrivileged( new PrivilegedAct= ion() + { + public Object run() + { + return ClassLoader.getSystemClassLoader(); + } + }); + } } Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/loading/Object= InputStreamWithClassLoader.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/loading/ObjectInputS= treamWithClassLoader.java 2009-04-14 10:14:29 UTC (rev 5002) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/loading/ObjectInputS= treamWithClassLoader.java 2009-04-14 10:15:03 UTC (rev 5003) @@ -26,6 +26,9 @@ import java.io.ObjectInputStream; import java.io.StreamCorruptedException; import java.lang.reflect.Method; +import java.security.AccessController; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; import java.util.HashMap; = import org.jboss.logging.Logger; @@ -52,7 +55,7 @@ { try { - clearMethod =3D SecurityUtility.getDeclaredMethod(ObjectInputStre= am.class, "clear", new Class[]{}); + clearMethod =3D getDeclaredMethod(ObjectInputStream.class, "clear= ", new Class[]{}); = } catch (SecurityException e) { log.error(e.getMessage(), e); @@ -259,4 +262,32 @@ } } } + = + static private Method getDeclaredMethod(final Class c, final String nam= e, final Class[] parameterTypes) + throws NoSuchMethodException + { + if (SecurityUtility.skipAccessControl()) + { + Method m =3D c.getDeclaredMethod(name, parameterTypes); + m.setAccessible(true); + return m; + } + + try + { + return (Method) AccessController.doPrivileged( new PrivilegedExce= ptionAction() + { + public Object run() throws NoSuchMethodException + { + Method m =3D c.getDeclaredMethod(name, parameterTypes); + m.setAccessible(true); + return m; + } + }); + } + catch (PrivilegedActionException e) + { + throw (NoSuchMethodException) e.getCause(); + } + } } \ No newline at end of file --===============8759130095519055877==-- From jboss-remoting-commits at lists.jboss.org Tue Apr 14 06:15:48 2009 Content-Type: multipart/mixed; boundary="===============9110089586607402346==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5004 - remoting2/branches/2.x/src/main/org/jboss/remoting/network. Date: Tue, 14 Apr 2009 06:15:47 -0400 Message-ID: <E1LtfgB-0002AH-7t@committer01.frg.pub.inap.atl.jboss.com> --===============9110089586607402346== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-14 06:15:47 -0400 (Tue, 14 Apr 2009) New Revision: 5004 Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/network/NetworkRegist= ry.java remoting2/branches/2.x/src/main/org/jboss/remoting/network/NetworkRegist= ryQuery.java Log: JBREM-1116: Eliminated dependence on SecurityUtility. Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/network/Networ= kRegistry.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/network/NetworkRegis= try.java 2009-04-14 10:15:03 UTC (rev 5003) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/network/NetworkRegis= try.java 2009-04-14 10:15:47 UTC (rev 5004) @@ -22,6 +22,9 @@ = package org.jboss.remoting.network; = +import java.security.AccessController; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; import java.util.HashMap; import java.util.HashSet; import java.util.Map; @@ -269,9 +272,9 @@ Identity identity =3D Identity.get(this.mBeanServer); // this is a slight hack, but we have to have some way to know the m= ain // JBoss MBeanServer data - SecurityUtility.setSystemProperty("jboss.remoting.jmxid", identity.g= etJMXId()); - SecurityUtility.setSystemProperty("jboss.remoting.instanceid", ident= ity.getInstanceId()); - SecurityUtility.setSystemProperty("jboss.remoting.domain", identity.= getDomain()); + setSystemProperty("jboss.remoting.jmxid", identity.getJMXId()); + setSystemProperty("jboss.remoting.instanceid", identity.getInstanceI= d()); + setSystemProperty("jboss.remoting.domain", identity.getDomain()); return objectName; } = @@ -282,7 +285,7 @@ */ public synchronized void changeDomain(String newDomain) { - SecurityUtility.setSystemProperty("jboss.remoting.domain", newDomain= ); + setSystemProperty("jboss.remoting.domain", newDomain); NetworkInstance servers[] =3D getServers(); if(servers =3D=3D null || servers.length <=3D 0) { @@ -305,5 +308,28 @@ } }.start(); } - + = + static private void setSystemProperty(final String name, final String v= alue) + { + if (SecurityUtility.skipAccessControl()) + { + System.setProperty(name, value); + return; + } + = + try + { + AccessController.doPrivileged( new PrivilegedExceptionAction() + { + public Object run() throws Exception + { + return System.setProperty(name, value); + } + }); + } + catch (PrivilegedActionException e) + { + throw (RuntimeException) e.getCause(); + } + } } Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/network/Networ= kRegistryQuery.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/network/NetworkRegis= tryQuery.java 2009-04-14 10:15:03 UTC (rev 5003) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/network/NetworkRegis= tryQuery.java 2009-04-14 10:15:47 UTC (rev 5004) @@ -22,6 +22,10 @@ = package org.jboss.remoting.network; = +import java.security.AccessController; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; + import javax.management.BadAttributeValueExpException; import javax.management.BadBinaryOpValueExpException; import javax.management.BadStringOperationException; @@ -48,7 +52,7 @@ { try { - return SecurityUtility.isInstanceOf(server, objectName, NetworkRe= gistryMBean.class.getName()); + return isInstanceOf(server, objectName, NetworkRegistryMBean.clas= s.getName()); } catch (InstanceNotFoundException e) { @@ -61,4 +65,28 @@ { this.server =3D mBeanServer; } + = + static private boolean isInstanceOf(final MBeanServer server, final Obj= ectName objectName, final String className) + throws InstanceNotFoundException + { + if (SecurityUtility.skipAccessControl()) + { + return server.isInstanceOf(objectName, className); + } + = + try + { + return ((Boolean)AccessController.doPrivileged( new PrivilegedExc= eptionAction() + { + public Object run() throws Exception + { + return new Boolean(server.isInstanceOf(objectName, classNam= e)); + } + })).booleanValue(); + } + catch (PrivilegedActionException e) + { + throw (InstanceNotFoundException) e.getCause(); + } + } } --===============9110089586607402346==-- From jboss-remoting-commits at lists.jboss.org Tue Apr 14 06:16:19 2009 Content-Type: multipart/mixed; boundary="===============3192634150432214708==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5005 - remoting2/branches/2.x/src/main/org/jboss/remoting/samples/detection/jndi. Date: Tue, 14 Apr 2009 06:16:19 -0400 Message-ID: <E1Ltfgh-0002BV-HC@committer01.frg.pub.inap.atl.jboss.com> --===============3192634150432214708== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-14 06:16:19 -0400 (Tue, 14 Apr 2009) New Revision: 5005 Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/samples/detection/jnd= i/SimpleJNDIServer.java Log: JBREM-1116: Eliminated dependence on SecurityUtility. Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/samples/detect= ion/jndi/SimpleJNDIServer.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/samples/detection/jn= di/SimpleJNDIServer.java 2009-04-14 10:15:47 UTC (rev 5004) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/samples/detection/jn= di/SimpleJNDIServer.java 2009-04-14 10:16:19 UTC (rev 5005) @@ -5,6 +5,9 @@ = import java.lang.reflect.Method; import java.net.InetAddress; +import java.security.AccessController; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; = /** * A JNDI server that should be run before running the simple detector cli= ent/server. @@ -95,7 +98,7 @@ namingBeanImplClass =3D Class.forName("org.jnp.server.NamingBeanI= mpl"); namingBean =3D namingBeanImplClass.newInstance(); Method startMethod =3D namingBeanImplClass.getMethod("start", new= Class[] {}); - SecurityUtility.setSystemProperty("java.naming.factory.initial", = "org.jnp.interfaces.NamingContextFactory"); + setSystemProperty("java.naming.factory.initial", "org.jnp.interfa= ces.NamingContextFactory"); startMethod.invoke(namingBean, new Object[] {}); } catch (Exception e) @@ -129,5 +132,28 @@ { System.out.println(new java.util.Date() + ": [SERVER]: " + msg); } - + = + static private void setSystemProperty(final String name, final String v= alue) + { + if (SecurityUtility.skipAccessControl()) + { + System.setProperty(name, value); + return; + } + = + try + { + AccessController.doPrivileged( new PrivilegedExceptionAction() + { + public Object run() throws Exception + { + return System.setProperty(name, value); + } + }); + } + catch (PrivilegedActionException e) + { + throw (RuntimeException) e.getCause(); + } + } } --===============3192634150432214708==-- From jboss-remoting-commits at lists.jboss.org Tue Apr 14 06:16:38 2009 Content-Type: multipart/mixed; boundary="===============0036039918209983300==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5006 - remoting2/branches/2.x/src/main/org/jboss/remoting/samples/transporter/custom/server. Date: Tue, 14 Apr 2009 06:16:38 -0400 Message-ID: <E1Ltfh0-0002By-7e@committer01.frg.pub.inap.atl.jboss.com> --===============0036039918209983300== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-14 06:16:38 -0400 (Tue, 14 Apr 2009) New Revision: 5006 Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/samples/transporter/c= ustom/server/JNDIServer.java Log: JBREM-1116: Eliminated dependence on SecurityUtility. Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/samples/transp= orter/custom/server/JNDIServer.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/samples/transporter/= custom/server/JNDIServer.java 2009-04-14 10:16:19 UTC (rev 5005) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/samples/transporter/= custom/server/JNDIServer.java 2009-04-14 10:16:38 UTC (rev 5006) @@ -27,6 +27,9 @@ = import java.lang.reflect.Method; import java.net.InetAddress; +import java.security.AccessController; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; = /** * @author <a href=3D"mailto:tom.elrod(a)jboss.com">Tom Elrod</a> @@ -46,7 +49,7 @@ namingBeanImplClass =3D Class.forName("org.jnp.server.NamingBe= anImpl"); namingBean =3D namingBeanImplClass.newInstance(); Method startMethod =3D namingBeanImplClass.getMethod("start", = new Class[] {}); - SecurityUtility.setSystemProperty("java.naming.factory.initial= ", "org.jnp.interfaces.NamingContextFactory"); + setSystemProperty("java.naming.factory.initial", "org.jnp.inte= rfaces.NamingContextFactory"); startMethod.invoke(namingBean, new Object[] {}); } catch (Exception e) @@ -81,4 +84,28 @@ } = } + = + static private void setSystemProperty(final String name, final String v= alue) + { + if (SecurityUtility.skipAccessControl()) + { + System.setProperty(name, value); + return; + } + = + try + { + AccessController.doPrivileged( new PrivilegedExceptionAction() + { + public Object run() throws Exception + { + return System.setProperty(name, value); + } + }); + } + catch (PrivilegedActionException e) + { + throw (RuntimeException) e.getCause(); + } + } } \ No newline at end of file --===============0036039918209983300==-- From jboss-remoting-commits at lists.jboss.org Tue Apr 14 06:17:17 2009 Content-Type: multipart/mixed; boundary="===============0449192252552614253==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5007 - remoting2/branches/2.x/src/main/org/jboss/remoting/security. Date: Tue, 14 Apr 2009 06:17:17 -0400 Message-ID: <E1Ltfhd-0002Dq-9Y@committer01.frg.pub.inap.atl.jboss.com> --===============0449192252552614253== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-14 06:17:17 -0400 (Tue, 14 Apr 2009) New Revision: 5007 Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/security/SSLSocketBui= lder.java remoting2/branches/2.x/src/main/org/jboss/remoting/security/ServerSocket= FactoryWrapper.java Log: JBREM-1116: Eliminated dependence on SecurityUtility. Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/security/SSLSo= cketBuilder.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/security/SSLSocketBu= ilder.java 2009-04-14 10:16:38 UTC (rev 5006) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/security/SSLSocketBu= ilder.java 2009-04-14 10:17:17 UTC (rev 5007) @@ -396,14 +396,14 @@ = if (getUseSSLSocketFactory()) { - String defaultFactoryName =3D SecurityUtility.getSystemProperty(R= EMOTING_DEFAULT_SOCKET_FACTORY_CLASS); + String defaultFactoryName =3D getSystemProperty(REMOTING_DEFAULT_= SOCKET_FACTORY_CLASS); = if (defaultFactoryName !=3D null) { try { final Class sfClass =3D ClassLoaderUtility.loadClass(defaul= tFactoryName, SSLSocketBuilder.class); - Method m =3D SecurityUtility.getMethod(sfClass, "getDefault= ", null); + Method m =3D getMethod(sfClass, "getDefault", null); = if (m =3D=3D null) { @@ -616,7 +616,7 @@ = if(keyStoreFilePath =3D=3D null) { - String path =3D SecurityUtility.getSystemProperty(STANDARD_KEY_ST= ORE_FILE_PATH);; + String path =3D getSystemProperty(STANDARD_KEY_STORE_FILE_PATH);; if(path !=3D null && path.length() > 0) { setKeyStoreURL( path ); @@ -670,7 +670,7 @@ = if(keyStoreType =3D=3D null) { - keyStoreType =3D SecurityUtility.getSystemProperty(STANDARD_KEY_S= TORE_TYPE); + keyStoreType =3D getSystemProperty(STANDARD_KEY_STORE_TYPE); if(keyStoreType =3D=3D null) { keyStoreType =3D DEFAULT_KEY_STORE_TYPE; @@ -746,7 +746,7 @@ = if(keyStorePassword =3D=3D null) { - keyStorePassword =3D SecurityUtility.getSystemProperty(STANDARD_K= EY_STORE_PASSWORD); + keyStorePassword =3D getSystemProperty(STANDARD_KEY_STORE_PASSWOR= D); } = return keyStorePassword; @@ -797,7 +797,7 @@ = if(trustStoreFilePath =3D=3D null) { - String path =3D SecurityUtility.getSystemProperty(STANDARD_TRUST_= STORE_FILE_PATH); + String path =3D getSystemProperty(STANDARD_TRUST_STORE_FILE_PATH); if(path !=3D null && path.length() > 0) { setTrustStoreURL( path ); @@ -851,7 +851,7 @@ = if(trustStoreType =3D=3D null) { - trustStoreType =3D SecurityUtility.getSystemProperty(STANDARD_TRU= ST_STORE_TYPE); + trustStoreType =3D getSystemProperty(STANDARD_TRUST_STORE_TYPE); if(trustStoreType =3D=3D null) { trustStoreType =3D getKeyStoreType(); @@ -927,7 +927,7 @@ = if(trustStorePassword =3D=3D null) { - trustStorePassword =3D SecurityUtility.getSystemProperty(STANDARD= _TRUST_STORE_PASSWORD); + trustStorePassword =3D getSystemProperty(STANDARD_TRUST_STORE_PAS= SWORD); if(trustStorePassword =3D=3D null) { trustStorePassword =3D getKeyStorePassword(); @@ -1716,4 +1716,52 @@ super(message); } } + = + static private String getSystemProperty(final String name) + { + if (SecurityUtility.skipAccessControl()) + return System.getProperty(name); + = + String value =3D null; + try + { + value =3D (String)AccessController.doPrivileged( new PrivilegedEx= ceptionAction() + { + public Object run() throws Exception + { + return System.getProperty(name); + } + }); + } + catch (PrivilegedActionException e) + { + throw (RuntimeException) e.getCause(); + } + = + return value; + } + = + static private Method getMethod(final Class c, final String name, final= Class[] parameterTypes) + throws NoSuchMethodException + { + if (SecurityUtility.skipAccessControl()) + { + return c.getMethod(name, parameterTypes); + } + + try + { + return (Method) AccessController.doPrivileged( new PrivilegedExce= ptionAction() + { + public Object run() throws NoSuchMethodException + { + return c.getMethod(name, parameterTypes); + } + }); + } + catch (PrivilegedActionException e) + { + throw (NoSuchMethodException) e.getCause(); + } + } } \ No newline at end of file Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/security/Serve= rSocketFactoryWrapper.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/security/ServerSocke= tFactoryWrapper.java 2009-04-14 10:16:38 UTC (rev 5006) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/security/ServerSocke= tFactoryWrapper.java 2009-04-14 10:17:17 UTC (rev 5007) @@ -24,6 +24,9 @@ import java.io.IOException; import java.net.InetAddress; import java.net.ServerSocket; +import java.security.AccessController; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; = import javax.net.ServerSocketFactory; = @@ -43,27 +46,124 @@ = public ServerSocket createServerSocket(final int i) throws IOException { - return SecurityUtility.createServerSocket(serverSocketFactory, i); + return createServerSocket(serverSocketFactory, i); } = public ServerSocket createServerSocket(final int i, final int i1) throw= s IOException { - return SecurityUtility.createServerSocket(serverSocketFactory, i, i1= ); + return createServerSocket(serverSocketFactory, i, i1); } = public ServerSocket createServerSocket(final int i, final int i1, final= InetAddress inetAddress) throws IOException { - return SecurityUtility.createServerSocket(serverSocketFactory, i, i1= , inetAddress); + return createServerSocket(serverSocketFactory, i, i1, inetAddress); } = public ServerSocket createServerSocket() throws IOException { - return SecurityUtility.createServerSocket(serverSocketFactory); + return createServerSocket(serverSocketFactory); } = public ServerSocketFactoryMBean getDelegate() { return serverSocketFactory; } + = + static private ServerSocket createServerSocket(final ServerSocketFactor= yMBean ssf) throws IOException + { + if (SecurityUtility.skipAccessControl()) + { + return ssf.createServerSocket(); + } = + try + { + return (ServerSocket)AccessController.doPrivileged( new Privilege= dExceptionAction() + { + public Object run() throws IOException + { + return ssf.createServerSocket(); + } + }); + } + catch (PrivilegedActionException e) + { + throw (IOException) e.getCause(); + } + } + = + static private ServerSocket createServerSocket(final ServerSocketFactor= yMBean ssf, + final int port) throws IO= Exception + { + if (SecurityUtility.skipAccessControl()) + { + return ssf.createServerSocket(port); + } + = + try + { + return (ServerSocket)AccessController.doPrivileged( new Privileg= edExceptionAction() + { + public Object run() throws Exception + { + return ssf.createServerSocket(port); + } + }); + } + catch (PrivilegedActionException e) + { + throw (IOException) e.getCause(); + } + } + = + static private ServerSocket createServerSocket(final ServerSocketFactor= yMBean ssf, + final int port, final int= backlog) + throws IOException + { + if (SecurityUtility.skipAccessControl()) + { + return ssf.createServerSocket(port, backlog); + } + + try + { + return (ServerSocket)AccessController.doPrivileged( new Privilege= dExceptionAction() + { + public Object run() throws Exception + { + return ssf.createServerSocket(port, backlog); + } + }); + } + catch (PrivilegedActionException e) + { + throw (IOException) e.getCause(); + } + } + = + static private ServerSocket createServerSocket(final ServerSocketFactor= yMBean ssf, + final int port, final int= backlog, + final InetAddress inetAdd= ress) + throws IOException + { + if (SecurityUtility.skipAccessControl()) + { + return ssf.createServerSocket(port, backlog, inetAddress); + } + + try + { + return (ServerSocket)AccessController.doPrivileged( new Privilege= dExceptionAction() + { + public Object run() throws Exception + { + return ssf.createServerSocket(port, backlog, inetAddress); + } + }); + } + catch (PrivilegedActionException e) + { + throw (IOException) e.getCause(); + } + } } \ No newline at end of file --===============0449192252552614253==-- From jboss-remoting-commits at lists.jboss.org Tue Apr 14 06:17:38 2009 Content-Type: multipart/mixed; boundary="===============4612495069029158275==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5008 - remoting2/branches/2.x/src/main/org/jboss/remoting/serialization. Date: Tue, 14 Apr 2009 06:17:38 -0400 Message-ID: <E1Ltfhy-0002Ey-Ne@committer01.frg.pub.inap.atl.jboss.com> --===============4612495069029158275== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-14 06:17:38 -0400 (Tue, 14 Apr 2009) New Revision: 5008 Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/serialization/Seriali= zationStreamFactory.java Log: JBREM-1116: Eliminated dependence on SecurityUtility. Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/serialization/= SerializationStreamFactory.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/serialization/Serial= izationStreamFactory.java 2009-04-14 10:17:17 UTC (rev 5007) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/serialization/Serial= izationStreamFactory.java 2009-04-14 10:17:38 UTC (rev 5008) @@ -30,6 +30,7 @@ = import java.io.IOException; import java.security.AccessController; +import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; import java.util.HashMap; import java.util.Map; @@ -60,7 +61,7 @@ try { String defaultValue =3D JavaSerializationManager.class.getName(); - String managerClassName =3D SecurityUtility.getSystemProperty("SE= RIALIZATION", defaultValue); + String managerClassName =3D getSystemProperty("SERIALIZATION", de= faultValue); setManagerClassName(DEFAULT, managerClassName); } catch(Exception e) @@ -196,4 +197,27 @@ return getManagerInstance(DEFAULT); } = + static private String getSystemProperty(final String name, final String= defaultValue) + { + if (SecurityUtility.skipAccessControl()) + return System.getProperty(name, defaultValue); + = + String value =3D null; + try + { + value =3D (String)AccessController.doPrivileged( new PrivilegedEx= ceptionAction() + { + public Object run() throws Exception + { + return System.getProperty(name, defaultValue); + } + }); + } + catch (PrivilegedActionException e) + { + throw (RuntimeException) e.getCause(); + } + = + return value; + } } \ No newline at end of file --===============4612495069029158275==-- From jboss-remoting-commits at lists.jboss.org Tue Apr 14 06:17:57 2009 Content-Type: multipart/mixed; boundary="===============1153252717062267384==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5009 - remoting2/branches/2.x/src/main/org/jboss/remoting/serialization/impl/java. Date: Tue, 14 Apr 2009 06:17:57 -0400 Message-ID: <E1LtfiH-0002Fz-Q1@committer01.frg.pub.inap.atl.jboss.com> --===============1153252717062267384== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-14 06:17:57 -0400 (Tue, 14 Apr 2009) New Revision: 5009 Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/serialization/impl/ja= va/ClearableObjectOutputStream.java Log: JBREM-1116: Eliminated dependence on SecurityUtility. Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/serialization/= impl/java/ClearableObjectOutputStream.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/serialization/impl/j= ava/ClearableObjectOutputStream.java 2009-04-14 10:17:38 UTC (rev 5008) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/serialization/impl/j= ava/ClearableObjectOutputStream.java 2009-04-14 10:17:57 UTC (rev 5009) @@ -26,6 +26,9 @@ import java.io.ObjectOutputStream; import java.io.OutputStream; import java.lang.reflect.Method; +import java.security.AccessController; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; = import org.jboss.logging.Logger; import org.jboss.remoting.util.SecurityUtility; @@ -47,7 +50,7 @@ { try { - clearMethod =3D SecurityUtility.getDeclaredMethod(ObjectOutputStr= eam.class, "clear", new Class[]{}); + clearMethod =3D getDeclaredMethod(ObjectOutputStream.class, "clea= r", new Class[]{}); } catch (SecurityException e) { @@ -75,5 +78,33 @@ log.error(e.getMessage(), e); } } + = + static private Method getDeclaredMethod(final Class c, final String nam= e, final Class[] parameterTypes) + throws NoSuchMethodException + { + if (SecurityUtility.skipAccessControl()) + { + Method m =3D c.getDeclaredMethod(name, parameterTypes); + m.setAccessible(true); + return m; + } + + try + { + return (Method) AccessController.doPrivileged( new PrivilegedExce= ptionAction() + { + public Object run() throws NoSuchMethodException + { + Method m =3D c.getDeclaredMethod(name, parameterTypes); + m.setAccessible(true); + return m; + } + }); + } + catch (PrivilegedActionException e) + { + throw (NoSuchMethodException) e.getCause(); + } + } } = --===============1153252717062267384==-- From jboss-remoting-commits at lists.jboss.org Tue Apr 14 06:18:15 2009 Content-Type: multipart/mixed; boundary="===============7876650518010975842==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5010 - remoting2/branches/2.x/src/main/org/jboss/remoting/socketfactory. Date: Tue, 14 Apr 2009 06:18:15 -0400 Message-ID: <E1LtfiZ-0002Gx-LR@committer01.frg.pub.inap.atl.jboss.com> --===============7876650518010975842== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-14 06:18:15 -0400 (Tue, 14 Apr 2009) New Revision: 5010 Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/socketfactory/Creatio= nListenerServerSocket.java Log: JBREM-1116: Eliminated dependence on SecurityUtility. Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/socketfactory/= CreationListenerServerSocket.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/socketfactory/Creati= onListenerServerSocket.java 2009-04-14 10:17:57 UTC (rev 5009) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/socketfactory/Creati= onListenerServerSocket.java 2009-04-14 10:18:15 UTC (rev 5010) @@ -94,13 +94,13 @@ = public void bind(SocketAddress endpoint) throws IOException { - SecurityUtility.bind(serverSocket, endpoint); + bind(serverSocket, endpoint); } = = public void bind(SocketAddress endpoint, int backlog) throws IOException { - SecurityUtility.bind(serverSocket, endpoint, backlog); + bind(serverSocket, endpoint, backlog); } = = @@ -223,4 +223,56 @@ { return serverSocket.toString(); } + = + static private void bind(final ServerSocket ss, final SocketAddress add= ress) + throws IOException + { + if (SecurityUtility.skipAccessControl()) + { + ss.bind(address); + return; + } + + try + { + AccessController.doPrivileged( new PrivilegedExceptionAction() + { + public Object run() throws Exception + { + ss.bind(address); + return null; + } + }); + } + catch (PrivilegedActionException e) + { + throw (IOException) e.getCause(); + } + } + + static private void bind(final ServerSocket ss, final SocketAddress add= ress, + final int backlog) throws IOException + { + if (SecurityUtility.skipAccessControl()) + { + ss.bind(address, backlog); + return; + } + = + try + { + AccessController.doPrivileged( new PrivilegedExceptionAction() + { + public Object run() throws Exception + { + ss.bind(address, backlog); + return null; + } + }); + } + catch (PrivilegedActionException e) + { + throw (IOException) e.getCause(); + } + } } --===============7876650518010975842==-- From jboss-remoting-commits at lists.jboss.org Tue Apr 14 06:18:35 2009 Content-Type: multipart/mixed; boundary="===============0346636045318232321==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5011 - remoting2/branches/2.x/src/main/org/jboss/remoting/stream. Date: Tue, 14 Apr 2009 06:18:35 -0400 Message-ID: <E1Ltfit-0002I3-3g@committer01.frg.pub.inap.atl.jboss.com> --===============0346636045318232321== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-14 06:18:34 -0400 (Tue, 14 Apr 2009) New Revision: 5011 Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/stream/StreamServer.j= ava Log: JBREM-1116: Eliminated dependence on SecurityUtility. Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/stream/StreamS= erver.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/stream/StreamServer.= java 2009-04-14 10:18:15 UTC (rev 5010) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/stream/StreamServer.= java 2009-04-14 10:18:34 UTC (rev 5011) @@ -117,16 +117,16 @@ private String getLocatorURI() throws IOException { // check for system properties for locator values - transport =3D SecurityUtility.getSystemProperty(STREAM_TRANSPORT_KEY= , transport); + transport =3D getSystemProperty(STREAM_TRANSPORT_KEY, transport); try { - host =3D SecurityUtility.getLocalHostName(); + host =3D getLocalHostName(); } catch(UnknownHostException e) { try { - InetAddress localAddress =3D SecurityUtility.getLocalHost(); + InetAddress localAddress =3D getLocalHost(); host =3D localAddress.getHostAddress(); } catch(UnknownHostException e1) @@ -135,9 +135,9 @@ } } = - host =3D SecurityUtility.getSystemProperty(STREAM_HOST_KEY, host); + host =3D getSystemProperty(STREAM_HOST_KEY, host); String defaultPort =3D "" + PortUtil.findFreePort(host); - String sPort =3D SecurityUtility.getSystemProperty(STREAM_PORT_KEY, = defaultPort); + String sPort =3D getSystemProperty(STREAM_PORT_KEY, defaultPort); = try { @@ -314,4 +314,97 @@ } } = + static private String getSystemProperty(final String name, final String= defaultValue) + { + if (SecurityUtility.skipAccessControl()) + return System.getProperty(name, defaultValue); + = + String value =3D null; + try + { + value =3D (String)AccessController.doPrivileged( new PrivilegedEx= ceptionAction() + { + public Object run() throws Exception + { + return System.getProperty(name, defaultValue); + } + }); + } + catch (PrivilegedActionException e) + { + throw (RuntimeException) e.getCause(); + } + = + return value; + } + = + static private InetAddress getLocalHost() throws UnknownHostException + { + if (SecurityUtility.skipAccessControl()) + { + try + { + return InetAddress.getLocalHost(); + } + catch (IOException e) + { + return InetAddress.getByName("127.0.0.1"); + } + } + + try + { + return (InetAddress) AccessController.doPrivileged( new Privilege= dExceptionAction() + { + public Object run() throws IOException + { + try + { + return InetAddress.getLocalHost(); + } + catch (IOException e) + { + return InetAddress.getByName("127.0.0.1"); + } + } + }); + } + catch (PrivilegedActionException e) + { + throw (UnknownHostException) e.getCause(); + } + } + = + static private String getLocalHostName() throws UnknownHostException + { + if (SecurityUtility.skipAccessControl()) + { + return getLocalHost().getHostName(); + } + + try + { + return (String) AccessController.doPrivileged( new PrivilegedExce= ptionAction() + { + public Object run() throws IOException + { + InetAddress address =3D null; + try + { + address =3D InetAddress.getLocalHost(); + } + catch (IOException e) + { + address =3D InetAddress.getByName("127.0.0.1"); + } + = + return address.getHostName(); + } + }); + } + catch (PrivilegedActionException e) + { + throw (UnknownHostException) e.getCause(); + } + } } \ No newline at end of file --===============0346636045318232321==-- From jboss-remoting-commits at lists.jboss.org Tue Apr 14 06:19:07 2009 Content-Type: multipart/mixed; boundary="===============3610627854591879888==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5012 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport. Date: Tue, 14 Apr 2009 06:19:07 -0400 Message-ID: <E1LtfjP-0002K3-0e@committer01.frg.pub.inap.atl.jboss.com> --===============3610627854591879888== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-14 06:19:06 -0400 (Tue, 14 Apr 2009) New Revision: 5012 Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/AddressUtil= .java remoting2/branches/2.x/src/main/org/jboss/remoting/transport/Connector.j= ava Log: JBREM-1116: Eliminated dependence on SecurityUtility. Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/Addr= essUtil.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/AddressUti= l.java 2009-04-14 10:18:34 UTC (rev 5011) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/AddressUti= l.java 2009-04-14 10:19:06 UTC (rev 5012) @@ -22,9 +22,11 @@ */ package org.jboss.remoting.transport; = +import java.io.IOException; import java.net.InetAddress; import java.net.ServerSocket; import java.net.Socket; +import java.net.UnknownHostException; import java.security.AccessController; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; @@ -58,7 +60,7 @@ { log.trace("checking host: " + host); int port =3D PortUtil.findFreePort(host); - InetAddress addr =3D SecurityUtility.getAddressByName(host); + InetAddress addr =3D getAddressByName(host); ServerTestThread t1 =3D new ServerTestThread(addr, port); t1.setDaemon(true); t1.start(); @@ -137,5 +139,28 @@ } } } + = + static private InetAddress getAddressByName(final String host) throws U= nknownHostException + { + if (SecurityUtility.skipAccessControl()) + { + return InetAddress.getByName(host); + } + = + try + { + return (InetAddress)AccessController.doPrivileged( new Privileged= ExceptionAction() + { + public Object run() throws IOException + { + return InetAddress.getByName(host); + } + }); + } + catch (PrivilegedActionException e) + { + throw (UnknownHostException) e.getCause(); + } + } } = Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/Conn= ector.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/Connector.= java 2009-04-14 10:18:34 UTC (rev 5011) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/Connector.= java 2009-04-14 10:19:06 UTC (rev 5012) @@ -47,6 +47,10 @@ import javax.management.ObjectName; import javax.net.ServerSocketFactory; import javax.net.SocketFactory; + +import java.io.IOException; +import java.net.InetAddress; +import java.net.UnknownHostException; import java.security.AccessController; import java.security.PrivilegedAction; import java.security.PrivilegedActionException; @@ -601,7 +605,7 @@ String clientConnectPort =3D (String) invokerConfig.get("cl= ientConnectPort"); String serverBindAddress =3D (String) invokerConfig.get("se= rverBindAddress"); String serverBindPort =3D (String) invokerConfig.get("serve= rBindPort"); - String localHostAddress =3D SecurityUtility.getLocalHost().= getHostAddress(); = + String localHostAddress =3D getLocalHost().getHostAddress()= ; = = String tempURI =3D null; String path =3D (String) invokerConfig.get("path"); @@ -801,7 +805,7 @@ boolean parametersStarted =3D false; if (connectHomes =3D=3D null && homes =3D=3D null) { - String localHostAddress =3D SecurityUtility.getLocalHost().get= HostAddress(); + String localHostAddress =3D getLocalHost().getHostAddress(); = // A single home configuration. String host =3D clientConnectAddress !=3D null = @@ -1100,7 +1104,7 @@ try { ObjectName objName =3D new ObjectName(invoker.getMBeanOb= jectName()); - SecurityUtility.unregisterMBean(server, objName); + unregisterMBean(server, objName); } catch (Exception e) { @@ -1450,4 +1454,67 @@ } this.remoteClassLoaders =3D classLoaders; } + = + static private void unregisterMBean(final MBeanServer server, final Obj= ectName name) + throws Exception + { + if (SecurityUtility.skipAccessControl()) + { + server.unregisterMBean(name); + return; + } + = + try + { + AccessController.doPrivileged( new PrivilegedExceptionAction() + { + public Object run() throws Exception + { + server.unregisterMBean(name); + return null; + } + }); + } + catch (PrivilegedActionException e) + { + throw (Exception) e.getCause(); + } + } + = + static private InetAddress getLocalHost() throws UnknownHostException + { + if (SecurityUtility.skipAccessControl()) + { + try + { + return InetAddress.getLocalHost(); + } + catch (IOException e) + { + return InetAddress.getByName("127.0.0.1"); + } + } + + try + { + return (InetAddress) AccessController.doPrivileged( new Privilege= dExceptionAction() + { + public Object run() throws IOException + { + try + { + return InetAddress.getLocalHost(); + } + catch (IOException e) + { + return InetAddress.getByName("127.0.0.1"); + } + } + }); + } + catch (PrivilegedActionException e) + { + throw (UnknownHostException) e.getCause(); + } + } } --===============3610627854591879888==-- From jboss-remoting-commits at lists.jboss.org Tue Apr 14 06:19:39 2009 Content-Type: multipart/mixed; boundary="===============1830191066551552369==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5013 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport/bisocket. Date: Tue, 14 Apr 2009 06:19:39 -0400 Message-ID: <E1Ltfjv-0002Ml-F2@committer01.frg.pub.inap.atl.jboss.com> --===============1830191066551552369== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-14 06:19:39 -0400 (Tue, 14 Apr 2009) New Revision: 5013 Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/bisocket/Bi= socketClientInvoker.java remoting2/branches/2.x/src/main/org/jboss/remoting/transport/bisocket/Bi= socketServerInvoker.java Log: JBREM-1116: Eliminated dependence on SecurityUtility. Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/biso= cket/BisocketClientInvoker.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/bisocket/B= isocketClientInvoker.java 2009-04-14 10:19:06 UTC (rev 5012) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/bisocket/B= isocketClientInvoker.java 2009-04-14 10:19:39 UTC (rev 5013) @@ -26,6 +26,9 @@ import java.io.OutputStream; import java.lang.reflect.Method; import java.net.Socket; +import java.security.AccessController; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; @@ -630,7 +633,7 @@ = try { - Method purge =3D SecurityUtility.getDeclaredMethod(Timer.class= , "purge", new Class[]{}); + Method purge =3D getDeclaredMethod(Timer.class, "purge", new C= lass[]{}); purge.invoke(timer, new Object[]{}); } catch (Exception e) @@ -685,4 +688,32 @@ this.flag =3D flag; } } + = + static private Method getDeclaredMethod(final Class c, final String nam= e, final Class[] parameterTypes) + throws NoSuchMethodException + { + if (SecurityUtility.skipAccessControl()) + { + Method m =3D c.getDeclaredMethod(name, parameterTypes); + m.setAccessible(true); + return m; + } + + try + { + return (Method) AccessController.doPrivileged( new PrivilegedExce= ptionAction() + { + public Object run() throws NoSuchMethodException + { + Method m =3D c.getDeclaredMethod(name, parameterTypes); + m.setAccessible(true); + return m; + } + }); + } + catch (PrivilegedActionException e) + { + throw (NoSuchMethodException) e.getCause(); + } + } } \ No newline at end of file Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/biso= cket/BisocketServerInvoker.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/bisocket/B= isocketServerInvoker.java 2009-04-14 10:19:06 UTC (rev 5012) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/bisocket/B= isocketServerInvoker.java 2009-04-14 10:19:39 UTC (rev 5013) @@ -1205,7 +1205,7 @@ = try { - Method purge =3D SecurityUtility.getDeclaredMethod(Timer.class= , "purge", new Class[]{}); + Method purge =3D getDeclaredMethod(Timer.class, "purge", new C= lass[]{}); purge.invoke(timer, new Object[]{}); } catch (Exception e) @@ -1308,4 +1308,32 @@ { private static final long serialVersionUID =3D 2846502029152028732L; } + = + static private Method getDeclaredMethod(final Class c, final String nam= e, final Class[] parameterTypes) + throws NoSuchMethodException + { + if (SecurityUtility.skipAccessControl()) + { + Method m =3D c.getDeclaredMethod(name, parameterTypes); + m.setAccessible(true); + return m; + } + + try + { + return (Method) AccessController.doPrivileged( new PrivilegedExce= ptionAction() + { + public Object run() throws NoSuchMethodException + { + Method m =3D c.getDeclaredMethod(name, parameterTypes); + m.setAccessible(true); + return m; + } + }); + } + catch (PrivilegedActionException e) + { + throw (NoSuchMethodException) e.getCause(); + } + } } \ No newline at end of file --===============1830191066551552369==-- From jboss-remoting-commits at lists.jboss.org Tue Apr 14 06:19:59 2009 Content-Type: multipart/mixed; boundary="===============1915503576151872492==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5014 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport/coyote. Date: Tue, 14 Apr 2009 06:19:59 -0400 Message-ID: <E1LtfkF-0002Om-Nc@committer01.frg.pub.inap.atl.jboss.com> --===============1915503576151872492== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-14 06:19:59 -0400 (Tue, 14 Apr 2009) New Revision: 5014 Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/coyote/Coyo= teInvoker.java Log: JBREM-1116: Eliminated dependence on SecurityUtility. Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/coyo= te/CoyoteInvoker.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/coyote/Coy= oteInvoker.java 2009-04-14 10:19:39 UTC (rev 5013) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/coyote/Coy= oteInvoker.java 2009-04-14 10:19:59 UTC (rev 5014) @@ -163,7 +163,7 @@ Class clazz =3D null; try { - clazz =3D (Class) SecurityUtility.forName(protocolHandlerClassNam= e); + clazz =3D (Class) forName(protocolHandlerClassName); } catch (ClassNotFoundException e) { @@ -363,7 +363,7 @@ if (remoteAddressMB !=3D null) { String remoteAddressString =3D remoteAddressMB.toString(); - InetAddress remoteAddress =3D SecurityUtility.getAddressByN= ame(remoteAddressString); + InetAddress remoteAddress =3D getAddressByName(remoteAddres= sString); invocationRequest.getRequestPayload().put(Remoting.CLIENT_A= DDRESS, remoteAddress); = } else @@ -1079,7 +1079,7 @@ { try { - params[0] =3D SecurityUtility.getAddressByName(value); + params[0] =3D getAddressByName(value); } catch(UnknownHostException exc) { @@ -1144,5 +1144,50 @@ { return true; } - + = + static private Object forName(final String className) throws ClassNotFo= undException + { + if (SecurityUtility.skipAccessControl()) + { + return Class.forName(className); + } + = + try + { + return AccessController.doPrivileged( new PrivilegedExceptionAct= ion() + { + public Object run() throws Exception + { + return Class.forName(className); + } + }); + } + catch (PrivilegedActionException e) + { + throw (ClassNotFoundException) e.getCause(); + } + } + = + static private InetAddress getAddressByName(final String host) throws U= nknownHostException + { + if (SecurityUtility.skipAccessControl()) + { + return InetAddress.getByName(host); + } + = + try + { + return (InetAddress)AccessController.doPrivileged( new Privileged= ExceptionAction() + { + public Object run() throws IOException + { + return InetAddress.getByName(host); + } + }); + } + catch (PrivilegedActionException e) + { + throw (UnknownHostException) e.getCause(); + } + } } --===============1915503576151872492==-- From jboss-remoting-commits at lists.jboss.org Tue Apr 14 06:20:18 2009 Content-Type: multipart/mixed; boundary="===============6274534018379326439==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5015 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport/coyote/ssl. Date: Tue, 14 Apr 2009 06:20:18 -0400 Message-ID: <E1LtfkY-0003X0-Fe@committer01.frg.pub.inap.atl.jboss.com> --===============6274534018379326439== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-14 06:20:18 -0400 (Tue, 14 Apr 2009) New Revision: 5015 Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/coyote/ssl/= RemotingServerSocketFactory.java Log: JBREM-1116: Eliminated dependence on SecurityUtility. Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/coyo= te/ssl/RemotingServerSocketFactory.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/coyote/ssl= /RemotingServerSocketFactory.java 2009-04-14 10:19:59 UTC (rev 5014) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/coyote/ssl= /RemotingServerSocketFactory.java 2009-04-14 10:20:18 UTC (rev 5015) @@ -36,6 +36,9 @@ import java.net.InetAddress; import java.net.ServerSocket; import java.net.Socket; +import java.security.AccessController; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; import java.util.HashMap; import java.util.Map; = @@ -183,7 +186,7 @@ */ public Socket acceptSocket(ServerSocket serverSocket) throws IOException { - return SecurityUtility.accept(serverSocket); + return accept(serverSocket); } = /** @@ -204,4 +207,27 @@ { serverSocketFactories.put(locatorURI, svrSocketFactory); } + = + static private Socket accept(final ServerSocket ss) throws IOException + { + if (SecurityUtility.skipAccessControl()) + { + return ss.accept(); + } + = + try + { + return (Socket)AccessController.doPrivileged( new PrivilegedExce= ptionAction() + { + public Object run() throws Exception + { + return ss.accept(); + } + }); + } + catch (PrivilegedActionException e) + { + throw (IOException) e.getCause(); + } + } } \ No newline at end of file --===============6274534018379326439==-- From jboss-remoting-commits at lists.jboss.org Tue Apr 14 06:20:53 2009 Content-Type: multipart/mixed; boundary="===============2111765592236435589==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5016 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport/http. Date: Tue, 14 Apr 2009 06:20:53 -0400 Message-ID: <E1Ltfl7-0003oA-6J@committer01.frg.pub.inap.atl.jboss.com> --===============2111765592236435589== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-14 06:20:53 -0400 (Tue, 14 Apr 2009) New Revision: 5016 Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/http/HTTPCl= ientInvoker.java Log: JBREM-1116: Eliminated dependence on SecurityUtility. Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/http= /HTTPClientInvoker.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/http/HTTPC= lientInvoker.java 2009-04-14 10:20:18 UTC (rev 5015) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/http/HTTPC= lientInvoker.java 2009-04-14 10:20:53 UTC (rev 5016) @@ -64,6 +64,9 @@ import java.net.SocketAddress; import java.net.SocketTimeoutException; import java.net.URL; +import java.security.AccessController; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; import java.util.HashMap; import java.util.Iterator; import java.util.List; @@ -328,12 +331,12 @@ conn.setDoInput(true); conn.setRequestMethod(type); = - OutputStream stream =3D SecurityUtility.getOutputStream(conn);= = + OutputStream stream =3D getOutputStream(conn); = if (marshaller instanceof VersionedMarshaller) ((VersionedMarshaller) marshaller).write(invocation, stream= , getVersion()); else marshaller.write(invocation, stream); - responseCode =3D SecurityUtility.getResponseCode(conn); + responseCode =3D getResponseCode(conn); = Map headers =3D conn.getHeaderFields(); if (metadata =3D=3D null) @@ -355,7 +358,7 @@ } } = - String responseMessage =3D SecurityUtility.getResponseMessage(= conn); + String responseMessage =3D getResponseMessage(conn); metadata.put(HTTPMetadataConstants.RESPONSE_CODE_MESSAGE, resp= onseMessage); metadata.put(HTTPMetadataConstants.RESPONSE_CODE, new Integer(= responseCode)); metadata.put(HTTPMetadataConstants.RESPONSE_HEADERS, headers); @@ -372,9 +375,9 @@ conn.setDoInput(true); conn.setRequestMethod(type); = - SecurityUtility.connect(conn); + connect(conn); = - InputStream is =3D (SecurityUtility.getResponseCode(conn) < 40= 0) ? conn.getInputStream() : conn.getErrorStream(); + InputStream is =3D (getResponseCode(conn) < 400) ? conn.getInp= utStream() : conn.getErrorStream(); Map headers =3D conn.getHeaderFields(); = if (is !=3D null || unmarshalNullStream) @@ -387,9 +390,9 @@ metadata =3D new HashMap(); } metadata.putAll(headers); - String responseMessage =3D SecurityUtility.getResponseMessage(= conn); + String responseMessage =3D getResponseMessage(conn); metadata.put(HTTPMetadataConstants.RESPONSE_CODE_MESSAGE, resp= onseMessage); - responseCode =3D SecurityUtility.getResponseCode(conn); + responseCode =3D getResponseCode(conn); metadata.put(HTTPMetadataConstants.RESPONSE_CODE, new Integer(= responseCode)); metadata.put(HTTPMetadataConstants.RESPONSE_HEADERS, conn.getH= eaderFields()); } @@ -402,8 +405,8 @@ = try { - String responseMessage =3D SecurityUtility.getResponseMessage(= conn); - int code =3D SecurityUtility.getResponseCode(conn); + String responseMessage =3D getResponseMessage(conn); + int code =3D getResponseCode(conn); message +=3D " Response: " + responseMessage + "/" + code + ".= "; } catch (IOException e1) @@ -495,7 +498,7 @@ conn.setRequestProperty(HTTPMetadataConstants.REMOTING_USER= _AGENT, "JBossRemoting - " + Version.VERSION); conn.setRequestProperty(HTTPMetadataConstants.REMOTING_LEAS= E_QUERY, "true"); conn.setRequestProperty("sessionId", request.getSessionId()= ); - SecurityUtility.connect(conn); + connect(conn); = //InputStream is =3D (conn.getResponseCode() < 400) ? conn.= getInputStream() : conn.getErrorStream(); Map headers =3D conn.getHeaderFields(); @@ -599,7 +602,7 @@ { Class cl =3D conn.getClass(); Class[] paramTypes =3D new Class[] {int.class}; - Method setChunkedLengthMethod =3D SecurityUtility.getMethod= (cl, "setChunkedStreamingMode", paramTypes); + Method setChunkedLengthMethod =3D getMethod(cl, "setChunked= StreamingMode", paramTypes); setChunkedLengthMethod.invoke(conn, new Object[]{new Intege= r(chunkedLength)}); } catch (NoSuchMethodException e) @@ -675,9 +678,9 @@ { Class cl =3D conn.getClass(); Class[] paramTypes =3D new Class[] {int.class}; - Method setTimeoutMethod =3D SecurityUtility.getMethod(cl, "setCon= nectTimeout", paramTypes); + Method setTimeoutMethod =3D getMethod(cl, "setConnectTimeout", pa= ramTypes); setTimeoutMethod.invoke(conn, new Object[]{new Integer(timeout)}); - setTimeoutMethod =3D SecurityUtility.getMethod(cl, "setReadTimeou= t", paramTypes); + setTimeoutMethod =3D getMethod(cl, "setReadTimeout", paramTypes); setTimeoutMethod.invoke(conn, new Object[]{new Integer(timeout)}); return -1; } @@ -817,7 +820,7 @@ } Constructor proxyConstructor =3D proxyClass.getConstructor(new= Class[] {proxyTypeClass, SocketAddress.class}); Object proxy =3D proxyConstructor.newInstance(new Object[] {pr= oxyType, proxyAddress}); - Method openConnection =3D SecurityUtility.getMethod(URL.class,= "openConnection", new Class[] {proxyClass}); + Method openConnection =3D getMethod(URL.class, "openConnection= ", new Class[] {proxyClass}); httpURLConn =3D (HttpURLConnection)openConnection.invoke(exter= nalURL, new Object[] {proxy}); } catch (Exception e) @@ -840,7 +843,7 @@ httpURLConn =3D (HttpURLConnection) externalURL.openConnection(); = // Check if proxy is being configured by system properties. - if (SecurityUtility.getSystemProperty("http.proxyHost") !=3D null) + if (getSystemProperty("http.proxyHost") !=3D null) { String proxyAuth =3D getProxyAuth(metadata); if (proxyAuth !=3D null) @@ -865,7 +868,7 @@ } if (username =3D=3D null || username.length() =3D=3D 0) { - username =3D SecurityUtility.getSystemProperty("http.proxy.userna= me"); + username =3D getSystemProperty("http.proxy.username"); } if (metadata !=3D null) { @@ -873,7 +876,7 @@ } if (password =3D=3D null) { - password =3D SecurityUtility.getSystemProperty("http.proxy.passwo= rd"); + password =3D getSystemProperty("http.proxy.password"); } = if (username !=3D null && password !=3D null) @@ -904,7 +907,7 @@ } if (username =3D=3D null || username.length() =3D=3D 0) { - username =3D SecurityUtility.getSystemProperty("http.basic.userna= me"); + username =3D getSystemProperty("http.basic.username"); } if (metadata !=3D null) { @@ -912,7 +915,7 @@ } if (password =3D=3D null) { - password =3D SecurityUtility.getSystemProperty("http.basic.passwo= rd"); + password =3D getSystemProperty("http.basic.password"); } = if (username !=3D null && password !=3D null) @@ -1129,4 +1132,149 @@ return "WaitingTaskWrapper[" + completeTimeout + "]"; } } + = + static private String getSystemProperty(final String name) + { + if (SecurityUtility.skipAccessControl()) + return System.getProperty(name); + = + String value =3D null; + try + { + value =3D (String)AccessController.doPrivileged( new PrivilegedEx= ceptionAction() + { + public Object run() throws Exception + { + return System.getProperty(name); + } + }); + } + catch (PrivilegedActionException e) + { + throw (RuntimeException) e.getCause(); + } + = + return value; + } + = + static private Method getMethod(final Class c, final String name, final= Class[] parameterTypes) + throws NoSuchMethodException + { + if (SecurityUtility.skipAccessControl()) + { + return c.getMethod(name, parameterTypes); + } + + try + { + return (Method) AccessController.doPrivileged( new PrivilegedExce= ptionAction() + { + public Object run() throws NoSuchMethodException + { + return c.getMethod(name, parameterTypes); + } + }); + } + catch (PrivilegedActionException e) + { + throw (NoSuchMethodException) e.getCause(); + } + } + = + static private void connect(final HttpURLConnection conn) throws IOExce= ption + { + if (SecurityUtility.skipAccessControl()) + { + conn.connect(); + return; + } + + try + { + AccessController.doPrivileged( new PrivilegedExceptionAction() + { + public Object run() throws IOException + { + conn.connect(); + return null; + } + }); + } + catch (PrivilegedActionException e) + { + throw (IOException) e.getCause(); + } + } + = + static private OutputStream getOutputStream(final HttpURLConnection con= n) + throws IOException + { + if (SecurityUtility.skipAccessControl()) + { + return conn.getOutputStream(); + } + = + try + { + return (OutputStream)AccessController.doPrivileged( new Privilege= dExceptionAction() + { + public Object run() throws IOException + { + return conn.getOutputStream(); + } + }); + } + catch (PrivilegedActionException e) + { + throw (IOException) e.getCause(); + } + } + = + static private int getResponseCode(final HttpURLConnection conn) + throws IOException + { + if (SecurityUtility.skipAccessControl()) + { + return conn.getResponseCode(); + } + = + try + { + return ((Integer) AccessController.doPrivileged( new PrivilegedEx= ceptionAction() + { + public Object run() throws IOException + { + return new Integer(conn.getResponseCode()); + } + })).intValue(); + } + catch (PrivilegedActionException e) + { + throw (IOException) e.getCause(); + } + } + = + static private String getResponseMessage(final HttpURLConnection conn) + throws IOException + { + if (SecurityUtility.skipAccessControl()) + { + return conn.getResponseMessage(); + } + = + try + { + return (String) AccessController.doPrivileged( new PrivilegedExce= ptionAction() + { + public Object run() throws IOException + { + return conn.getResponseMessage(); + } + }); + } + catch (PrivilegedActionException e) + { + throw (IOException) e.getCause(); + } + } } \ No newline at end of file --===============2111765592236435589==-- From jboss-remoting-commits at lists.jboss.org Tue Apr 14 06:22:02 2009 Content-Type: multipart/mixed; boundary="===============0192534234451048866==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5017 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi. Date: Tue, 14 Apr 2009 06:22:02 -0400 Message-ID: <E1LtfmE-0003pD-53@committer01.frg.pub.inap.atl.jboss.com> --===============0192534234451048866== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-14 06:22:01 -0400 (Tue, 14 Apr 2009) New Revision: 5017 Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/RMIClie= ntInvoker.java remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/RMIServ= erInvoker.java remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/Remotin= gRMIClientSocketFactory.java remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/Remotin= gRMIServerSocketFactory.java Log: JBREM-1116: Eliminated dependence on SecurityUtility. Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/= RMIClientInvoker.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/RMICli= entInvoker.java 2009-04-14 10:20:53 UTC (rev 5016) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/RMICli= entInvoker.java 2009-04-14 10:22:01 UTC (rev 5017) @@ -43,6 +43,7 @@ import org.jboss.remoting.serialization.SerializationManager; import org.jboss.remoting.serialization.SerializationStreamFactory; import org.jboss.remoting.util.SecurityUtility; +import org.jboss.serial.io.JBossObjectInputStream; import org.jboss.util.threadpool.BasicThreadPool; import org.jboss.util.threadpool.BlockingMode; import org.jboss.util.threadpool.RunnableTaskWrapper; @@ -54,10 +55,14 @@ import java.io.IOException; import java.io.ObjectInputStream; import java.net.SocketTimeoutException; +import java.rmi.NotBoundException; import java.rmi.Remote; import java.rmi.RemoteException; import java.rmi.registry.LocateRegistry; import java.rmi.registry.Registry; +import java.security.AccessController; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; import java.util.HashMap; import java.util.Iterator; import java.util.List; @@ -229,7 +234,7 @@ log.debug(this + " looking up registry: " + host + "," + port); final Registry registry =3D LocateRegistry.getRegistry(host, r= egistryPort); log.debug(this + " trying to connect to: " + home); - Remote remoteObj =3D SecurityUtility.lookup(registry, "remotin= g/RMIServerInvoker/" + port); + Remote remoteObj =3D lookup(registry, "remoting/RMIServerInvok= er/" + port); log.debug("Remote RMI Stub: " + remoteObj); setServerStub((RMIServerInvokerInf) remoteObj); connected =3D true; @@ -358,7 +363,7 @@ try { byteOut.close(); - payload =3D SecurityUtility.readObject(ois); + payload =3D readObject(ois); ois.close(); } catch(ClassNotFoundException e) @@ -377,7 +382,7 @@ int simulatedTimeout =3D getSimulatedTimeout(configuration, metad= ata); if (simulatedTimeout <=3D 0) { - Object result =3D SecurityUtility.callTransport(server, payloa= d); + Object result =3D callTransport(server, payload); return unmarshal(result, unmarshaller, metadata); } else @@ -394,7 +399,7 @@ { try { - resultHolder.value =3D SecurityUtility.callTransport(= server, finalPayload); + resultHolder.value =3D callTransport(server, finalPay= load); if (log.isTraceEnabled()) log.trace("result: " + resu= ltHolder.value); } catch (Exception e) @@ -604,4 +609,86 @@ return "WaitingTaskWrapper[" + completeTimeout + "]"; } } + = + static private Object readObject(final ObjectInputStream ois) + throws IOException, ClassNotFoundException + { + if (SecurityUtility.skipAccessControl() || !(ois instanceof JBossObj= ectInputStream)) + { + return ois.readObject(); + } + + try + { + return AccessController.doPrivileged( new PrivilegedExceptionActi= on() + { + public Object run() throws IOException, ClassNotFoundException + { + return ois.readObject(); + } + }); + } + catch (PrivilegedActionException e) + { + Throwable cause =3D e.getCause(); + if (cause instanceof IOException) + throw (IOException) cause; + else if (cause instanceof ClassNotFoundException) + throw (ClassNotFoundException) cause; + else + throw (RuntimeException) cause; + } + } + = + static private Object callTransport(final RMIServerInvokerInf server, f= inal Object payload) + throws IOException + { + if (SecurityUtility.skipAccessControl()) + { + return server.transport(payload); + } + + try + { + return AccessController.doPrivileged( new PrivilegedExceptionActi= on() + { + public Object run() throws IOException + { + return server.transport(payload); + } + }); + } + catch (PrivilegedActionException e) + { + throw (IOException) e.getCause(); + } = + } + = + static private Remote lookup(final Registry registry, final String name) + throws RemoteException, NotBoundException + { + if (SecurityUtility.skipAccessControl()) + { + return registry.lookup(name); + } + = + try + { + return (Remote) AccessController.doPrivileged( new PrivilegedExce= ptionAction() + { + public Object run() throws Exception + { + return registry.lookup(name); + } + }); + } + catch (PrivilegedActionException e) + { + Throwable cause =3D e.getCause(); + if (cause instanceof RemoteException) + throw (RemoteException) cause; + else + throw (NotBoundException) cause; + } + } } Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/= RMIServerInvoker.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/RMISer= verInvoker.java 2009-04-14 10:20:53 UTC (rev 5016) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/RMISer= verInvoker.java 2009-04-14 10:22:01 UTC (rev 5017) @@ -40,24 +40,35 @@ import org.jboss.remoting.serialization.SerializationManager; import org.jboss.remoting.serialization.SerializationStreamFactory; import org.jboss.remoting.util.SecurityUtility; +import org.jboss.serial.io.JBossObjectOutputStream; import org.jboss.util.propertyeditor.PropertyEditors; import org.jboss.logging.Logger; = import javax.net.SocketFactory; = +import java.beans.IntrospectionException; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.ObjectOutputStream; import java.net.InetAddress; +import java.net.UnknownHostException; +import java.rmi.AccessException; +import java.rmi.NotBoundException; import java.rmi.Remote; import java.rmi.RemoteException; +import java.rmi.registry.LocateRegistry; import java.rmi.registry.Registry; import java.rmi.server.ExportException; +import java.rmi.server.RMIClientSocketFactory; import java.rmi.server.RMIServerSocketFactory; import java.rmi.server.RemoteServer; import java.rmi.server.ServerNotActiveException; import java.rmi.server.UnicastRemoteObject; +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; @@ -141,7 +152,7 @@ { Properties props =3D new Properties(); props.putAll(getConfiguration()); - SecurityUtility.mapJavaBeanProperties(RMIServerInvoker.this, props, = false); + mapJavaBeanProperties(RMIServerInvoker.this, props, false); super.setup(); } = @@ -190,11 +201,11 @@ locator.setHomeInUse(bindHome); RMIServerSocketFactory ssf =3D new RemotingRMIServerSocketFactory(ge= tServerSocketFactory(), BACKLOG_DEFAULT, bindHost, getTimeout()); csf =3D getRMIClientSocketFactory(clientConnectHost); - stub =3D SecurityUtility.exportObject(this, bindPort, csf, ssf); + stub =3D exportObject(this, bindPort, csf, ssf); = log.debug("Binding server to \"remoting/RMIServerInvoker/" + bindPor= t + "\" in registry"); - SecurityUtility.rebind(registry, "remoting/RMIServerInvoker/" + bind= Port, this); - ClassLoader classLoader =3D SecurityUtility.getClassLoader(RMIServer= Invoker.class); + rebind(registry, "remoting/RMIServerInvoker/" + bindPort, this); + ClassLoader classLoader =3D getClassLoader(RMIServerInvoker.class); unmarshaller =3D MarshalFactory.getUnMarshaller(getLocator(), classL= oader, configuration); marshaller =3D MarshalFactory.getMarshaller(getLocator(), classLoade= r, configuration); } @@ -259,14 +270,14 @@ { log.debug("Creating registry for " + port); = - registry =3D SecurityUtility.createRegistry(port); + registry =3D createRegistry(port); } catch(ExportException exportEx) { log.debug("Locating registry for " + port); = // Probably means that the registry already exists, so just get i= t. - registry =3D SecurityUtility.getRegistry(port); + registry =3D getRegistry(port); } if(log.isTraceEnabled()) { @@ -293,7 +304,7 @@ log.debug("locator: " + locator + ", home: " + locator.getHome= InUse()); log.debug(this + " primary: " + isPrimaryServer + " unbinding = " + "remoting/RMIServerInvoker/" + locator.getPort() + " from registry"); Registry registry =3D getRegistry(); - SecurityUtility.unbind(registry, "remoting/RMIServerInvoker/" = + locator.getPort()); + unbind(registry, "remoting/RMIServerInvoker/" + locator.getPor= t()); log.debug("unbound " + "remoting/RMIServerInvoker/" + locator.= getPort() + " from registry"); } catch(Exception e) @@ -368,7 +379,7 @@ ByteArrayOutputStream baos =3D new ByteArrayOutputStream(); SerializationManager manager =3D SerializationStreamFactory= .getManagerInstance(getSerializationType()); ObjectOutputStream oos =3D manager.createOutput(baos); - SecurityUtility.writeObject(oos, payload); + writeObject(oos, payload); oos.flush(); oos.close(); is =3D new ByteArrayInputStream(baos.toByteArray()); @@ -411,7 +422,7 @@ try { String clientHost =3D RemoteServer.getClientHost(); - InetAddress clientAddress =3D SecurityUtility.getAddressByName= (clientHost); + InetAddress clientAddress =3D getAddressByName(clientHost); metadata.put(Remoting.CLIENT_ADDRESS, clientAddress); } catch (ServerNotActiveException e) @@ -451,4 +462,230 @@ { this.rmiOnewayMarshalling =3D rmiOnewayMarshalling; } + = + static private ClassLoader getClassLoader(final Class c) + { + if (SecurityUtility.skipAccessControl()) + { + return c.getClassLoader(); + } + + return (ClassLoader)AccessController.doPrivileged( new PrivilegedAct= ion() + { + public Object run() + { + return c.getClassLoader(); + } + }); + } + = + static private void mapJavaBeanProperties(final Object o, final Propert= ies props, final boolean isStrict) + throws IntrospectionException + { + if (SecurityUtility.skipAccessControl()) + { + PropertyEditors.mapJavaBeanProperties(o, props, isStrict); + return; + } + + try + { + AccessController.doPrivileged( new PrivilegedExceptionAction() + { + public Object run() throws IntrospectionException + { + PropertyEditors.mapJavaBeanProperties(o, props, isStrict); + return null; + } + }); + } + catch (PrivilegedActionException e) + { + throw (IntrospectionException) e.getCause(); + } + } + = + static private void writeObject(final ObjectOutputStream oos, final Obj= ect o) + throws IOException + { + if (SecurityUtility.skipAccessControl() || !(oos instanceof JBossObj= ectOutputStream)) + { + oos.writeObject(o); + return; + } + + try + { + AccessController.doPrivileged( new PrivilegedExceptionAction() + { + public Object run() throws IOException + { + oos.writeObject(o); + return null; + } + }); + } + catch (PrivilegedActionException e) + { + Throwable cause =3D e.getCause(); + if (cause instanceof IOException) + throw (IOException) cause; + else + throw (RuntimeException) cause; + } + } + = + static private InetAddress getAddressByName(final String host) throws U= nknownHostException + { + if (SecurityUtility.skipAccessControl()) + { + return InetAddress.getByName(host); + } + = + try + { + return (InetAddress)AccessController.doPrivileged( new Privileged= ExceptionAction() + { + public Object run() throws IOException + { + return InetAddress.getByName(host); + } + }); + } + catch (PrivilegedActionException e) + { + throw (UnknownHostException) e.getCause(); + } + } + + static private Registry createRegistry(final int port) throws RemoteExc= eption + { + if (SecurityUtility.skipAccessControl()) + { + return LocateRegistry.createRegistry(port); + } + = + try + { + return (Registry) AccessController.doPrivileged( new PrivilegedEx= ceptionAction() + { + public Object run() throws RemoteException + { + return LocateRegistry.createRegistry(port); + } + }); + } + catch (PrivilegedActionException e) + { + throw (RemoteException) e.getCause(); + } = + } + = + static private Remote exportObject(final Remote object, + final int port, + final RMIClientSocketFactory csf, + final RMIServerSocketFactory ssf) + throws RemoteException + { + if (SecurityUtility.skipAccessControl()) + { + return UnicastRemoteObject.exportObject(object, port, csf, ssf); + } + = + try + { + return (Remote) AccessController.doPrivileged( new PrivilegedExce= ptionAction() + { + public Object run() throws RemoteException + { + return UnicastRemoteObject.exportObject(object, port, csf, = ssf); + } + }); + } + catch (PrivilegedActionException e) + { + throw (RemoteException) e.getCause(); + } + } + = + static private Registry getRegistry(final int port) throws RemoteExcept= ion + { + if (SecurityUtility.skipAccessControl()) + { + return LocateRegistry.getRegistry(port); + } + = + try + { + return (Registry) AccessController.doPrivileged( new PrivilegedEx= ceptionAction() + { + public Object run() throws RemoteException + { + return LocateRegistry.getRegistry(port); + } + }); + } + catch (PrivilegedActionException e) + { + throw (RemoteException) e.getCause(); + } = + } + = + static private void rebind(final Registry registry, final String name, = final Remote object) + throws IOException + { + if (SecurityUtility.skipAccessControl()) + { + registry.rebind(name, object); + return; + } + = + try + { + AccessController.doPrivileged( new PrivilegedExceptionAction() + { + public Object run() throws IOException + { + registry.rebind(name, object); + return null; + } + }); + } + catch (PrivilegedActionException e) + { + throw (IOException) e.getCause(); + } + } + = + static private void unbind(final Registry registry, final String name) + throws AccessException, RemoteException, NotBoundException + { + if (SecurityUtility.skipAccessControl()) + { + registry.unbind(name); + return; + } + = + try + { + AccessController.doPrivileged( new PrivilegedExceptionAction() + { + public Object run() throws AccessException, RemoteException, N= otBoundException + { + registry.unbind(name); + return null; + } + }); + } + catch (PrivilegedActionException e) + { + Throwable cause =3D e.getCause(); + if (cause instanceof AccessException) + throw (AccessException) cause; + else if (cause instanceof RemoteException) + throw (RemoteException) cause; + else + throw (NotBoundException) cause; + } + } } Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/= RemotingRMIClientSocketFactory.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/Remoti= ngRMIClientSocketFactory.java 2009-04-14 10:20:53 UTC (rev 5016) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/Remoti= ngRMIClientSocketFactory.java 2009-04-14 10:22:01 UTC (rev 5017) @@ -198,7 +198,7 @@ log.warn("unable to retrieve socket factory: returning plai= n socket"); } = - return SecurityUtility.createSocket(effectiveHost, port); + return createSocketPrivate(effectiveHost, port); } = socketFactory =3D retrieveSocketFactory(holder); @@ -207,11 +207,11 @@ Socket socket =3D null; if(socketFactory !=3D null) { - socket =3D SecurityUtility.createSocket(socketFactory, effectiveH= ost, port); + socket =3D createSocketPrivate(socketFactory, effectiveHost, port= ); } else { - socket =3D SecurityUtility.createSocket(effectiveHost, port); + socket =3D createSocketPrivate(effectiveHost, port); } = socket.setSoTimeout(timeout); @@ -273,7 +273,7 @@ = try { = - host =3D SecurityUtility.getAddressByName(invokerLocator.getHo= st()); + host =3D getAddressByName(invokerLocator.getHost()); } catch (UnknownHostException e) { @@ -301,4 +301,74 @@ return hashCode; } } + + static private Socket createSocketPrivate(final String host, final int = port) throws IOException + { + if (SecurityUtility.skipAccessControl()) + { + return new Socket(host, port); + } + = + try + { + return (Socket)AccessController.doPrivileged( new PrivilegedExce= ptionAction() + { + public Object run() throws IOException + { + return new Socket(host, port); + } + }); + } + catch (PrivilegedActionException e) + { + throw (IOException) e.getCause(); + } + } + + static private Socket createSocketPrivate(final SocketFactory sf, final= String host, final int port) + throws IOException + { + if (SecurityUtility.skipAccessControl()) + { + return sf.createSocket(host, port); + } + = + try + { + return (Socket)AccessController.doPrivileged( new PrivilegedExce= ptionAction() + { + public Object run() throws IOException + { + return sf.createSocket(host, port); + } + }); + } + catch (PrivilegedActionException e) + { + throw (IOException) e.getCause(); + } + } + = + static private InetAddress getAddressByName(final String host) throws U= nknownHostException + { + if (SecurityUtility.skipAccessControl()) + { + return InetAddress.getByName(host); + } + = + try + { + return (InetAddress)AccessController.doPrivileged( new Privileged= ExceptionAction() + { + public Object run() throws IOException + { + return InetAddress.getByName(host); + } + }); + } + catch (PrivilegedActionException e) + { + throw (UnknownHostException) e.getCause(); + } + } } \ No newline at end of file Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/= RemotingRMIServerSocketFactory.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/Remoti= ngRMIServerSocketFactory.java 2009-04-14 10:20:53 UTC (rev 5016) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/Remoti= ngRMIServerSocketFactory.java 2009-04-14 10:22:01 UTC (rev 5017) @@ -123,7 +123,7 @@ this.serverSocketFactory =3D serverSocketFactory; this.backlog =3D backlog; this.timeout =3D timeout; - this.bindAddress =3D SecurityUtility.getAddressByName(bindHost); + this.bindAddress =3D getAddressByName(bindHost); } = public RemotingRMIServerSocketFactory(String bindHost, int timeout) thr= ows UnknownHostException @@ -154,7 +154,7 @@ = if(serverSocketFactory !=3D null) { - svrSocket =3D SecurityUtility.createServerSocket(serverSocketFact= ory, port, backlog, bindAddress); + svrSocket =3D createServerSocket(serverSocketFactory, port, backl= og, bindAddress); } = // if (constructor !=3D null) @@ -174,7 +174,7 @@ = else { - svrSocket =3D SecurityUtility.createServerSocket(port, backlog, b= indAddress); + svrSocket =3D createServerSocket(port, backlog, bindAddress); } = svrSocket.setSoTimeout(timeout); @@ -263,4 +263,78 @@ = return backlog * bindAddress.hashCode(); } + + static private ServerSocket createServerSocket(final ServerSocketFactor= y ssf, + final int port, final int= backlog, + final InetAddress inetAdd= ress) + throws IOException + { + if (SecurityUtility.skipAccessControl()) + { + return ssf.createServerSocket(port, backlog, inetAddress); + } + + try + { + return (ServerSocket)AccessController.doPrivileged( new Privilege= dExceptionAction() + { + public Object run() throws Exception + { + return ssf.createServerSocket(port, backlog, inetAddress); + } + }); + } + catch (PrivilegedActionException e) + { + throw (IOException) e.getCause(); + } + } + + static private ServerSocket createServerSocket(final int port, final in= t backlog, + final InetAddress inetAdd= ress) + throws IOException + { + if (SecurityUtility.skipAccessControl()) + { + return new ServerSocket(port, backlog, inetAddress); + } + + try + { + return (ServerSocket)AccessController.doPrivileged( new Privilege= dExceptionAction() + { + public Object run() throws IOException + { + return new ServerSocket(port, backlog, inetAddress); + } + }); + } + catch (PrivilegedActionException e) + { + throw (IOException) e.getCause(); + } + } + = + static private InetAddress getAddressByName(final String host) throws U= nknownHostException + { + if (SecurityUtility.skipAccessControl()) + { + return InetAddress.getByName(host); + } + = + try + { + return (InetAddress)AccessController.doPrivileged( new Privileged= ExceptionAction() + { + public Object run() throws IOException + { + return InetAddress.getByName(host); + } + }); + } + catch (PrivilegedActionException e) + { + throw (UnknownHostException) e.getCause(); + } + } } \ No newline at end of file --===============0192534234451048866==-- From jboss-remoting-commits at lists.jboss.org Tue Apr 14 06:22:29 2009 Content-Type: multipart/mixed; boundary="===============8427493170175006248==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5018 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport/servlet. Date: Tue, 14 Apr 2009 06:22:29 -0400 Message-ID: <E1Ltfmf-0003pN-Qr@committer01.frg.pub.inap.atl.jboss.com> --===============8427493170175006248== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-14 06:22:29 -0400 (Tue, 14 Apr 2009) New Revision: 5018 Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/servlet/Ser= vletServerInvoker.java Log: JBREM-1116: Eliminated dependence on SecurityUtility. Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/serv= let/ServletServerInvoker.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/servlet/Se= rvletServerInvoker.java 2009-04-14 10:22:01 UTC (rev 5017) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/servlet/Se= rvletServerInvoker.java 2009-04-14 10:22:29 UTC (rev 5018) @@ -48,6 +48,10 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.net.InetAddress; +import java.net.UnknownHostException; +import java.security.AccessController; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; import java.util.Enumeration; import java.util.HashMap; import java.util.Map; @@ -199,7 +203,7 @@ } = String remoteAddressString =3D request.getRemoteAddr(); - InetAddress remoteAddress =3D SecurityUtility.getAddressByName(re= moteAddressString); + InetAddress remoteAddress =3D getAddressByName(remoteAddressStrin= g); Map requestPayload =3D invocationRequest.getRequestPayload(); = if (requestPayload =3D=3D null) @@ -366,7 +370,7 @@ } = String remoteAddressString =3D request.getRemoteAddr(); - InetAddress remoteAddress =3D SecurityUtility.getAddressByName(re= moteAddressString); + InetAddress remoteAddress =3D getAddressByName(remoteAddressStrin= g); Map requestPayload =3D invocationRequest.getRequestPayload(); = if (requestPayload =3D=3D null) @@ -502,4 +506,27 @@ = return flag; } + = + static private InetAddress getAddressByName(final String host) throws U= nknownHostException + { + if (SecurityUtility.skipAccessControl()) + { + return InetAddress.getByName(host); + } + = + try + { + return (InetAddress)AccessController.doPrivileged( new Privileged= ExceptionAction() + { + public Object run() throws IOException + { + return InetAddress.getByName(host); + } + }); + } + catch (PrivilegedActionException e) + { + throw (UnknownHostException) e.getCause(); + } + } } \ No newline at end of file --===============8427493170175006248==-- From jboss-remoting-commits at lists.jboss.org Tue Apr 14 06:23:07 2009 Content-Type: multipart/mixed; boundary="===============8824747343924778178==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5019 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport/servlet/web. Date: Tue, 14 Apr 2009 06:23:07 -0400 Message-ID: <E1LtfnH-0003pX-6q@committer01.frg.pub.inap.atl.jboss.com> --===============8824747343924778178== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-14 06:23:07 -0400 (Tue, 14 Apr 2009) New Revision: 5019 Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/servlet/web= /ServerInvokerServlet.java Log: JBREM-1116: Eliminated dependence on SecurityUtility and ServletSecurityUti= lity. Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/serv= let/web/ServerInvokerServlet.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/servlet/we= b/ServerInvokerServlet.java 2009-04-14 10:22:29 UTC (rev 5018) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/servlet/we= b/ServerInvokerServlet.java 2009-04-14 10:23:07 UTC (rev 5019) @@ -28,9 +28,8 @@ import org.jboss.remoting.ServerInvoker; import org.jboss.remoting.transport.servlet.ServletServerInvokerMBean; import org.jboss.remoting.util.SecurityUtility; -import org.jboss.remoting.util.ServletSecurityUtility; - import javax.management.MBeanServer; +import javax.management.MBeanServerFactory; import javax.management.MBeanServerInvocationHandler; import javax.management.MalformedObjectNameException; import javax.management.ObjectName; @@ -43,7 +42,14 @@ import javax.servlet.http.HttpServletResponse; import java.io.ByteArrayOutputStream; import java.io.IOException; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; import java.net.MalformedURLException; +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; +import java.util.ArrayList; import java.util.Iterator; = /** @@ -133,7 +139,7 @@ } byteOutputStream.flush(); byte[] totalByteArray =3D byteOutputStream.toByteArray(); - byte[] out =3D ServletSecurityUtility.processRequest(servletInvoker,= request, totalByteArray, response); + byte[] out =3D processRequest(servletInvoker, request, totalByteArra= y, response); ServletOutputStream outStream =3D response.getOutputStream(); outStream.write(out); outStream.flush(); @@ -287,7 +293,7 @@ { try { - MBeanServer s =3D SecurityUtility.getPlatformMBeanServer(); + MBeanServer s =3D getPlatformMBeanServer(); log.debug("Using platform MBeanServer"); return s; } @@ -297,7 +303,7 @@ } } = - Iterator i =3D SecurityUtility.findMBeanServer(null).iterator(); + Iterator i =3D findMBeanServer(null).iterator(); while(i.hasNext()) { MBeanServer server =3D (MBeanServer) i.next(); @@ -315,4 +321,106 @@ = return null; } + = + static private ArrayList findMBeanServer(final String agentId) + { + if (SecurityUtility.skipAccessControl()) + { + return MBeanServerFactory.findMBeanServer(agentId); + } + = + return (ArrayList)AccessController.doPrivileged( new PrivilegedActio= n() + { + public Object run() + { + return MBeanServerFactory.findMBeanServer(agentId); + } + }); + } + = + static private MBeanServer getPlatformMBeanServer() + throws NoSuchMethodException, IllegalAccessException, InvocationTargetE= xception + { + if (SecurityUtility.skipAccessControl()) + { + Class c =3D null; + try + { + c =3D Class.forName("java.lang.management.ManagementFactory"); + } + catch (Exception e) + { + System.out.println("Unable to access java.lang.management.Mana= gementFactory: must be using jdk 1.4"); + return null; + } + Method m =3D c.getMethod("getPlatformMBeanServer", new Class[] {}= ); + MBeanServer s =3D (MBeanServer) m.invoke(null, new Object[] {}); + return s; + } + = + try + { + return (MBeanServer) AccessController.doPrivileged( new Privilege= dExceptionAction() + { + public Object run() + throws NoSuchMethodException, IllegalAccessException, Invocati= onTargetException + { + Class c =3D null; + try + { + c =3D Class.forName("java.lang.management.ManagementFact= ory"); + } + catch (Exception e) + { + System.out.println("Unable to access java.lang.managemen= t.ManagementFactory: must be using jdk 1.4"); + return null; + } + Method m =3D c.getMethod("getPlatformMBeanServer", new Clas= s[] {}); + MBeanServer s =3D (MBeanServer) m.invoke(null, new Object[]= {}); + return s; + } + }); + } + catch (PrivilegedActionException e) + { + Throwable cause =3D e.getCause(); + if (cause instanceof NoSuchMethodException) + throw (NoSuchMethodException) cause; + else if (cause instanceof IllegalAccessException) + throw (IllegalAccessException) cause; + else + throw (InvocationTargetException) cause; + } = + } + = + static private byte[] processRequest(final ServletServerInvokerMBean in= voker, + final HttpServletRequest request, + final byte[] byteArray, + final HttpServletResponse response) + throws ServletException, IOException + { + if (SecurityUtility.skipAccessControl()) + { + return invoker.processRequest(request, byteArray, response); + } + + try + { + return (byte[]) AccessController.doPrivileged( new PrivilegedExce= ptionAction() + { + public Object run() throws ServletException, IOException + { + return invoker.processRequest(request, byteArray, response); + } + }); + } + catch (PrivilegedActionException e) + { + Throwable cause =3D e.getCause(); + if (cause instanceof ServletException) + throw (ServletException) cause; + else + throw (IOException) e.getCause(); + } = + } } \ No newline at end of file --===============8824747343924778178==-- From jboss-remoting-commits at lists.jboss.org Tue Apr 14 06:24:32 2009 Content-Type: multipart/mixed; boundary="===============3410651856532734831==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5020 - in remoting2/branches/2.x/src/main/org/jboss/remoting/transport: sslbisocket and 1 other directory. Date: Tue, 14 Apr 2009 06:24:31 -0400 Message-ID: <E1Ltfod-0003qm-V9@committer01.frg.pub.inap.atl.jboss.com> --===============3410651856532734831== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-14 06:24:31 -0400 (Tue, 14 Apr 2009) New Revision: 5020 Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/Micr= oSocketClientInvoker.java remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/Serv= erThread.java remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/Sock= etClientInvoker.java remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/Sock= etServerInvoker.java remoting2/branches/2.x/src/main/org/jboss/remoting/transport/sslbisocket= /SSLBisocketClientInvoker.java Log: JBREM-1116: Eliminated dependence on SecurityUtility. Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/sock= et/MicroSocketClientInvoker.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/Mic= roSocketClientInvoker.java 2009-04-14 10:23:07 UTC (rev 5019) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/Mic= roSocketClientInvoker.java 2009-04-14 10:24:31 UTC (rev 5020) @@ -20,6 +20,7 @@ import org.jboss.remoting.marshal.serializable.SerializableMarshaller; import org.jboss.util.propertyeditor.PropertyEditors; = +import java.beans.IntrospectionException; import java.io.EOFException; import java.io.IOException; import java.io.InputStream; @@ -29,6 +30,10 @@ import java.net.Socket; import java.net.InetSocketAddress; import java.net.SocketException; +import java.net.UnknownHostException; +import java.security.AccessController; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedList; @@ -488,12 +493,12 @@ { Properties props =3D new Properties(); props.putAll(configuration); - SecurityUtility.mapJavaBeanProperties(MicroSocketClientInvoker.this,= props, false); + mapJavaBeanProperties(MicroSocketClientInvoker.this, props, false); configureParameters(); = if (!InvokerLocator.MULTIHOME.equals(locator.getHost())) { - addr =3D SecurityUtility.getAddressByName(locator.getHost()); + addr =3D getAddressByName(locator.getHost()); port =3D locator.getPort(); address =3D createServerAddress(addr, port); } @@ -504,7 +509,7 @@ { // Treat as in non MULTIHOME case. Home home =3D (Home) homes.iterator().next(); - addr =3D SecurityUtility.getAddressByName(home.host); + addr =3D getAddressByName(home.host); address =3D createServerAddress(addr, home.port); } } @@ -650,7 +655,7 @@ try { home =3D (Home) it.next(); - addr =3D SecurityUtility.getAddressByName(home.host); + addr =3D getAddressByName(home.host); address =3D createServerAddress(addr, home.port); invoke(new InvocationRequest(null, null, ServerInvoker.ECHO, n= ull, null, null)); if (trace) log.trace(this + " able to contact server at: " + h= ome); @@ -1140,7 +1145,7 @@ Socket s =3D new Socket(); configureSocket(s); InetSocketAddress inetAddr =3D new InetSocketAddress(address, port); - SecurityUtility.connect(s, inetAddr); + connect(s, inetAddr); return s; } = @@ -1266,7 +1271,81 @@ if (trace) { log.trace(this + " writing version " + version + " on o= utput stream"); } outputStream.write(version); } + = + static private void mapJavaBeanProperties(final Object o, final Propert= ies props, final boolean isStrict) + throws IntrospectionException + { + if (SecurityUtility.skipAccessControl()) + { + PropertyEditors.mapJavaBeanProperties(o, props, isStrict); + return; + } = + try + { + AccessController.doPrivileged( new PrivilegedExceptionAction() + { + public Object run() throws IntrospectionException + { + PropertyEditors.mapJavaBeanProperties(o, props, isStrict); + return null; + } + }); + } + catch (PrivilegedActionException e) + { + throw (IntrospectionException) e.getCause(); + } + } + = + static private void connect(final Socket socket, final InetSocketAddres= s address) + throws IOException + { + if (SecurityUtility.skipAccessControl()) + { + socket.connect(address); + return; + } + = + try + { + AccessController.doPrivileged( new PrivilegedExceptionAction() + { + public Object run() throws Exception + { + socket.connect(address); + return null; + } + }); + } + catch (PrivilegedActionException e) + { + throw (IOException) e.getCause(); + } = + } + = + static private InetAddress getAddressByName(final String host) throws U= nknownHostException + { + if (SecurityUtility.skipAccessControl()) + { + return InetAddress.getByName(host); + } + = + try + { + return (InetAddress)AccessController.doPrivileged( new Privileged= ExceptionAction() + { + public Object run() throws IOException + { + return InetAddress.getByName(host); + } + }); + } + catch (PrivilegedActionException e) + { + throw (UnknownHostException) e.getCause(); + } + } // Inner classes ------------------------------------------------------= -------------------------- = } Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/sock= et/ServerThread.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/Ser= verThread.java 2009-04-14 10:23:07 UTC (rev 5019) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/Ser= verThread.java 2009-04-14 10:24:31 UTC (rev 5020) @@ -52,6 +52,8 @@ import java.net.SocketAddress; import java.net.SocketException; import java.net.SocketTimeoutException; +import java.security.AccessController; +import java.security.PrivilegedAction; import java.util.HashMap; import java.util.LinkedList; import java.util.Map; @@ -99,7 +101,7 @@ return idGenerator++; } = - private static ClassLoader classLoader =3D SecurityUtility.getClassLoad= er(ServerThread.class); + private static ClassLoader classLoader =3D getClassLoader(ServerThread.= class); = // Attributes ---------------------------------------------------------= -------------------------- = @@ -1087,4 +1089,20 @@ public static class EvictionException extends Exception { } + = + static private ClassLoader getClassLoader(final Class c) + { + if (SecurityUtility.skipAccessControl()) + { + return c.getClassLoader(); + } + + return (ClassLoader)AccessController.doPrivileged( new PrivilegedAct= ion() + { + public Object run() + { + return c.getClassLoader(); + } + }); + } } Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/sock= et/SocketClientInvoker.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/Soc= ketClientInvoker.java 2009-04-14 10:23:07 UTC (rev 5019) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/Soc= ketClientInvoker.java 2009-04-14 10:24:31 UTC (rev 5020) @@ -36,6 +36,9 @@ import java.net.Socket; import java.net.SocketTimeoutException; import java.net.InetSocketAddress; +import java.security.AccessController; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; import java.util.Map; = /** @@ -200,7 +203,7 @@ timeout =3D 0; } = - SecurityUtility.connect(s, inetAddr, timeout); + connect(s, inetAddr, timeout); return s; } = @@ -277,4 +280,30 @@ return "SocketClientInvoker[" + Integer.toHexString(System.identityH= ashCode(this)) + ", " + locator.getProtocol() + "://" + locator.getHost() + ":" + locator= .getPort() + "]"; } + = + static private void connect(final Socket socket, final InetSocketAddres= s address, final int timeout) + throws IOException + { + if (SecurityUtility.skipAccessControl()) + { + socket.connect(address, timeout); + return; + } + = + try + { + AccessController.doPrivileged( new PrivilegedExceptionAction() + { + public Object run() throws Exception + { + socket.connect(address, timeout); + return null; + } + }); + } + catch (PrivilegedActionException e) + { + throw (IOException) e.getCause(); + } = + } } Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/sock= et/SocketServerInvoker.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/Soc= ketServerInvoker.java 2009-04-14 10:23:07 UTC (rev 5019) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/Soc= ketServerInvoker.java 2009-04-14 10:24:31 UTC (rev 5020) @@ -25,6 +25,7 @@ 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; @@ -34,12 +35,18 @@ import javax.net.ServerSocketFactory; import javax.net.ssl.SSLException; = +import java.beans.IntrospectionException; import java.io.IOException; import java.net.InetAddress; import java.net.InetSocketAddress; import java.net.ServerSocket; import java.net.Socket; +import java.net.SocketAddress; import java.net.SocketException; +import java.net.UnknownHostException; +import java.security.AccessController; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; import java.util.ArrayList; import java.util.HashSet; import java.util.Iterator; @@ -201,7 +208,7 @@ protected void setup() throws Exception { props.putAll(getConfiguration()); - SecurityUtility.mapJavaBeanProperties(this, props, false); + mapJavaBeanProperties(this, props, false); super.setup(); String ssclass =3D props.getProperty(SERVER_SOCKET_CLASS_FLAG); if(ssclass !=3D null) @@ -321,7 +328,7 @@ ss.setReuseAddress(getReuseAddress()); configureServerSocket(ss); InetSocketAddress address =3D new InetSocketAddress(bindAddress, ser= verBindPort); - SecurityUtility.bind(ss, address, backlog); + bind(ss, address, backlog); return ss; } = @@ -333,7 +340,7 @@ while (it.hasNext()) { Home home =3D (Home) it.next(); - InetAddress inetAddress =3D SecurityUtility.getAddressByName(home= .host); + InetAddress inetAddress =3D getAddressByName(home.host); = ServerSocket ss =3D null; try @@ -342,7 +349,7 @@ ss.setReuseAddress(getReuseAddress()); configureServerSocket(ss); InetSocketAddress address =3D new InetSocketAddress(inetAddres= s, home.port); - SecurityUtility.bind(ss, address, backlog); + bind(ss, address, backlog); if (log.isDebugEnabled()) log.debug(this + " created " + ss); } catch (SocketException e) @@ -1010,7 +1017,7 @@ = if(trace) { log.trace(this + " is going to wait on serverSo= cket.accept()"); } = - Socket socket =3D SecurityUtility.accept(serverSocket); + Socket socket =3D accept(serverSocket); if(trace) { log.trace(this + " accepted " + socket); } = // the acceptor thread should spend as little time as possb= ile doing any kind of @@ -1068,4 +1075,102 @@ this.serverSocket =3D serverSocket; } } + = + static private void mapJavaBeanProperties(final Object o, final Propert= ies props, final boolean isStrict) + throws IntrospectionException + { + if (SecurityUtility.skipAccessControl()) + { + PropertyEditors.mapJavaBeanProperties(o, props, isStrict); + return; + } + + try + { + AccessController.doPrivileged( new PrivilegedExceptionAction() + { + public Object run() throws IntrospectionException + { + PropertyEditors.mapJavaBeanProperties(o, props, isStrict); + return null; + } + }); + } + catch (PrivilegedActionException e) + { + throw (IntrospectionException) e.getCause(); + } + } + = + static private Socket accept(final ServerSocket ss) throws IOException + { + if (SecurityUtility.skipAccessControl()) + { + return ss.accept(); + } + = + try + { + return (Socket)AccessController.doPrivileged( new PrivilegedExce= ptionAction() + { + public Object run() throws Exception + { + return ss.accept(); + } + }); + } + catch (PrivilegedActionException e) + { + throw (IOException) e.getCause(); + } + } + + static private void bind(final ServerSocket ss, final SocketAddress add= ress, + final int backlog) throws IOException + { + if (SecurityUtility.skipAccessControl()) + { + ss.bind(address, backlog); + return; + } + = + try + { + AccessController.doPrivileged( new PrivilegedExceptionAction() + { + public Object run() throws Exception + { + ss.bind(address, backlog); + return null; + } + }); + } + catch (PrivilegedActionException e) + { + throw (IOException) e.getCause(); + } + } + = + static private InetAddress getAddressByName(final String host) throws U= nknownHostException + { + if (SecurityUtility.skipAccessControl()) + { + return InetAddress.getByName(host); + } + = + try + { + return (InetAddress)AccessController.doPrivileged( new Privileged= ExceptionAction() + { + public Object run() throws IOException + { + return InetAddress.getByName(host); + } + }); + } + catch (PrivilegedActionException e) + { + throw (UnknownHostException) e.getCause(); + } + } } Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/sslb= isocket/SSLBisocketClientInvoker.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/sslbisocke= t/SSLBisocketClientInvoker.java 2009-04-14 10:23:07 UTC (rev 5019) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/sslbisocke= t/SSLBisocketClientInvoker.java 2009-04-14 10:24:31 UTC (rev 5020) @@ -26,6 +26,9 @@ import java.net.InetSocketAddress; import java.net.Socket; import java.net.SocketException; +import java.security.AccessController; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; import java.util.Map; = import javax.net.SocketFactory; @@ -182,7 +185,7 @@ timeout =3D 0; } = - SecurityUtility.connect(s, inetAddr, timeout); + connect(s, inetAddr, timeout); = if (s instanceof SSLSocket) { @@ -233,4 +236,30 @@ sslSocket.getSession(); repeater.waitForHandshake(); } + = + static private void connect(final Socket socket, final InetSocketAddres= s address, final int timeout) + throws IOException + { + if (SecurityUtility.skipAccessControl()) + { + socket.connect(address, timeout); + return; + } + = + try + { + AccessController.doPrivileged( new PrivilegedExceptionAction() + { + public Object run() throws Exception + { + socket.connect(address, timeout); + return null; + } + }); + } + catch (PrivilegedActionException e) + { + throw (IOException) e.getCause(); + } = + } } \ No newline at end of file --===============3410651856532734831==-- From jboss-remoting-commits at lists.jboss.org Tue Apr 14 06:24:53 2009 Content-Type: multipart/mixed; boundary="===============7726547917814489897==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5021 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport/sslsocket. Date: Tue, 14 Apr 2009 06:24:53 -0400 Message-ID: <E1Ltfoz-0003ro-Jz@committer01.frg.pub.inap.atl.jboss.com> --===============7726547917814489897== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-14 06:24:53 -0400 (Tue, 14 Apr 2009) New Revision: 5021 Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/sslsocket/S= SLSocketClientInvoker.java Log: JBREM-1116: Eliminated dependence on SecurityUtility. Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/ssls= ocket/SSLSocketClientInvoker.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/sslsocket/= SSLSocketClientInvoker.java 2009-04-14 10:24:31 UTC (rev 5020) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/sslsocket/= SSLSocketClientInvoker.java 2009-04-14 10:24:53 UTC (rev 5021) @@ -38,6 +38,9 @@ import java.net.Socket; import java.net.InetSocketAddress; import java.net.SocketException; +import java.security.AccessController; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; import java.util.Map; = /** @@ -180,7 +183,7 @@ timeout =3D 0; } = - SecurityUtility.connect(s, inetAddr, timeout); + connect(s, inetAddr, timeout); = if (s instanceof SSLSocket) { @@ -231,5 +234,30 @@ sslSocket.getSession(); repeater.waitForHandshake(); } - + = + static private void connect(final Socket socket, final InetSocketAddres= s address, final int timeout) + throws IOException + { + if (SecurityUtility.skipAccessControl()) + { + socket.connect(address, timeout); + return; + } + = + try + { + AccessController.doPrivileged( new PrivilegedExceptionAction() + { + public Object run() throws Exception + { + socket.connect(address, timeout); + return null; + } + }); + } + catch (PrivilegedActionException e) + { + throw (IOException) e.getCause(); + } = + } } \ No newline at end of file --===============7726547917814489897==-- From jboss-remoting-commits at lists.jboss.org Tue Apr 14 06:25:32 2009 Content-Type: multipart/mixed; boundary="===============2437721628886129049==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5022 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport/web. Date: Tue, 14 Apr 2009 06:25:28 -0400 Message-ID: <E1LtfpY-0003uZ-OH@committer01.frg.pub.inap.atl.jboss.com> --===============2437721628886129049== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-14 06:25:23 -0400 (Tue, 14 Apr 2009) New Revision: 5022 Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/web/WebServ= erInvoker.java Log: JBREM-1116: Eliminated dependence on SecurityUtility. Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/web/= WebServerInvoker.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/web/WebSer= verInvoker.java 2009-04-14 10:24:53 UTC (rev 5021) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/web/WebSer= verInvoker.java 2009-04-14 10:25:23 UTC (rev 5022) @@ -100,7 +100,7 @@ = public UnMarshaller getUnMarshaller() { - ClassLoader classLoader =3D SecurityUtility.getClassLoader(WebServer= Invoker.class); + ClassLoader classLoader =3D getClassLoader(WebServerInvoker.class); UnMarshaller unmarshaller =3D MarshalFactory.getUnMarshaller(getLoca= tor(), classLoader, configuration); if(unmarshaller =3D=3D null) { @@ -111,7 +111,7 @@ = public Marshaller getMarshaller() { - ClassLoader classLoader =3D SecurityUtility.getClassLoader(WebServer= Invoker.class); + ClassLoader classLoader =3D getClassLoader(WebServerInvoker.class); Marshaller marshaller =3D MarshalFactory.getMarshaller(getLocator(),= classLoader, configuration); if(marshaller =3D=3D null) { @@ -242,4 +242,20 @@ super(sessionId, subsystem, arg, requestPayload, returnPayload, l= ocator); } } + = + static private ClassLoader getClassLoader(final Class c) + { + if (SecurityUtility.skipAccessControl()) + { + return c.getClassLoader(); + } + + return (ClassLoader)AccessController.doPrivileged( new PrivilegedAct= ion() + { + public Object run() + { + return c.getClassLoader(); + } + }); + } } \ No newline at end of file --===============2437721628886129049==-- From jboss-remoting-commits at lists.jboss.org Tue Apr 14 06:26:06 2009 Content-Type: multipart/mixed; boundary="===============6355544798033495529==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5023 - remoting2/branches/2.x/src/main/org/jboss/remoting/transporter. Date: Tue, 14 Apr 2009 06:26:05 -0400 Message-ID: <E1Ltfq9-0005IY-Iu@committer01.frg.pub.inap.atl.jboss.com> --===============6355544798033495529== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-14 06:26:05 -0400 (Tue, 14 Apr 2009) New Revision: 5023 Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transporter/InternalT= ransporterServices.java remoting2/branches/2.x/src/main/org/jboss/remoting/transporter/Transport= erClient.java remoting2/branches/2.x/src/main/org/jboss/remoting/transporter/Transport= erHandler.java remoting2/branches/2.x/src/main/org/jboss/remoting/transporter/Transport= erServer.java Log: JBREM-1116: Eliminated dependence on SecurityUtility. Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transporter/In= ternalTransporterServices.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/transporter/Internal= TransporterServices.java 2009-04-14 10:25:23 UTC (rev 5022) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/transporter/Internal= TransporterServices.java 2009-04-14 10:26:05 UTC (rev 5023) @@ -240,7 +240,7 @@ = if (registerDetector) { = - SecurityUtility.registerMBean(m_mBeanServer, m_detector, m_det= ectorName); + registerMBean(m_mBeanServer, m_detector, m_detectorName); } } = @@ -299,7 +299,7 @@ = if (registerRegistry) { = - SecurityUtility.registerMBean(m_mBeanServer, m_networkRegistry= , m_networkRegistryName); + registerMBean(m_mBeanServer, m_networkRegistry, m_networkRegis= tryName); } } = @@ -390,4 +390,30 @@ = return; } + = + static private void registerMBean(final MBeanServer server, final Objec= t o, final ObjectName name) + throws Exception + { + if (SecurityUtility.skipAccessControl()) + { + server.registerMBean(o, name); + return; + } + = + try + { + AccessController.doPrivileged( new PrivilegedExceptionAction() + { + public Object run() throws Exception + { + server.registerMBean(o, name); + return null; + } + }); + } + catch (PrivilegedActionException e) + { + throw (Exception) e.getCause(); + } + } } \ No newline at end of file Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transporter/Tr= ansporterClient.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/transporter/Transpor= terClient.java 2009-04-14 10:25:23 UTC (rev 5022) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/transporter/Transpor= terClient.java 2009-04-14 10:26:05 UTC (rev 5023) @@ -34,6 +34,8 @@ import org.jboss.remoting.util.SecurityUtility; = import javax.management.MBeanServer; +import javax.management.MBeanServerFactory; + import java.io.Serializable; import java.lang.reflect.InvocationHandler; import java.lang.reflect.InvocationTargetException; @@ -41,6 +43,8 @@ import java.lang.reflect.Proxy; import java.security.AccessController; import java.security.PrivilegedAction; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; import java.util.ArrayList; = /** @@ -133,7 +137,7 @@ if (!services.isSetup()) { // we need an MBeanServer to store our network registry and multi= cast detector services - MBeanServer server =3D SecurityUtility.createMBeanServer(); + MBeanServer server =3D createMBeanServer(); = // multicast detector will detect new network registries that com= e online MulticastDetector detector =3D new MulticastDetector(); @@ -427,5 +431,26 @@ return paramSig; } = - + static private MBeanServer createMBeanServer() throws Exception + { + if (SecurityUtility.skipAccessControl()) + { + return MBeanServerFactory.createMBeanServer(); + } + = + try + { + return (MBeanServer) AccessController.doPrivileged( new Privilege= dExceptionAction() + { + public Object run() throws Exception + { + return MBeanServerFactory.createMBeanServer(); + } + }); + } + catch (PrivilegedActionException e) + { + throw (Exception) e.getCause(); + } = + } } \ No newline at end of file Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transporter/Tr= ansporterHandler.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/transporter/Transpor= terHandler.java 2009-04-14 10:25:23 UTC (rev 5022) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/transporter/Transpor= terHandler.java 2009-04-14 10:26:05 UTC (rev 5023) @@ -83,7 +83,7 @@ } = // use reflection to make the call - Method method =3D SecurityUtility.getMethod(targetPOJO.getClass(), m= ethodName, classSig); = + Method method =3D getMethod(targetPOJO.getClass(), methodName, class= Sig); = Object responseObject =3D method.invoke(targetPOJO, params); = return responseObject; @@ -146,4 +146,27 @@ //NOOP } = + static private Method getMethod(final Class c, final String name, final= Class[] parameterTypes) + throws NoSuchMethodException + { + if (SecurityUtility.skipAccessControl()) + { + return c.getMethod(name, parameterTypes); + } + + try + { + return (Method) AccessController.doPrivileged( new PrivilegedExce= ptionAction() + { + public Object run() throws NoSuchMethodException + { + return c.getMethod(name, parameterTypes); + } + }); + } + catch (PrivilegedActionException e) + { + throw (NoSuchMethodException) e.getCause(); + } + } } \ No newline at end of file Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transporter/Tr= ansporterServer.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/transporter/Transpor= terServer.java 2009-04-14 10:25:23 UTC (rev 5022) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/transporter/Transpor= terServer.java 2009-04-14 10:26:05 UTC (rev 5023) @@ -221,7 +221,7 @@ if (!services.isSetup()) { // we need an MBeanServer to store our network registry and multi= cast detector services - MBeanServer server =3D SecurityUtility.createMBeanServer(); + MBeanServer server =3D createMBeanServer(); = // multicast detector will detect new network registries that com= e online MulticastDetector detector =3D new MulticastDetector(); @@ -507,4 +507,26 @@ return createTransporterServer(new InvokerLocator(locatorURI), targe= t, subsystem, false); } = + static private MBeanServer createMBeanServer() throws Exception + { + if (SecurityUtility.skipAccessControl()) + { + return MBeanServerFactory.createMBeanServer(); + } + = + try + { + return (MBeanServer) AccessController.doPrivileged( new Privilege= dExceptionAction() + { + public Object run() throws Exception + { + return MBeanServerFactory.createMBeanServer(); + } + }); + } + catch (PrivilegedActionException e) + { + throw (Exception) e.getCause(); + } = + } } \ No newline at end of file --===============6355544798033495529==-- From jboss-remoting-commits at lists.jboss.org Tue Apr 14 06:27:02 2009 Content-Type: multipart/mixed; boundary="===============3093076562772004195==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5024 - remoting2/branches/2.x/src/main/org/jboss/remoting/util. Date: Tue, 14 Apr 2009 06:27:01 -0400 Message-ID: <E1Ltfr3-0005KX-Pb@committer01.frg.pub.inap.atl.jboss.com> --===============3093076562772004195== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-14 06:27:01 -0400 (Tue, 14 Apr 2009) New Revision: 5024 Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/util/SecurityUtility.= java Log: JBREM-1116: Eliminated all methods except skipAccessControl() from Security= Utility. Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/util/SecurityU= tility.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/util/SecurityUtility= .java 2009-04-14 10:26:05 UTC (rev 5023) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/util/SecurityUtility= .java 2009-04-14 10:27:01 UTC (rev 5024) @@ -21,80 +21,13 @@ */ package org.jboss.remoting.util; = -import java.beans.IntrospectionException; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.io.OutputStream; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.net.HttpURLConnection; -import java.net.InetAddress; -import java.net.InetSocketAddress; -import java.net.ServerSocket; -import java.net.Socket; -import java.net.SocketAddress; -import java.net.UnknownHostException; -import java.rmi.AccessException; -import java.rmi.NotBoundException; -import java.rmi.Remote; -import java.rmi.RemoteException; -import java.rmi.registry.LocateRegistry; -import java.rmi.registry.Registry; -import java.rmi.server.RMIClientSocketFactory; -import java.rmi.server.RMIServerSocketFactory; -import java.rmi.server.UnicastRemoteObject; import java.security.AccessController; -import java.security.PrivilegedAction; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; -import java.util.ArrayList; -import java.util.Properties; = -import javax.management.InstanceNotFoundException; -import javax.management.MBeanServer; -import javax.management.MBeanServerFactory; -import javax.management.ObjectName; -import javax.naming.Context; -import javax.naming.InitialContext; -import javax.naming.NamingEnumeration; -import javax.naming.NamingException; -import javax.net.ServerSocketFactory; -import javax.net.SocketFactory; - import org.jboss.remoting.Remoting; -import org.jboss.remoting.loading.RemotingClassLoader; -import org.jboss.remoting.security.ServerSocketFactoryMBean; -import org.jboss.remoting.transport.rmi.RMIServerInvokerInf; -import org.jboss.serial.io.JBossObjectInputStream; -import org.jboss.serial.io.JBossObjectOutputStream; -import org.jboss.util.propertyeditor.PropertyEditors; = /** - * SecurityUtility provides a central point for making security sensitive = calls. - * = - * It is divided into six sections: - * = - * 1. calls requiring FilePermissions - * 2. calls requiring MBeanPermissions - * 3. calls requiring PropertyPermissions - * 4. calls requiring RuntimePermissions - * 5. calls requiring SocketPermissions - * 6. calls requiring JBoss permissions - * = - * When the SecurityUtility class is loaded, it checks for two conditions: - * = - * 1. there is no security manager - * 2. the system property Remoting.SKIP_ACCESS_CONTROL ("skipAccessContr= ol") is = - * set to true. - * = - * If either condition is true, then every method in SecurityUtility will - * bypass its call to AccessController.doPrivileged(). - * = * @author <a href=3D"ron.sigal(a)jboss.com">Ron Sigal</a> * @version $Revision: 1.1 $ * <p> @@ -131,1774 +64,4 @@ { return skipAccessControl; } - = - = - ///////////////////////////////////////////////////////////////////////= //////////////// - // FilePermission methods - ///////////////////////////////////////////////////////////////////////= //////////////// - = - static public File createTempFile(final String prefix, final String suf= fix, final boolean deleteOnExit) throws IOException - { - if (skipAccessControl) - { - File file =3D File.createTempFile(prefix, suffix); - if (deleteOnExit) file.deleteOnExit(); - return file; - } - = - try - { - return (File)AccessController.doPrivileged( new PrivilegedExcepti= onAction() - { - public Object run() throws IOException - { - File file =3D File.createTempFile(prefix, suffix); - if (deleteOnExit) file.deleteOnExit(); - return file; - } - }); - } - catch (PrivilegedActionException e) - { - throw (IOException) e.getCause(); - } - } - = - static public void deleteOnExit(final File file) - { - if (file =3D=3D null) - return; - = - if (skipAccessControl) - { - file.deleteOnExit(); - return; - } - - AccessController.doPrivileged( new PrivilegedAction() - { - public Object run() - { - file.deleteOnExit(); - return null; - } - }); - } - = - static public boolean fileExists(final File file) - { - if (file =3D=3D null) - return false; - = - if (skipAccessControl) - { - return file.exists(); - } - - return ((Boolean)AccessController.doPrivileged( new PrivilegedAction= () - { - public Object run() - { - return new Boolean(file.exists()); - } - })).booleanValue(); - } - - = - static public boolean mkdirs(final File dir) - { - if (skipAccessControl) - { - return dir.mkdirs(); - } - = - return ((Boolean) AccessController.doPrivileged( new PrivilegedActio= n() - { - public Object run() - { - return new Boolean(dir.mkdirs()); - } - })).booleanValue(); - } - = - = - static public FileInputStream getFileInputStream(final File file) throw= s FileNotFoundException - { - if (skipAccessControl) - { - return new FileInputStream(file); - } - = - try - { - return (FileInputStream)AccessController.doPrivileged( new Privil= egedExceptionAction() - { - public Object run() throws FileNotFoundException - { - return new FileInputStream(file); - } - }); - } - catch (PrivilegedActionException e) - { - throw (FileNotFoundException) e.getCause(); - } - } - = - static public FileInputStream getFileInputStream(final String path) thr= ows FileNotFoundException - { - if (skipAccessControl) - { - return new FileInputStream(path); - } - = - try - { - return (FileInputStream)AccessController.doPrivileged( new Privil= egedExceptionAction() - { - public Object run() throws FileNotFoundException - { - return new FileInputStream(path); - } - }); - } - catch (PrivilegedActionException e) - { - throw (FileNotFoundException) e.getCause(); - } - } - = - = - static public FileOutputStream getFileOutputStream(final File file) - throws FileNotFoundException - { - if (skipAccessControl) - { - return new FileOutputStream(file); - } - = - try - { - return (FileOutputStream)AccessController.doPrivileged( new Privi= legedExceptionAction() - { - public Object run() throws FileNotFoundException - { - return new FileOutputStream(file); - } - }); - } - catch (PrivilegedActionException e) - { - throw (FileNotFoundException) e.getCause(); - } - } - = - = - static public FileOutputStream getFileOutputStream(final File file, fin= al boolean append) - throws FileNotFoundException - { - if (skipAccessControl) - { - return new FileOutputStream(file, append); - } - = - try - { - return (FileOutputStream)AccessController.doPrivileged( new Privi= legedExceptionAction() - { - public Object run() throws FileNotFoundException - { - return new FileOutputStream(file, append); - } - }); - } - catch (PrivilegedActionException e) - { - throw (FileNotFoundException) e.getCause(); - } - } - = - = - static public boolean canRead(final File file) - { - if (skipAccessControl) - { - return file.canRead(); - } - = - return ((Boolean)AccessController.doPrivileged( new PrivilegedAction= () - { - public Object run() - { - return new Boolean(file.canRead()); - } - })).booleanValue(); - } - = - = - static public boolean createNewFile(final File file) throws IOException - { - if (skipAccessControl) - { - return file.createNewFile(); - } - = - try - { - return ((Boolean)AccessController.doPrivileged( new PrivilegedExc= eptionAction() - { - public Object run() throws Exception - { - return new Boolean(file.createNewFile()); - } - })).booleanValue(); - } - catch (Exception e) - { - throw (IOException) e.getCause(); - } - } - = - = - ///////////////////////////////////////////////////////////////////////= //////////////// - // MBeanPermission methods - ///////////////////////////////////////////////////////////////////////= //////////////// - = - static public MBeanServer createMBeanServer() throws Exception - { - if (skipAccessControl) - { - return MBeanServerFactory.createMBeanServer(); - } - = - try - { - return (MBeanServer) AccessController.doPrivileged( new Privilege= dExceptionAction() - { - public Object run() throws Exception - { - return MBeanServerFactory.createMBeanServer(); - } - }); - } - catch (PrivilegedActionException e) - { - throw (Exception) e.getCause(); - } = - } - = - = - static public ArrayList findMBeanServer(final String agentId) - { - if (skipAccessControl) - { - return MBeanServerFactory.findMBeanServer(agentId); - } - = - return (ArrayList)AccessController.doPrivileged( new PrivilegedActio= n() - { - public Object run() - { - return MBeanServerFactory.findMBeanServer(agentId); - } - }); - } - = - = - static public Object getMBeanAttribute(final MBeanServer server, final = ObjectName objectName, final String attribute) - throws Exception - { - if (skipAccessControl) - { - return server.getAttribute(objectName, attribute); - } - = - try - { - return AccessController.doPrivileged( new PrivilegedExceptionActi= on() - { - public Object run() throws Exception - { - return server.getAttribute(objectName, attribute); - } - }); - } - catch (PrivilegedActionException e) - { - throw (Exception) e.getCause(); - } = - } - = - = - static public MBeanServer getPlatformMBeanServer() - throws NoSuchMethodException, IllegalAccessException, InvocationTargetE= xception - { - if (skipAccessControl) - { - Class c =3D null; - try - { - c =3D Class.forName("java.lang.management.ManagementFactory"); - } - catch (Exception e) - { - System.out.println("Unable to access java.lang.management.Mana= gementFactory: must be using jdk 1.4"); - return null; - } - Method m =3D c.getMethod("getPlatformMBeanServer", new Class[] {}= ); - MBeanServer s =3D (MBeanServer) m.invoke(null, new Object[] {}); - return s; - } - = - try - { - return (MBeanServer) AccessController.doPrivileged( new Privilege= dExceptionAction() - { - public Object run() - throws NoSuchMethodException, IllegalAccessException, Invocati= onTargetException - { - Class c =3D null; - try - { - c =3D Class.forName("java.lang.management.ManagementFact= ory"); - } - catch (Exception e) - { - System.out.println("Unable to access java.lang.managemen= t.ManagementFactory: must be using jdk 1.4"); - return null; - } - Method m =3D c.getMethod("getPlatformMBeanServer", new Clas= s[] {}); - MBeanServer s =3D (MBeanServer) m.invoke(null, new Object[]= {}); - return s; - } - }); - } - catch (PrivilegedActionException e) - { - Throwable cause =3D e.getCause(); - if (cause instanceof NoSuchMethodException) - throw (NoSuchMethodException) cause; - else if (cause instanceof IllegalAccessException) - throw (IllegalAccessException) cause; - else - throw (InvocationTargetException) cause; - } = - } - = - = - static public boolean isInstanceOf(final MBeanServer server, final Obje= ctName objectName, final String className) - throws InstanceNotFoundException - { - if (skipAccessControl) - { - return server.isInstanceOf(objectName, className); - } - = - try - { - return ((Boolean)AccessController.doPrivileged( new PrivilegedExc= eptionAction() - { - public Object run() throws Exception - { - return new Boolean(server.isInstanceOf(objectName, classNam= e)); - } - })).booleanValue(); - } - catch (PrivilegedActionException e) - { - throw (InstanceNotFoundException) e.getCause(); - } - } - = - = - static public void registerMBean(final MBeanServer server, final Object= o, final ObjectName name) - throws Exception - { - if (skipAccessControl) - { - server.registerMBean(o, name); - return; - } - = - try - { - AccessController.doPrivileged( new PrivilegedExceptionAction() - { - public Object run() throws Exception - { - server.registerMBean(o, name); - return null; - } - }); - } - catch (PrivilegedActionException e) - { - throw (Exception) e.getCause(); - } - } - = - = - static public void unregisterMBean(final MBeanServer server, final Obje= ctName name) - throws Exception - { - if (skipAccessControl) - { - server.unregisterMBean(name); - return; - } - = - try - { - AccessController.doPrivileged( new PrivilegedExceptionAction() - { - public Object run() throws Exception - { - server.unregisterMBean(name); - return null; - } - }); - } - catch (PrivilegedActionException e) - { - throw (Exception) e.getCause(); - } - } - = - - ///////////////////////////////////////////////////////////////////////= //////////////// - // PropertyPermission methods - ///////////////////////////////////////////////////////////////////////= //////////////// - = - static public String getSystemProperty(final String name, final String = defaultValue) - { - if (skipAccessControl) - return System.getProperty(name, defaultValue); - = - String value =3D null; - try - { - value =3D (String)AccessController.doPrivileged( new PrivilegedEx= ceptionAction() - { - public Object run() throws Exception - { - return System.getProperty(name, defaultValue); - } - }); - } - catch (PrivilegedActionException e) - { - throw (RuntimeException) e.getCause(); - } - = - return value; - } - = - = - static public String getSystemProperty(final String name) - { - if (skipAccessControl) - return System.getProperty(name); - = - String value =3D null; - try - { - value =3D (String)AccessController.doPrivileged( new PrivilegedEx= ceptionAction() - { - public Object run() throws Exception - { - return System.getProperty(name); - } - }); - } - catch (PrivilegedActionException e) - { - throw (RuntimeException) e.getCause(); - } - = - return value; - } - = - = - static public void setSystemProperty(final String name, final String va= lue) - { - if (skipAccessControl) - { - System.setProperty(name, value); - return; - } - = - try - { - AccessController.doPrivileged( new PrivilegedExceptionAction() - { - public Object run() throws Exception - { - return System.setProperty(name, value); - } - }); - } - catch (PrivilegedActionException e) - { - throw (RuntimeException) e.getCause(); - } - } - = - = - ///////////////////////////////////////////////////////////////////////= //////////////// - // RuntimePermission methods - ///////////////////////////////////////////////////////////////////////= //////////////// - = - static public RemotingClassLoader createRemotingClassLoader(final Class= Loader remotingClassLoader, - final ClassLoader userClassLoader) - { - return createRemotingClassLoader(remotingClassLoader, userClassLoade= r, true); - } - = - = - static public RemotingClassLoader createRemotingClassLoader(final Class= Loader remotingClassLoader, - final ClassLoader userClassLoader, final boolean parentFirstDeleg= ation) - { - if (skipAccessControl) - { - return new RemotingClassLoader(remotingClassLoader, userClassLoad= er, parentFirstDelegation); - } - - return (RemotingClassLoader)AccessController.doPrivileged( new Privi= legedAction() - { - public Object run() - { - return new RemotingClassLoader(remotingClassLoader, userClassL= oader, parentFirstDelegation); - } - }); - } - = - = - static public Object forName(final String className) throws ClassNotFou= ndException - { - if (skipAccessControl) - { - return Class.forName(className); - } - = - try - { - return AccessController.doPrivileged( new PrivilegedExceptionAct= ion() - { - public Object run() throws Exception - { - return Class.forName(className); - } - }); - } - catch (PrivilegedActionException e) - { - throw (ClassNotFoundException) e.getCause(); - } - } - = - = - static public ClassLoader getClassLoader(final Class c) - { - if (skipAccessControl) - { - return c.getClassLoader(); - } - - return (ClassLoader)AccessController.doPrivileged( new PrivilegedAct= ion() - { - public Object run() - { - return c.getClassLoader(); - } - }); - } - = - = - static public ClassLoader getContextClassLoader(final Thread thread) - { - if (skipAccessControl) - { - return thread.getContextClassLoader(); - } - - return (ClassLoader) AccessController.doPrivileged( new PrivilegedAc= tion() - { - public Object run() - { - return thread.getContextClassLoader(); - } - }); - } - = - = - static public ClassLoader getSystemClassLoader() - { - if (skipAccessControl) - { - return ClassLoader.getSystemClassLoader(); - } - - return (ClassLoader)AccessController.doPrivileged( new PrivilegedAct= ion() - { - public Object run() - { - return ClassLoader.getSystemClassLoader(); - } - }); - } - = - = - static public Method getMethod(final Class c, final String name, final = Class[] parameterTypes) - throws NoSuchMethodException - { - if (skipAccessControl) - { - return c.getMethod(name, parameterTypes); - } - - try - { - return (Method) AccessController.doPrivileged( new PrivilegedExce= ptionAction() - { - public Object run() throws NoSuchMethodException - { - return c.getMethod(name, parameterTypes); - } - }); - } - catch (PrivilegedActionException e) - { - throw (NoSuchMethodException) e.getCause(); - } - } - = - = - static public Method getDeclaredMethod(final Class c, final String name= , final Class[] parameterTypes) - throws NoSuchMethodException - { - if (skipAccessControl) - { - Method m =3D c.getDeclaredMethod(name, parameterTypes); - m.setAccessible(true); - return m; - } - - try - { - return (Method) AccessController.doPrivileged( new PrivilegedExce= ptionAction() - { - public Object run() throws NoSuchMethodException - { - Method m =3D c.getDeclaredMethod(name, parameterTypes); - m.setAccessible(true); - return m; - } - }); - } - catch (PrivilegedActionException e) - { - throw (NoSuchMethodException) e.getCause(); - } - } - = - static public void mapJavaBeanProperties(final Object o, final Properti= es props, final boolean isStrict) - throws IntrospectionException - { - if (skipAccessControl) - { - PropertyEditors.mapJavaBeanProperties(o, props, isStrict); - return; - } - - try - { - AccessController.doPrivileged( new PrivilegedExceptionAction() - { - public Object run() throws IntrospectionException - { - PropertyEditors.mapJavaBeanProperties(o, props, isStrict); - return null; - } - }); - } - catch (PrivilegedActionException e) - { - throw (IntrospectionException) e.getCause(); - } - } - = - = - static public void namingBeanImplStart(final Object namingBean, final M= ethod startMethod) - throws IllegalAccessException, InvocationTargetException - { - if (skipAccessControl) - { - startMethod.invoke(namingBean, new Object[] {}); - return; - } - - try - { - AccessController.doPrivileged( new PrivilegedExceptionAction() = - { - public Object run() throws IllegalAccessException, InvocationT= argetException - { - startMethod.invoke(namingBean, new Object[] {}); - return null; - } - }); - } - catch (PrivilegedActionException e) - { - Throwable cause =3D e.getCause(); - if (cause instanceof IllegalAccessException) - throw (IllegalAccessException) cause; - else - throw (InvocationTargetException) cause; - } - } - = - = - static public Object readObject(final ObjectInputStream ois) - throws IOException, ClassNotFoundException - { - if (skipAccessControl || !(ois instanceof JBossObjectInputStream)) - { - return ois.readObject(); - } - - try - { - return AccessController.doPrivileged( new PrivilegedExceptionActi= on() - { - public Object run() throws IOException, ClassNotFoundException - { - return ois.readObject(); - } - }); - } - catch (PrivilegedActionException e) - { - Throwable cause =3D e.getCause(); - if (cause instanceof IOException) - throw (IOException) cause; - else if (cause instanceof ClassNotFoundException) - throw (ClassNotFoundException) cause; - else - throw (RuntimeException) cause; - } - } - = - static public void writeObject(final ObjectOutputStream oos, final Obje= ct o) - throws IOException - { - if (skipAccessControl || !(oos instanceof JBossObjectOutputStream)) - { - oos.writeObject(o); - return; - } - - try - { - AccessController.doPrivileged( new PrivilegedExceptionAction() - { - public Object run() throws IOException - { - oos.writeObject(o); - return null; - } - }); - } - catch (PrivilegedActionException e) - { - Throwable cause =3D e.getCause(); - if (cause instanceof IOException) - throw (IOException) cause; - else - throw (RuntimeException) cause; - } - } - = - = - ///////////////////////////////////////////////////////////////////////= //////////////// - // SocketPermission methods - ///////////////////////////////////////////////////////////////////////= //////////////// - = - static public Socket accept(final ServerSocket ss) throws IOException - { - if (skipAccessControl) - { - return ss.accept(); - } - = - try - { - return (Socket)AccessController.doPrivileged( new PrivilegedExce= ptionAction() - { - public Object run() throws Exception - { - return ss.accept(); - } - }); - } - catch (PrivilegedActionException e) - { - throw (IOException) e.getCause(); - } - } - = - = - static public void bind(final ServerSocket ss, final SocketAddress addr= ess) - throws IOException - { - if (skipAccessControl) - { - ss.bind(address); - return; - } - - try - { - AccessController.doPrivileged( new PrivilegedExceptionAction() - { - public Object run() throws Exception - { - ss.bind(address); - return null; - } - }); - } - catch (PrivilegedActionException e) - { - throw (IOException) e.getCause(); - } - } - - - static public void bind(final ServerSocket ss, final SocketAddress addr= ess, - final int backlog) throws IOException - { - if (skipAccessControl) - { - ss.bind(address, backlog); - return; - } - = - try - { - AccessController.doPrivileged( new PrivilegedExceptionAction() - { - public Object run() throws Exception - { - ss.bind(address, backlog); - return null; - } - }); - } - catch (PrivilegedActionException e) - { - throw (IOException) e.getCause(); - } - } - = - = - static public void connect(final Socket socket, final InetSocketAddress= address) - throws IOException - { - if (skipAccessControl) - { - socket.connect(address); - return; - } - = - try - { - AccessController.doPrivileged( new PrivilegedExceptionAction() - { - public Object run() throws Exception - { - socket.connect(address); - return null; - } - }); - } - catch (PrivilegedActionException e) - { - throw (IOException) e.getCause(); - } = - } - = - = - static public void connect(final Socket socket, final InetSocketAddress= address, final int timeout) - throws IOException - { - if (skipAccessControl) - { - socket.connect(address, timeout); - return; - } - = - try - { - AccessController.doPrivileged( new PrivilegedExceptionAction() - { - public Object run() throws Exception - { - socket.connect(address, timeout); - return null; - } - }); - } - catch (PrivilegedActionException e) - { - throw (IOException) e.getCause(); - } = - } - = - = - static public void connect(final HttpURLConnection conn) throws IOExcep= tion - { - if (skipAccessControl) - { - conn.connect(); - return; - } - - try - { - AccessController.doPrivileged( new PrivilegedExceptionAction() - { - public Object run() throws IOException - { - conn.connect(); - return null; - } - }); - } - catch (PrivilegedActionException e) - { - throw (IOException) e.getCause(); - } - } - = - = - static public ServerSocket createServerSocket(final ServerSocketFactory= MBean ssf) throws IOException - { - if (skipAccessControl) - { - return ssf.createServerSocket(); - } - - try - { - return (ServerSocket)AccessController.doPrivileged( new Privilege= dExceptionAction() - { - public Object run() throws IOException - { - return ssf.createServerSocket(); - } - }); - } - catch (PrivilegedActionException e) - { - throw (IOException) e.getCause(); - } - } - = - = - static public ServerSocket createServerSocket(final ServerSocketFactory= MBean ssf, - final int port) throws IO= Exception - { - if (skipAccessControl) - { - return ssf.createServerSocket(port); - } - = - try - { - return (ServerSocket)AccessController.doPrivileged( new Privileg= edExceptionAction() - { - public Object run() throws Exception - { - return ssf.createServerSocket(port); - } - }); - } - catch (PrivilegedActionException e) - { - throw (IOException) e.getCause(); - } - } - - = - static public ServerSocket createServerSocket(final ServerSocketFactory= MBean ssf, - final int port, final int= backlog) - throws IOException - { - if (skipAccessControl) - { - return ssf.createServerSocket(port, backlog); - } - - try - { - return (ServerSocket)AccessController.doPrivileged( new Privilege= dExceptionAction() - { - public Object run() throws Exception - { - return ssf.createServerSocket(port, backlog); - } - }); - } - catch (PrivilegedActionException e) - { - throw (IOException) e.getCause(); - } - } - - = - static public ServerSocket createServerSocket(final ServerSocketFactory= MBean ssf, - final int port, final int= backlog, - final InetAddress inetAdd= ress) - throws IOException - { - if (skipAccessControl) - { - return ssf.createServerSocket(port, backlog, inetAddress); - } - - try - { - return (ServerSocket)AccessController.doPrivileged( new Privilege= dExceptionAction() - { - public Object run() throws Exception - { - return ssf.createServerSocket(port, backlog, inetAddress); - } - }); - } - catch (PrivilegedActionException e) - { - throw (IOException) e.getCause(); - } - } - - = - static public ServerSocket createServerSocket(final ServerSocketFactory= ssf) throws IOException - { - if (skipAccessControl) - { - return ssf.createServerSocket(); - } - - try - { - return (ServerSocket)AccessController.doPrivileged( new Privilege= dExceptionAction() - { - public Object run() throws IOException - { - return ssf.createServerSocket(); - } - }); - } - catch (PrivilegedActionException e) - { - throw (IOException) e.getCause(); - } - } - = - = - static public ServerSocket createServerSocket(final ServerSocketFactory= ssf, - final int port) throws IO= Exception - { - if (skipAccessControl) - { - return ssf.createServerSocket(port); - } - - try - { - return (ServerSocket)AccessController.doPrivileged( new Privilege= dExceptionAction() - { - public Object run() throws Exception - { - return ssf.createServerSocket(port); - } - }); - } - catch (PrivilegedActionException e) - { - throw (IOException) e.getCause(); - } - } - - - static public ServerSocket createServerSocket(final ServerSocketFactory= ssf, - final int port, final int= backlog) - throws IOException - { - if (skipAccessControl) - { - return ssf.createServerSocket(port, backlog); - } - - try - { - return (ServerSocket)AccessController.doPrivileged( new Privilege= dExceptionAction() - { - public Object run() throws Exception - { - return ssf.createServerSocket(port, backlog); - } - }); - } - catch (PrivilegedActionException e) - { - throw (IOException) e.getCause(); - } - } - - - static public ServerSocket createServerSocket(final ServerSocketFactory= ssf, - final int port, final int= backlog, - final InetAddress inetAdd= ress) - throws IOException - { - if (skipAccessControl) - { - return ssf.createServerSocket(port, backlog, inetAddress); - } - - try - { - return (ServerSocket)AccessController.doPrivileged( new Privilege= dExceptionAction() - { - public Object run() throws Exception - { - return ssf.createServerSocket(port, backlog, inetAddress); - } - }); - } - catch (PrivilegedActionException e) - { - throw (IOException) e.getCause(); - } - } - = - = - static public ServerSocket createServerSocket(final int port) throws IO= Exception - { - if (skipAccessControl) - { - return new ServerSocket(port); - } - - try - { - return (ServerSocket)AccessController.doPrivileged( new Privilege= dExceptionAction() - { - public Object run() throws IOException - { - return new ServerSocket(port); - } - }); - } - catch (PrivilegedActionException e) - { - throw (IOException) e.getCause(); - } - } - - - static public ServerSocket createServerSocket(final int port, final int= backlog) - throws IOException - { - if (skipAccessControl) - { - return new ServerSocket(port, backlog); - } - - try - { - return (ServerSocket)AccessController.doPrivileged( new Privilege= dExceptionAction() - { - public Object run() throws IOException - { - return new ServerSocket(port, backlog); - } - }); - } - catch (PrivilegedActionException e) - { - throw (IOException) e.getCause(); - } - } - - - static public ServerSocket createServerSocket(final int port, final int= backlog, - final InetAddress inetAdd= ress) - throws IOException - { - if (skipAccessControl) - { - return new ServerSocket(port, backlog, inetAddress); - } - - try - { - return (ServerSocket)AccessController.doPrivileged( new Privilege= dExceptionAction() - { - public Object run() throws IOException - { - return new ServerSocket(port, backlog, inetAddress); - } - }); - } - catch (PrivilegedActionException e) - { - throw (IOException) e.getCause(); - } - } - - - static public Socket createSocket(final String host, final int port) th= rows IOException - { - if (skipAccessControl) - { - return new Socket(host, port); - } - = - try - { - return (Socket)AccessController.doPrivileged( new PrivilegedExce= ptionAction() - { - public Object run() throws IOException - { - return new Socket(host, port); - } - }); - } - catch (PrivilegedActionException e) - { - throw (IOException) e.getCause(); - } - } - - - static public Socket createSocket(final SocketFactory sf, final String = host, final int port) - throws IOException - { - if (skipAccessControl) - { - return sf.createSocket(host, port); - } - = - try - { - return (Socket)AccessController.doPrivileged( new PrivilegedExce= ptionAction() - { - public Object run() throws IOException - { - return sf.createSocket(host, port); - } - }); - } - catch (PrivilegedActionException e) - { - throw (IOException) e.getCause(); - } - } - = - = - static public InetAddress getLocalHost() throws UnknownHostException - { - if (skipAccessControl) - { - try - { - return InetAddress.getLocalHost(); - } - catch (IOException e) - { - return InetAddress.getByName("127.0.0.1"); - } - } - - try - { - return (InetAddress) AccessController.doPrivileged( new Privilege= dExceptionAction() - { - public Object run() throws IOException - { - try - { - return InetAddress.getLocalHost(); - } - catch (IOException e) - { - return InetAddress.getByName("127.0.0.1"); - } - } - }); - } - catch (PrivilegedActionException e) - { - throw (UnknownHostException) e.getCause(); - } - } - - = - static public String getLocalHostName() throws UnknownHostException - { - if (skipAccessControl) - { - return getLocalHost().getHostName(); - } - - try - { - return (String) AccessController.doPrivileged( new PrivilegedExce= ptionAction() - { - public Object run() throws IOException - { - InetAddress address =3D null; - try - { - address =3D InetAddress.getLocalHost(); - } - catch (IOException e) - { - address =3D InetAddress.getByName("127.0.0.1"); - } - = - return address.getHostName(); - } - }); - } - catch (PrivilegedActionException e) - { - throw (UnknownHostException) e.getCause(); - } - } - = - = - static public InetAddress getAddressByName(final String host) throws Un= knownHostException - { - if (skipAccessControl) - { - return InetAddress.getByName(host); - } - = - try - { - return (InetAddress)AccessController.doPrivileged( new Privileged= ExceptionAction() - { - public Object run() throws IOException - { - return InetAddress.getByName(host); - } - }); - } - catch (PrivilegedActionException e) - { - throw (UnknownHostException) e.getCause(); - } - } - = - = - static public OutputStream getOutputStream(final HttpURLConnection conn) - throws IOException - { - if (skipAccessControl) - { - return conn.getOutputStream(); - } - = - try - { - return (OutputStream)AccessController.doPrivileged( new Privilege= dExceptionAction() - { - public Object run() throws IOException - { - return conn.getOutputStream(); - } - }); - } - catch (PrivilegedActionException e) - { - throw (IOException) e.getCause(); - } - } - = - = - static public int getResponseCode(final HttpURLConnection conn) - throws IOException - { - if (skipAccessControl) - { - return conn.getResponseCode(); - } - = - try - { - return ((Integer) AccessController.doPrivileged( new PrivilegedEx= ceptionAction() - { - public Object run() throws IOException - { - return new Integer(conn.getResponseCode()); - } - })).intValue(); - } - catch (PrivilegedActionException e) - { - throw (IOException) e.getCause(); - } - } - = - = - static public String getResponseMessage(final HttpURLConnection conn) - throws IOException - { - if (skipAccessControl) - { - return conn.getResponseMessage(); - } - = - try - { - return (String) AccessController.doPrivileged( new PrivilegedExce= ptionAction() - { - public Object run() throws IOException - { - return conn.getResponseMessage(); - } - }); - } - catch (PrivilegedActionException e) - { - throw (IOException) e.getCause(); - } - } - = - = - static public Object callTransport(final RMIServerInvokerInf server, fi= nal Object payload) - throws IOException - { - if (skipAccessControl) - { - return server.transport(payload); - } - - try - { - return AccessController.doPrivileged( new PrivilegedExceptionActi= on() - { - public Object run() throws IOException - { - return server.transport(payload); - } - }); - } - catch (PrivilegedActionException e) - { - throw (IOException) e.getCause(); - } = - } - - - static public Registry createRegistry(final int port) throws RemoteExce= ption - { - if (skipAccessControl) - { - return LocateRegistry.createRegistry(port); - } - = - try - { - return (Registry) AccessController.doPrivileged( new PrivilegedEx= ceptionAction() - { - public Object run() throws RemoteException - { - return LocateRegistry.createRegistry(port); - } - }); - } - catch (PrivilegedActionException e) - { - throw (RemoteException) e.getCause(); - } = - } - = - = - static public Remote exportObject(final Remote object, - final int port, - final RMIClientSocketFactory csf, - final RMIServerSocketFactory ssf) - throws RemoteException - { - if (skipAccessControl) - { - return UnicastRemoteObject.exportObject(object, port, csf, ssf); - } - = - try - { - return (Remote) AccessController.doPrivileged( new PrivilegedExce= ptionAction() - { - public Object run() throws RemoteException - { - return UnicastRemoteObject.exportObject(object, port, csf, = ssf); - } - }); - } - catch (PrivilegedActionException e) - { - throw (RemoteException) e.getCause(); - } - } - - = - static public Registry getRegistry(final int port) throws RemoteExcepti= on - { - if (skipAccessControl) - { - return LocateRegistry.getRegistry(port); - } - = - try - { - return (Registry) AccessController.doPrivileged( new PrivilegedEx= ceptionAction() - { - public Object run() throws RemoteException - { - return LocateRegistry.getRegistry(port); - } - }); - } - catch (PrivilegedActionException e) - { - throw (RemoteException) e.getCause(); - } = - } - = - = - static public Remote lookup(final Registry registry, final String name) - throws RemoteException, NotBoundException - { - if (skipAccessControl) - { - return registry.lookup(name); - } - = - try - { - return (Remote) AccessController.doPrivileged( new PrivilegedExce= ptionAction() - { - public Object run() throws Exception - { - return registry.lookup(name); - } - }); - } - catch (PrivilegedActionException e) - { - Throwable cause =3D e.getCause(); - if (cause instanceof RemoteException) - throw (RemoteException) cause; - else - throw (NotBoundException) cause; - } - } - = - = - static public void rebind(final Registry registry, final String name, f= inal Remote object) - throws IOException - { - if (skipAccessControl) - { - registry.rebind(name, object); - return; - } - = - try - { - AccessController.doPrivileged( new PrivilegedExceptionAction() - { - public Object run() throws IOException - { - registry.rebind(name, object); - return null; - } - }); - } - catch (PrivilegedActionException e) - { - throw (IOException) e.getCause(); - } - } - = - = - static public void unbind(final Registry registry, final String name) - throws AccessException, RemoteException, NotBoundException - { - if (skipAccessControl) - { - registry.unbind(name); - return; - } - = - try - { - AccessController.doPrivileged( new PrivilegedExceptionAction() - { - public Object run() throws AccessException, RemoteException, N= otBoundException - { - registry.unbind(name); - return null; - } - }); - } - catch (PrivilegedActionException e) - { - Throwable cause =3D e.getCause(); - if (cause instanceof AccessException) - throw (AccessException) cause; - else if (cause instanceof RemoteException) - throw (RemoteException) cause; - else - throw (NotBoundException) cause; - } - } - = - = - ///////////////////////////////////////////////////////////////////////= //////////////// - // JBoss JNDI permission methods - ///////////////////////////////////////////////////////////////////////= //////////////// - = - static public Context createSubcontext(final InitialContext initialCont= ext, final String subContextName) - throws NamingException - { - if (skipAccessControl) - { - return initialContext.createSubcontext(subContextName); - } - - try - { - return (Context) AccessController.doPrivileged( new PrivilegedExc= eptionAction() = - { - public Object run() throws NamingException - { - return initialContext.createSubcontext(subContextName); - } - }); - } - catch (PrivilegedActionException e) - { - throw (NamingException) e.getCause(); - } - } - = - = - static public Context initialContextLookup(final InitialContext initial= Context, final String subContextName) - throws NamingException - { - if (skipAccessControl) - { - return (Context) initialContext.lookup(subContextName); - } - - try - { - return (Context) AccessController.doPrivileged( new PrivilegedExc= eptionAction() = - { - public Object run() throws NamingException - { - return initialContext.lookup(subContextName); - } - }); - } - catch (PrivilegedActionException e) - { - throw (NamingException) e.getCause(); - } - } - = - static public NamingEnumeration listBindings(final Context context, fin= al String bindName) - throws NamingException - { - if (skipAccessControl) - { - return context.listBindings(bindName); - } - - try - { - return (NamingEnumeration) AccessController.doPrivileged( new Pri= vilegedExceptionAction() = - { - public Object run() throws NamingException - { - return context.listBindings(bindName); - } - }); - } - catch (PrivilegedActionException e) - { - throw (NamingException) e.getCause(); - } - } - = - = - static public void rebind(final Context context, final String name, fin= al Object object) - throws NamingException - { - if (skipAccessControl) - { - context.rebind(name, object); - return; - } - - try - { - AccessController.doPrivileged( new PrivilegedExceptionAction() = - { - public Object run() throws NamingException - { - context.rebind(name, object); - return null; - } - }); - } - catch (PrivilegedActionException e) - { - throw (NamingException) e.getCause(); - } - } - = - = - static public void unbind(final Context context, final String name) - throws NamingException - { - if (skipAccessControl) - { - context.unbind(name); - return; - } - - try - { - AccessController.doPrivileged( new PrivilegedExceptionAction() = - { - public Object run() throws NamingException - { - context.unbind(name); - return null; - } - }); - } - catch (PrivilegedActionException e) - { - throw (NamingException) e.getCause(); - } - } } \ No newline at end of file --===============3093076562772004195==-- From jboss-remoting-commits at lists.jboss.org Tue Apr 14 06:27:24 2009 Content-Type: multipart/mixed; boundary="===============5988341818334761533==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5025 - remoting2/branches/2.x/src/main/org/jboss/remoting/util. Date: Tue, 14 Apr 2009 06:27:24 -0400 Message-ID: <E1LtfrQ-0005LD-7v@committer01.frg.pub.inap.atl.jboss.com> --===============5988341818334761533== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-14 06:27:24 -0400 (Tue, 14 Apr 2009) New Revision: 5025 Removed: remoting2/branches/2.x/src/main/org/jboss/remoting/util/ServletSecurityU= tility.java Log: JBREM-1116: Eliminated ServletSecurityUtility. Deleted: remoting2/branches/2.x/src/main/org/jboss/remoting/util/ServletSec= urityUtility.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/util/ServletSecurity= Utility.java 2009-04-14 10:27:01 UTC (rev 5024) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/util/ServletSecurity= Utility.java 2009-04-14 10:27:24 UTC (rev 5025) @@ -1,75 +0,0 @@ -/* - * 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.remoting.util; - -import java.io.IOException; -import java.security.AccessController; -import java.security.PrivilegedActionException; -import java.security.PrivilegedExceptionAction; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.jboss.remoting.transport.servlet.ServletServerInvokerMBean; - - -/** - * @author <a href=3D"ron.sigal(a)jboss.com">Ron Sigal</a> - * @version $Revision: 1.1 $ - * <p> - * Copyright May 28, 2008 - * </p> - */ -public class ServletSecurityUtility -{ - static public byte[] processRequest(final ServletServerInvokerMBean inv= oker, - final HttpServletRequest request, - final byte[] byteArray, - final HttpServletResponse response) - throws ServletException, IOException - { - if (SecurityUtility.skipAccessControl()) - { - return invoker.processRequest(request, byteArray, response); - } - - try - { - return (byte[]) AccessController.doPrivileged( new PrivilegedExce= ptionAction() - { - public Object run() throws ServletException, IOException - { - return invoker.processRequest(request, byteArray, response); - } - }); - } - catch (PrivilegedActionException e) - { - Throwable cause =3D e.getCause(); - if (cause instanceof ServletException) - throw (ServletException) cause; - else - throw (IOException) e.getCause(); - } = - } -} --===============5988341818334761533==-- From jboss-remoting-commits at lists.jboss.org Tue Apr 14 06:30:40 2009 Content-Type: multipart/mixed; boundary="===============2639513088121790119==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5026 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/jndi. Date: Tue, 14 Apr 2009 06:30:40 -0400 Message-ID: <E1Ltfua-0006sI-8Q@committer01.frg.pub.inap.atl.jboss.com> --===============2639513088121790119== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-14 06:30:40 -0400 (Tue, 14 Apr 2009) New Revision: 5026 Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/jndi/= CleanDetectionTestClient.java remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/jndi/= CleanDetectionTestServer.java remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/jndi/= JNDIDetector2TestCase.java remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/jndi/= JNDIDetectorTest1.java remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/jndi/= JNDIDetectorTestCase.java remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/jndi/= RestartTestServer.java Log: JBREM-1116: Eliminated dependence on SecurityUtility. Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detectio= n/jndi/CleanDetectionTestClient.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/jndi= /CleanDetectionTestClient.java 2009-04-14 10:27:24 UTC (rev 5025) +++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/jndi= /CleanDetectionTestClient.java 2009-04-14 10:30:40 UTC (rev 5026) @@ -25,6 +25,9 @@ import java.io.OutputStream; import java.net.InetAddress; import java.net.Socket; +import java.security.AccessController; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; import java.util.Properties; = import javax.naming.Binding; @@ -98,7 +101,7 @@ = // Get detection message from JNDI server. createContext(); - NamingEnumeration enumeration =3D SecurityUtility.listBindings(co= ntext, ""); + NamingEnumeration enumeration =3D listBindings(context, ""); assertTrue(enumeration.hasMore()); Binding binding =3D (Binding) enumeration.next(); assertFalse(enumeration.hasMore()); @@ -117,7 +120,7 @@ Thread.sleep(4000); = // Get new detection message from JNDI server. - enumeration =3D SecurityUtility.listBindings(context, ""); + enumeration =3D listBindings(context, ""); assertTrue(enumeration.hasMore()); binding =3D (Binding) enumeration.next(); log.info(binding); @@ -158,20 +161,91 @@ String subContextName =3D JNDIDetector.DETECTION_SUBCONTEXT_NAME; try { - context =3D SecurityUtility.initialContextLookup(initialContext, = subContextName); + context =3D initialContextLookup(initialContext, subContextName); } catch(NamingException e) { try { - context =3D SecurityUtility.createSubcontext(initialContext, s= ubContextName); + context =3D createSubcontext(initialContext, subContextName); } catch(NameAlreadyBoundException e1) { log.debug("The sub context " + subContextName + " was created = before we could."); - context =3D SecurityUtility.initialContextLookup(initialContex= t, subContextName); + context =3D initialContextLookup(initialContext, subContextNam= e); } } } + = + static private Context createSubcontext(final InitialContext initialCon= text, final String subContextName) + throws NamingException + { + if (SecurityUtility.skipAccessControl()) + { + return initialContext.createSubcontext(subContextName); + } = + try + { + return (Context) AccessController.doPrivileged( new PrivilegedExc= eptionAction() = + { + public Object run() throws NamingException + { + return initialContext.createSubcontext(subContextName); + } + }); + } + catch (PrivilegedActionException e) + { + throw (NamingException) e.getCause(); + } + } + = + static private Context initialContextLookup(final InitialContext initia= lContext, final String subContextName) + throws NamingException + { + if (SecurityUtility.skipAccessControl()) + { + return (Context) initialContext.lookup(subContextName); + } + + try + { + return (Context) AccessController.doPrivileged( new PrivilegedExc= eptionAction() = + { + public Object run() throws NamingException + { + return initialContext.lookup(subContextName); + } + }); + } + catch (PrivilegedActionException e) + { + throw (NamingException) e.getCause(); + } + } + = + static private NamingEnumeration listBindings(final Context context, fi= nal String bindName) + throws NamingException + { + if (SecurityUtility.skipAccessControl()) + { + return context.listBindings(bindName); + } + + try + { + return (NamingEnumeration) AccessController.doPrivileged( new Pri= vilegedExceptionAction() = + { + public Object run() throws NamingException + { + return context.listBindings(bindName); + } + }); + } + catch (PrivilegedActionException e) + { + throw (NamingException) e.getCause(); + } + } } Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detectio= n/jndi/CleanDetectionTestServer.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/jndi= /CleanDetectionTestServer.java 2009-04-14 10:27:24 UTC (rev 5025) +++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/jndi= /CleanDetectionTestServer.java 2009-04-14 10:30:40 UTC (rev 5026) @@ -43,10 +43,14 @@ import java.io.InputStream; import java.io.OutputStream; import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.net.InetAddress; import java.net.ServerSocket; import java.net.Socket; +import java.security.AccessController; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; import java.util.HashMap; import java.util.Map; import java.util.Timer; @@ -135,8 +139,8 @@ namingBeanImplClass =3D Class.forName("org.jnp.server.NamingBeanI= mpl"); namingBean =3D namingBeanImplClass.newInstance(); Method startMethod =3D namingBeanImplClass.getMethod("start", new= Class[] {}); - SecurityUtility.setSystemProperty("java.naming.factory.initial", = "org.jnp.interfaces.NamingContextFactory"); - SecurityUtility.namingBeanImplStart(namingBean, startMethod); + setSystemProperty("java.naming.factory.initial", "org.jnp.interfa= ces.NamingContextFactory"); + namingBeanImplStart(namingBean, startMethod); } catch (Exception e) { @@ -331,4 +335,58 @@ // NO OP as we do not need a reference back to the server invoker } } + = + static private void setSystemProperty(final String name, final String v= alue) + { + if (SecurityUtility.skipAccessControl()) + { + System.setProperty(name, value); + return; + } + = + try + { + AccessController.doPrivileged( new PrivilegedExceptionAction() + { + public Object run() throws Exception + { + return System.setProperty(name, value); + } + }); + } + catch (PrivilegedActionException e) + { + throw (RuntimeException) e.getCause(); + } + } + = + static private void namingBeanImplStart(final Object namingBean, final = Method startMethod) + throws IllegalAccessException, InvocationTargetException + { + if (SecurityUtility.skipAccessControl()) + { + startMethod.invoke(namingBean, new Object[] {}); + return; + } + + try + { + AccessController.doPrivileged( new PrivilegedExceptionAction() = + { + public Object run() throws IllegalAccessException, InvocationT= argetException + { + startMethod.invoke(namingBean, new Object[] {}); + return null; + } + }); + } + catch (PrivilegedActionException e) + { + Throwable cause =3D e.getCause(); + if (cause instanceof IllegalAccessException) + throw (IllegalAccessException) cause; + else + throw (InvocationTargetException) cause; + } + } } Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detectio= n/jndi/JNDIDetector2TestCase.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/jndi= /JNDIDetector2TestCase.java 2009-04-14 10:27:24 UTC (rev 5025) +++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/jndi= /JNDIDetector2TestCase.java 2009-04-14 10:30:40 UTC (rev 5026) @@ -8,6 +8,9 @@ = import java.lang.reflect.Method; import java.net.InetAddress; +import java.security.AccessController; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; = /** * This should be used as the main test case for JNDI detector. @@ -36,7 +39,7 @@ namingBeanImplClass =3D Class.forName("org.jnp.server.NamingBe= anImpl"); namingBean =3D namingBeanImplClass.newInstance(); Method startMethod =3D namingBeanImplClass.getMethod("start", = new Class[] {}); - SecurityUtility.setSystemProperty("java.naming.factory.initial= ", "org.jnp.interfaces.NamingContextFactory"); + setSystemProperty("java.naming.factory.initial", "org.jnp.inte= rfaces.NamingContextFactory"); startMethod.invoke(namingBean, new Object[] {}); } catch (Exception e) @@ -109,4 +112,28 @@ { return 300000; } + = + static private void setSystemProperty(final String name, final String v= alue) + { + if (SecurityUtility.skipAccessControl()) + { + System.setProperty(name, value); + return; + } + = + try + { + AccessController.doPrivileged( new PrivilegedExceptionAction() + { + public Object run() throws Exception + { + return System.setProperty(name, value); + } + }); + } + catch (PrivilegedActionException e) + { + throw (RuntimeException) e.getCause(); + } + } } Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detectio= n/jndi/JNDIDetectorTest1.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/jndi= /JNDIDetectorTest1.java 2009-04-14 10:27:24 UTC (rev 5025) +++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/jndi= /JNDIDetectorTest1.java 2009-04-14 10:30:40 UTC (rev 5026) @@ -24,6 +24,10 @@ = import java.lang.reflect.Method; import java.net.InetAddress; +import java.security.AccessController; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; + import javax.management.MBeanServer; import javax.management.MBeanServerFactory; import javax.management.ObjectName; @@ -176,7 +180,7 @@ namingBeanImplClass =3D Class.forName("org.jnp.server.NamingBe= anImpl"); namingBean =3D namingBeanImplClass.newInstance(); Method startMethod =3D namingBeanImplClass.getMethod("start", = new Class[] {}); - SecurityUtility.setSystemProperty("java.naming.factory.initial= ", "org.jnp.interfaces.NamingContextFactory"); + setSystemProperty("java.naming.factory.initial", "org.jnp.inte= rfaces.NamingContextFactory"); startMethod.invoke(namingBean, new Object[] {}); } catch (Exception e) @@ -218,5 +222,28 @@ return new JNDIDetectorTest1.TestNetworkRegistry(); } } - + = + static private void setSystemProperty(final String name, final String v= alue) + { + if (SecurityUtility.skipAccessControl()) + { + System.setProperty(name, value); + return; + } + = + try + { + AccessController.doPrivileged( new PrivilegedExceptionAction() + { + public Object run() throws Exception + { + return System.setProperty(name, value); + } + }); + } + catch (PrivilegedActionException e) + { + throw (RuntimeException) e.getCause(); + } + } } \ No newline at end of file Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detectio= n/jndi/JNDIDetectorTestCase.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/jndi= /JNDIDetectorTestCase.java 2009-04-14 10:27:24 UTC (rev 5025) +++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/jndi= /JNDIDetectorTestCase.java 2009-04-14 10:30:40 UTC (rev 5026) @@ -24,6 +24,10 @@ = import java.lang.reflect.Method; import java.net.InetAddress; +import java.security.AccessController; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; + import org.apache.log4j.Level; import org.jboss.jrunit.harness.TestDriver; import org.jboss.remoting.samples.detection.jndi.SimpleJNDIServer; @@ -58,7 +62,7 @@ namingBeanImplClass =3D Class.forName("org.jnp.server.NamingBe= anImpl"); namingBean =3D namingBeanImplClass.newInstance(); Method startMethod =3D namingBeanImplClass.getMethod("start", = new Class[] {}); - SecurityUtility.setSystemProperty("java.naming.factory.initial= ", "org.jnp.interfaces.NamingContextFactory"); + setSystemProperty("java.naming.factory.initial", "org.jnp.inte= rfaces.NamingContextFactory"); startMethod.invoke(namingBean, new Object[] {}); } catch (Exception e) @@ -130,4 +134,28 @@ { return 300000; } + = + static private void setSystemProperty(final String name, final String v= alue) + { + if (SecurityUtility.skipAccessControl()) + { + System.setProperty(name, value); + return; + } + = + try + { + AccessController.doPrivileged( new PrivilegedExceptionAction() + { + public Object run() throws Exception + { + return System.setProperty(name, value); + } + }); + } + catch (PrivilegedActionException e) + { + throw (RuntimeException) e.getCause(); + } + } } \ No newline at end of file Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detectio= n/jndi/RestartTestServer.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/jndi= /RestartTestServer.java 2009-04-14 10:27:24 UTC (rev 5025) +++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/jndi= /RestartTestServer.java 2009-04-14 10:30:40 UTC (rev 5026) @@ -44,6 +44,9 @@ import java.net.InetAddress; import java.net.ServerSocket; import java.net.Socket; +import java.security.AccessController; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; import java.util.HashMap; import java.util.Map; = @@ -132,7 +135,7 @@ namingBeanImplClass =3D Class.forName("org.jnp.server.NamingBeanI= mpl"); namingBean =3D namingBeanImplClass.newInstance(); Method startMethod =3D namingBeanImplClass.getMethod("start", new= Class[] {}); - SecurityUtility.setSystemProperty("java.naming.factory.initial", = "org.jnp.interfaces.NamingContextFactory"); + setSystemProperty("java.naming.factory.initial", "org.jnp.interfa= ces.NamingContextFactory"); startMethod.invoke(namingBean, new Object[] {}); } catch (Exception e) @@ -313,4 +316,28 @@ // NO OP as we do not need a reference back to the server invoker } } + = + static private void setSystemProperty(final String name, final String v= alue) + { + if (SecurityUtility.skipAccessControl()) + { + System.setProperty(name, value); + return; + } + = + try + { + AccessController.doPrivileged( new PrivilegedExceptionAction() + { + public Object run() throws Exception + { + return System.setProperty(name, value); + } + }); + } + catch (PrivilegedActionException e) + { + throw (RuntimeException) e.getCause(); + } + } } --===============2639513088121790119==-- From jboss-remoting-commits at lists.jboss.org Tue Apr 14 06:31:06 2009 Content-Type: multipart/mixed; boundary="===============5565820970601139378==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5027 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/jndi/deadlock. Date: Tue, 14 Apr 2009 06:31:06 -0400 Message-ID: <E1Ltfv0-0006tv-82@committer01.frg.pub.inap.atl.jboss.com> --===============5565820970601139378== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-14 06:31:06 -0400 (Tue, 14 Apr 2009) New Revision: 5027 Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/jndi/= deadlock/Server.java Log: JBREM-1116: Eliminated dependence on SecurityUtility. Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detectio= n/jndi/deadlock/Server.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/jndi= /deadlock/Server.java 2009-04-14 10:30:40 UTC (rev 5026) +++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/jndi= /deadlock/Server.java 2009-04-14 10:31:06 UTC (rev 5027) @@ -45,6 +45,9 @@ import java.lang.reflect.Method; import java.net.InetAddress; import java.net.UnknownHostException; +import java.security.AccessController; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; import java.util.HashMap; import java.util.Map; = @@ -228,7 +231,7 @@ namingBeanImplClass =3D Class.forName("org.jnp.server.NamingBeanI= mpl"); namingBean =3D namingBeanImplClass.newInstance(); Method startMethod =3D namingBeanImplClass.getMethod("start", new= Class[] {}); - SecurityUtility.setSystemProperty("java.naming.factory.initial", = "org.jnp.interfaces.NamingContextFactory"); + setSystemProperty("java.naming.factory.initial", "org.jnp.interfa= ces.NamingContextFactory"); startMethod.invoke(namingBean, new Object[] {}); } catch (Exception e) @@ -347,6 +350,29 @@ } = } - + = + static private void setSystemProperty(final String name, final String v= alue) + { + if (SecurityUtility.skipAccessControl()) + { + System.setProperty(name, value); + return; + } + = + try + { + AccessController.doPrivileged( new PrivilegedExceptionAction() + { + public Object run() throws Exception + { + return System.setProperty(name, value); + } + }); + } + catch (PrivilegedActionException e) + { + throw (RuntimeException) e.getCause(); + } + } } = --===============5565820970601139378==-- From jboss-remoting-commits at lists.jboss.org Tue Apr 14 06:31:30 2009 Content-Type: multipart/mixed; boundary="===============0302613272355519979==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5028 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/jndi/deadlock3. Date: Tue, 14 Apr 2009 06:31:30 -0400 Message-ID: <E1LtfvO-0006vO-NK@committer01.frg.pub.inap.atl.jboss.com> --===============0302613272355519979== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-14 06:31:30 -0400 (Tue, 14 Apr 2009) New Revision: 5028 Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/jndi/= deadlock3/Server.java Log: JBREM-1116: Eliminated dependence on SecurityUtility. Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detectio= n/jndi/deadlock3/Server.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/jndi= /deadlock3/Server.java 2009-04-14 10:31:06 UTC (rev 5027) +++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/jndi= /deadlock3/Server.java 2009-04-14 10:31:30 UTC (rev 5028) @@ -45,6 +45,9 @@ import java.lang.reflect.Method; import java.net.InetAddress; import java.net.UnknownHostException; +import java.security.AccessController; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; import java.util.HashMap; import java.util.Map; = @@ -201,7 +204,7 @@ namingBeanImplClass =3D Class.forName("org.jnp.server.NamingBeanI= mpl"); namingBean =3D namingBeanImplClass.newInstance(); Method startMethod =3D namingBeanImplClass.getMethod("start", new= Class[] {}); - SecurityUtility.setSystemProperty("java.naming.factory.initial", = "org.jnp.interfaces.NamingContextFactory"); + setSystemProperty("java.naming.factory.initial", "org.jnp.interfa= ces.NamingContextFactory"); startMethod.invoke(namingBean, new Object[] {}); } catch (Exception e) @@ -317,6 +320,29 @@ } = } - + = + static private void setSystemProperty(final String name, final String v= alue) + { + if (SecurityUtility.skipAccessControl()) + { + System.setProperty(name, value); + return; + } + = + try + { + AccessController.doPrivileged( new PrivilegedExceptionAction() + { + public Object run() throws Exception + { + return System.setProperty(name, value); + } + }); + } + catch (PrivilegedActionException e) + { + throw (RuntimeException) e.getCause(); + } + } } = --===============0302613272355519979==-- From jboss-remoting-commits at lists.jboss.org Tue Apr 14 06:31:57 2009 Content-Type: multipart/mixed; boundary="===============5500867180695777793==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5029 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/jndi/startup. Date: Tue, 14 Apr 2009 06:31:54 -0400 Message-ID: <E1Ltfvm-0006zU-BJ@committer01.frg.pub.inap.atl.jboss.com> --===============5500867180695777793== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-14 06:31:53 -0400 (Tue, 14 Apr 2009) New Revision: 5029 Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/jndi/= startup/JNDIDetectorServer.java Log: JBREM-1116: Eliminated dependence on SecurityUtility. Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detectio= n/jndi/startup/JNDIDetectorServer.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/jndi= /startup/JNDIDetectorServer.java 2009-04-14 10:31:30 UTC (rev 5028) +++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/jndi= /startup/JNDIDetectorServer.java 2009-04-14 10:31:53 UTC (rev 5029) @@ -38,6 +38,9 @@ = import java.lang.reflect.Method; import java.net.InetAddress; +import java.security.AccessController; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; = /** * @author <a href=3D"mailto:tom.elrod(a)jboss.com">Tom Elrod</a> @@ -62,7 +65,7 @@ namingBeanImplClass =3D Class.forName("org.jnp.server.NamingBeanI= mpl"); namingBean =3D namingBeanImplClass.newInstance(); Method startMethod =3D namingBeanImplClass.getMethod("start", new= Class[] {}); - SecurityUtility.setSystemProperty("java.naming.factory.initial", = "org.jnp.interfaces.NamingContextFactory"); + setSystemProperty("java.naming.factory.initial", "org.jnp.interfa= ces.NamingContextFactory"); startMethod.invoke(namingBean, new Object[] {}); } catch (Exception e) @@ -158,5 +161,28 @@ = } = - + = + static private void setSystemProperty(final String name, final String v= alue) + { + if (SecurityUtility.skipAccessControl()) + { + System.setProperty(name, value); + return; + } + = + try + { + AccessController.doPrivileged( new PrivilegedExceptionAction() + { + public Object run() throws Exception + { + return System.setProperty(name, value); + } + }); + } + catch (PrivilegedActionException e) + { + throw (RuntimeException) e.getCause(); + } + } } \ No newline at end of file --===============5500867180695777793==-- From jboss-remoting-commits at lists.jboss.org Tue Apr 14 06:33:42 2009 Content-Type: multipart/mixed; boundary="===============5765047117856702117==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5030 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/bisocket/timertask. Date: Tue, 14 Apr 2009 06:33:39 -0400 Message-ID: <E1LtfxT-00070k-VG@committer01.frg.pub.inap.atl.jboss.com> --===============5765047117856702117== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-14 06:33:39 -0400 (Tue, 14 Apr 2009) New Revision: 5030 Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/bisoc= ket/timertask/TimerTaskTestCase.java Log: JBREM-1116: Eliminated dependence on SecurityUtility. Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transpor= t/bisocket/timertask/TimerTaskTestCase.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/biso= cket/timertask/TimerTaskTestCase.java 2009-04-14 10:31:53 UTC (rev 5029) +++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/biso= cket/timertask/TimerTaskTestCase.java 2009-04-14 10:33:39 UTC (rev 5030) @@ -24,6 +24,9 @@ import java.lang.reflect.Field; import java.lang.reflect.Method; import java.net.InetAddress; +import java.security.AccessController; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; import java.util.HashMap; import java.util.Map; import java.util.Set; @@ -94,7 +97,7 @@ = try { - SecurityUtility.getDeclaredMethod(Timer.class, "purge", new Cl= ass[]{}); + getDeclaredMethod(Timer.class, "purge", new Class[]{}); purgeMethodAvailable =3D true; } catch (Exception e) @@ -340,4 +343,32 @@ log.info("received callback"); } = } + = + static private Method getDeclaredMethod(final Class c, final String nam= e, final Class[] parameterTypes) + throws NoSuchMethodException + { + if (SecurityUtility.skipAccessControl()) + { + Method m =3D c.getDeclaredMethod(name, parameterTypes); + m.setAccessible(true); + return m; + } + + try + { + return (Method) AccessController.doPrivileged( new PrivilegedExce= ptionAction() + { + public Object run() throws NoSuchMethodException + { + Method m =3D c.getDeclaredMethod(name, parameterTypes); + m.setAccessible(true); + return m; + } + }); + } + catch (PrivilegedActionException e) + { + throw (NoSuchMethodException) e.getCause(); + } + } } \ No newline at end of file --===============5765047117856702117==-- From jboss-remoting-commits at lists.jboss.org Tue Apr 14 06:34:30 2009 Content-Type: multipart/mixed; boundary="===============3967383925746370002==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5031 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/http/proxy. Date: Tue, 14 Apr 2009 06:34:25 -0400 Message-ID: <E1LtfyD-00071R-GV@committer01.frg.pub.inap.atl.jboss.com> --===============3967383925746370002== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-14 06:34:23 -0400 (Tue, 14 Apr 2009) New Revision: 5031 Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/http/= proxy/ProxyAuthenticationTestCase.java Log: JBREM-1116: Eliminated dependence on SecurityUtility. Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transpor= t/http/proxy/ProxyAuthenticationTestCase.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/http= /proxy/ProxyAuthenticationTestCase.java 2009-04-14 10:33:39 UTC (rev 5030) +++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/http= /proxy/ProxyAuthenticationTestCase.java 2009-04-14 10:34:23 UTC (rev 5031) @@ -27,6 +27,9 @@ import java.net.InetAddress; import java.net.ServerSocket; import java.net.Socket; +import java.security.AccessController; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; import java.util.HashMap; import java.util.Map; = @@ -119,11 +122,11 @@ setupServer(); = // Set system properties. - SecurityUtility.setSystemProperty("http.proxyHost", server.host); - SecurityUtility.setSystemProperty("http.proxyPort", Integer.toString= (server.port)); - SecurityUtility.setSystemProperty("proxySet", "true"); - SecurityUtility.setSystemProperty("http.proxy.username", "sysprop"); - SecurityUtility.setSystemProperty("http.proxy.password", "abc"); + setSystemProperty("http.proxyHost", server.host); + setSystemProperty("http.proxyPort", Integer.toString(server.port)); + setSystemProperty("proxySet", "true"); + setSystemProperty("http.proxy.username", "sysprop"); + setSystemProperty("http.proxy.password", "abc"); = // Create invocation metadata map. HashMap metadata =3D new HashMap(); @@ -149,8 +152,8 @@ setupServer(); = // Set system properties. - SecurityUtility.setSystemProperty("http.proxy.username", "sysprop"); - SecurityUtility.setSystemProperty("http.proxy.password", "abc"); = + setSystemProperty("http.proxy.username", "sysprop"); + setSystemProperty("http.proxy.password", "abc"); = = // Create invocation metadata map. HashMap metadata =3D new HashMap(); @@ -177,8 +180,8 @@ setupServer(); = // Set system properties. - SecurityUtility.setSystemProperty("http.proxy.username", "sysprop"); - SecurityUtility.setSystemProperty("http.proxy.password", "abc"); = + setSystemProperty("http.proxy.username", "sysprop"); + setSystemProperty("http.proxy.password", "abc"); = = // Create invocation metadata map. HashMap metadata =3D new HashMap(); @@ -305,4 +308,28 @@ return auth; } } + = + static private void setSystemProperty(final String name, final String v= alue) + { + if (SecurityUtility.skipAccessControl()) + { + System.setProperty(name, value); + return; + } + = + try + { + AccessController.doPrivileged( new PrivilegedExceptionAction() + { + public Object run() throws Exception + { + return System.setProperty(name, value); + } + }); + } + catch (PrivilegedActionException e) + { + throw (RuntimeException) e.getCause(); + } + } } \ No newline at end of file --===============3967383925746370002==-- From jboss-remoting-commits at lists.jboss.org Tue Apr 14 13:18:15 2009 Content-Type: multipart/mixed; boundary="===============5211739153465984071==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5032 - in remoting3/trunk: jboss-remoting/src/main/java/org/jboss/remoting3/spi and 2 other directories. Date: Tue, 14 Apr 2009 13:18:15 -0400 Message-ID: <E1LtmH1-0000pZ-JN@committer01.frg.pub.inap.atl.jboss.com> --===============5211739153465984071== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: david.lloyd(a)jboss.com Date: 2009-04-14 13:18:15 -0400 (Tue, 14 Apr 2009) New Revision: 5032 Added: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/ClientC= onnector.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/ClientS= ourceConnector.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Endpoin= tConnector.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Resourc= eType.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Service= LocationListener.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Service= RegistrationListener.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Service= Specification.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Can= cellable.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Con= nectionProvider.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/End= pointConnection.java Removed: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/FutureC= lientSource.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/RemoteS= erviceConfiguration.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Service= Listener.java Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/ClientS= ource.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Endpoin= t.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Endpoin= tImpl.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Handlea= bleCloseable.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Remotin= g.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Request= Listener.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Service= Registration.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Service= URI.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Rem= oteRequestContext.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Req= uestHandler.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Req= uestHandlerSource.java remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/Endpoin= tTestCase.java remoting3/trunk/samples/src/test/java/org/jboss/remoting3/samples/protoc= ol/basic/BasicTestCase.java Log: Endpoint API changes for working connection management, part 1 Added: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Cli= entConnector.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Client= Connector.java (rev 0) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Client= Connector.java 2009-04-14 17:18:15 UTC (rev 5032) @@ -0,0 +1,47 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2009, 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.remoting3; + +import java.net.URI; +import org.jboss.xnio.IoFuture; + +/** + * A client connector. Opens a connection to a URI which provides a singl= e {@code Client} instance. Instances of this + * interface may only be able to support a single URI scheme. Depending o= n the implementation, the URI may be a + * protocol URI or a service URI. + */ +public interface ClientConnector extends HandleableCloseable<ClientConnect= or> { + + /** + * Establish a client connection. + * + * @param requestType the request class + * @param replyType the reply class + * @param connectUri the URI to connect to + * @param <I> the request type + * @param <O> the reply type + * @return the future client + * @throws IllegalArgumentException if the provided URI scheme is not = supported by this connector + */ + <I, O> IoFuture<? extends Client<I, O>> openClient(Class<I> requestTyp= e, Class<O> replyType, URI connectUri) throws IllegalArgumentException; +} Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/= ClientSource.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Client= Source.java 2009-04-14 10:34:23 UTC (rev 5031) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Client= Source.java 2009-04-14 17:18:15 UTC (rev 5032) @@ -22,25 +22,17 @@ = package org.jboss.remoting3; = -import java.io.IOException; - /** - * A source for new Remoting contexts. + * A source for new Remoting clients. * * @param <I> the request type * @param <O> the reply type */ public interface ClientSource<I, O> extends HandleableCloseable<ClientSour= ce<I, O>> { /** - * Close the context source. New contexts may no longer be created af= ter this - * method is called. Subsequent calls to this method have no addition= al effect. - */ - void close() throws IOException; - - /** - * Create a new communications context. + * Create a new client instance. * - * @return the new context + * @return the client */ - Client<I, O> createClient() throws IOException; + Client<I, O> createClient(); } Added: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Cli= entSourceConnector.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Client= SourceConnector.java (rev 0) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Client= SourceConnector.java 2009-04-14 17:18:15 UTC (rev 5032) @@ -0,0 +1,47 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2009, 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.remoting3; + +import java.net.URI; +import org.jboss.xnio.IoFuture; + +/** + * A client source connector. Opens a connection to a URI which provides = a {@code ClientSource} instance. Instances of this + * interface may only be able to support a single URI scheme. Depending o= n the implementation, the URI may be a + * protocol URI or a service URI. + */ +public interface ClientSourceConnector extends HandleableCloseable<ClientS= ourceConnector> { + + /** + * Establish a client source connection. + * + * @param requestType the request class + * @param replyType the reply class + * @param connectUri the URI to connect to + * @param <I> the request type + * @param <O> the reply type + * @return the future client + * @throws IllegalArgumentException if the provided URI scheme is not = supported by this connector + */ + <I, O> IoFuture<? extends ClientSource<I, O>> openClientSource(Class<I= > requestType, Class<O> replyType, URI connectUri) throws IllegalArgumentEx= ception; +} \ No newline at end of file Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/= Endpoint.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Endpoi= nt.java 2009-04-14 10:34:23 UTC (rev 5031) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Endpoi= nt.java 2009-04-14 17:18:15 UTC (rev 5032) @@ -1,11 +1,14 @@ package org.jboss.remoting3; = +import java.io.Closeable; import java.io.IOException; import java.net.URI; +import java.util.Set; import java.util.concurrent.ConcurrentMap; import org.jboss.remoting3.spi.Handle; import org.jboss.remoting3.spi.RequestHandler; import org.jboss.remoting3.spi.RequestHandlerSource; +import org.jboss.remoting3.spi.ConnectionProvider; import org.jboss.xnio.IoFuture; = /** @@ -45,7 +48,7 @@ * @return a handle for the client * @throws IOException if an error occurs */ - <I, O> Handle<RequestHandler> createRequestHandler(RequestListener<I, = O> requestListener, final Class<I> requestClass, final Class<O> replyClass)= throws IOException; + <I, O> Handle<RequestHandler> createLocalRequestHandler(RequestListene= r<I, O> requestListener, final Class<I> requestClass, final Class<O> replyC= lass) throws IOException; = /** * Create a request handler source that can be used to acquire clients= associated with a request listener on this endpoint. @@ -62,6 +65,15 @@ <I, O> Handle<RequestHandlerSource> registerService(LocalServiceConfig= uration<I, O> configuration) throws IOException; = /** + * Add a service registration listener which is called whenever a loca= l service is registered. + * + * @param listener the listener + * @param flags the flags to apply to the listener + * @return a handle which may be used to remove the listener registrat= ion + */ + SimpleCloseable addServiceRegistrationListener(ServiceRegistrationList= ener listener, Set<ListenerFlag> flags); + + /** * Create a client that uses the given request handler to handle its r= equests. * * You must have the {@link org.jboss.remoting3.EndpointPermission cre= ateClient EndpointPermission} to invoke this method. @@ -92,42 +104,63 @@ <I, O> ClientSource<I, O> createClientSource(RequestHandlerSource hand= lerSource, Class<I> requestClass, Class<O> replyClass) throws IOException; = /** - * Attempt to locate a service. The return value then be queried for = the service's {@code ClientSource}. + * Attempt to open a client source by URI. * * @param <I> the request type * @param <O> the reply type - * @param serviceUri the URI of the service + * @param uri the URI of the service * @param requestClass the class of requests sent through the client s= ource * @param replyClass the class of replies received back through the cl= ient source * @return the future service - * @throws IllegalArgumentException if the given URI is not a valid Re= moting service URI + * @throws IllegalArgumentException if the URI scheme does not corresp= ond to a client souerce connection provider */ - <I, O> IoFuture<ClientSource<I, O>> locateService(URI serviceUri, Clas= s<I> requestClass, Class<O> replyClass) throws IllegalArgumentException; + <I, O> IoFuture<? extends ClientSource<I, O>> openClientSource(URI uri= , Class<I> requestClass, Class<O> replyClass) throws IllegalArgumentExcepti= on; = /** - * Register a remotely available service.<p> - * The remote endpoint must not have the same name as this endpoint. = The group name and service type must be - * non-{@code null} and non-empty. The metric must be greater than ze= ro. + * Attempt to open a client by URI. * - * You must have the {@link org.jboss.remoting3.EndpointPermission reg= isterRemoteService EndpointPermission} to invoke this method. + * @param <I> the request type + * @param <O> the reply type + * @param uri the URI of the service + * @param requestClass the class of requests sent through the client s= ource + * @param replyClass the class of replies received back through the cl= ient source + * @return the future service + * @throws IllegalArgumentException if the URI scheme does not corresp= ond to a client connection provider + */ + <I, O> IoFuture<? extends Client<I, O>> openClient(URI uri, Class<I> r= equestClass, Class<O> replyClass) throws IllegalArgumentException; + + /** + * Connect to a remote endpoint. * - * @param configuration the remote service configuration - * @return a closeable that may be used to remove the registration - * @throws IllegalArgumentException if one of the given arguments was = not valid - * @throws IOException if an error occurs with the registration + * @param endpointUri the URI of the endpoint to connect to + * @return the future connection + * @throws IllegalArgumentException if the URI scheme does not corresp= ond to an endpoint connection provider */ - SimpleCloseable registerRemoteService(RemoteServiceConfiguration confi= guration) throws IllegalArgumentException, IOException; + IoFuture<? extends Closeable> openEndpointConnection(URI endpointUri) = throws IllegalArgumentException; = /** - * Add a listener for observing when local and remote services are add= ed. The caller may specify whether the listener - * should be notified of the complete list of currently registered ser= vices (set {@code onlyNew} to {@code false}) - * or only services registered after the time of calling this method (= set {@code onlyNew} to {@code true}). + * Register a connection provider for a URI scheme. * - * You must have the {@link org.jboss.remoting3.EndpointPermission add= ServiceListener EndpointPermission} to invoke this method. + * @param uriScheme the URI scheme + * @param provider the provider + * @return a handle which may be used to remove the registration + */ + SimpleCloseable addConnectionProvider(String uriScheme, ConnectionProv= ider<?> provider); + + /** + * Get the type of resource specified by the given URI. If the type c= annot be determined, returns {@link org.jboss.remoting3.ResourceType#UNKNOW= N UNKNOWN}. * - * @param serviceListener the listener - * @param onlyNew {@code true} if only new registrations should be sen= t to the listener - * @return a handle which may be used to unregister the listener + * @param uri the connection URI + * @return the resource type */ - SimpleCloseable addServiceListener(ServiceListener serviceListener, bo= olean onlyNew); + ResourceType getResourceType(URI uri); + + + enum ListenerFlag { + + /** + * Include old registrations. + */ + INCLUDE_OLD, + } } Added: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/End= pointConnector.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Endpoi= ntConnector.java (rev 0) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Endpoi= ntConnector.java 2009-04-14 17:18:15 UTC (rev 5032) @@ -0,0 +1,42 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2009, 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.remoting3; + +import java.net.URI; +import org.jboss.xnio.IoFuture; + +/** + * An endpoint connector. Used to connect a whole endpoint to another who= le endpoint. Typically, services are then + * shared between the endpoints in some fashion, though this need not be t= he case. + */ +public interface EndpointConnector extends HandleableCloseable<EndpointCon= nector> { + + /** + * Connect the given endpoint to the remote URI. + * + * @param endpoint the endpoint to connect + * @param connectUri the connection URI + * @return the future handle, which may be used to terminate the conne= ction + */ + IoFuture<? extends HandleableCloseable> connect(Endpoint endpoint, URI= connectUri); +} Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/= EndpointImpl.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Endpoi= ntImpl.java 2009-04-14 10:34:23 UTC (rev 5031) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Endpoi= ntImpl.java 2009-04-14 17:18:15 UTC (rev 5032) @@ -27,24 +27,31 @@ import java.lang.ref.WeakReference; import java.net.URI; import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; import java.util.HashMap; import java.util.HashSet; -import java.util.List; import java.util.Map; +import java.util.Queue; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.Executor; +import java.util.concurrent.locks.Lock; +import java.util.concurrent.locks.ReentrantLock; import org.jboss.remoting3.spi.AbstractHandleableCloseable; import org.jboss.remoting3.spi.AbstractSimpleCloseable; +import org.jboss.remoting3.spi.ConnectionProvider; import org.jboss.remoting3.spi.Handle; import org.jboss.remoting3.spi.RequestHandler; import org.jboss.remoting3.spi.RequestHandlerSource; -import org.jboss.xnio.FailedIoFuture; -import org.jboss.xnio.FinishedIoFuture; +import org.jboss.remoting3.spi.Cancellable; +import org.jboss.remoting3.spi.EndpointConnection; import org.jboss.xnio.IoFuture; import org.jboss.xnio.IoUtils; import org.jboss.xnio.WeakCloseable; +import org.jboss.xnio.AbstractIoFuture; import org.jboss.xnio.log.Logger; = /** @@ -57,6 +64,10 @@ Logger.getLogger("org.jboss.remoting").info("JBoss Remoting versio= n %s", Version.VERSION); } = + static <K, V> ConcurrentMap<K, V> concurrentHashMap() { + return new ConcurrentHashMap<K, V>(); + } + static <K, V> Map<K, V> hashMap() { return new HashMap<K, V>(); } @@ -65,23 +76,38 @@ return new HashSet<T>(); } = + static <T> Queue<T> concurrentLinkedQueue() { + return new ConcurrentLinkedQueue<T>(); + } + private static final Logger log =3D Logger.getLogger("org.jboss.remoti= ng.endpoint"); = private final String name; = - private final ConcurrentMap<Object, Object> endpointMap =3D new Concur= rentHashMap<Object, Object>(); + /** + * Snapshot lock. Hold this lock while reading or updating {@link #se= rviceListenerRegistrations} or while updating + * {@link #registeredLocalServices}. Allows atomic snapshot of existi= ng service registrations and listener add. + */ + private final Lock serviceRegistrationLock =3D new ReentrantLock(); = - private final Object serviceLock =3D new Object(); - private final Map<Object, ServiceListenerRegistration> serviceListener= Map =3D hashMap(); - private final Set<ServiceRegistration> serviceRegistrations =3D hashSe= t(); + /** + * = + */ + private final Queue<Registration<ServiceRegistrationListener>> service= ListenerRegistrations =3D concurrentLinkedQueue(); = + private final ConcurrentMap<String, ServiceRegistration> registeredLoc= alServices =3D concurrentHashMap(); + + private final ConcurrentMap<String, ConnectionProvider<?>> connectionP= roviders =3D concurrentHashMap(); + + private final ConcurrentMap<Object, Object> endpointMap =3D concurrent= HashMap(); + private static final EndpointPermission CREATE_ENDPOINT_PERM =3D new E= ndpointPermission("createEndpoint"); private static final EndpointPermission CREATE_REQUEST_HANDLER_PERM = =3D new EndpointPermission("createRequestHandler"); private static final EndpointPermission REGISTER_SERVICE_PERM =3D new = EndpointPermission("registerService"); private static final EndpointPermission CREATE_CLIENT_PERM =3D new End= pointPermission("createClient"); private static final EndpointPermission CREATE_CLIENT_SOURCE_PERM =3D = new EndpointPermission("createClientSource"); - private static final EndpointPermission REGISTER_REMOTE_SERVICE_PERM = =3D new EndpointPermission("registerRemoteService"); private static final EndpointPermission ADD_SERVICE_LISTENER_PERM =3D = new EndpointPermission("addServiceListener"); + private static final EndpointPermission ADD_CONNECTION_PROVIDER_PERM = =3D new EndpointPermission("addConnectionProvider"); = public EndpointImpl(final Executor executor, final String name) { super(executor); @@ -89,6 +115,7 @@ if (sm !=3D null) { sm.checkPermission(CREATE_ENDPOINT_PERM); } + connectionProviders.put("jrs", new JrsConnectionProvider()); this.executor =3D executor; this.name =3D name; } @@ -113,7 +140,7 @@ return endpointMap; } = - public <I, O> Handle<RequestHandler> createRequestHandler(final Reques= tListener<I, O> requestListener, final Class<I> requestClass, final Class<O= > replyClass) throws IOException { + public <I, O> Handle<RequestHandler> createLocalRequestHandler(final R= equestListener<I, O> requestListener, final Class<I> requestClass, final Cl= ass<O> replyClass) throws IOException { SecurityManager sm =3D System.getSecurityManager(); if (sm !=3D null) { sm.checkPermission(CREATE_REQUEST_HANDLER_PERM); @@ -146,21 +173,12 @@ final String serviceType =3D configuration.getServiceType(); final String groupName =3D configuration.getGroupName(); final int metric =3D configuration.getMetric(); - if (serviceType =3D=3D null) { - throw new NullPointerException("serviceType is null"); - } - if (groupName =3D=3D null) { - throw new NullPointerException("groupName is null"); - } - if (serviceType.length() =3D=3D 0) { - throw new IllegalArgumentException("serviceType is empty"); - } - if (groupName.length() =3D=3D 0) { - throw new IllegalArgumentException("groupName is empty"); - } if (metric < 0) { throw new IllegalArgumentException("metric must be greater tha= n or equal to zero"); } + ServiceURI.validateServiceType(serviceType); + ServiceURI.validateGroupName(groupName); + final String serviceKey =3D serviceType.toLowerCase() + ":" + grou= pName.toLowerCase(); final LocalRequestHandlerSource.Config<I, O> config =3D new LocalR= equestHandlerSource.Config<I,O>(configuration.getRequestClass(), configurat= ion.getReplyClass()); config.setRequestListener(configuration.getRequestListener()); config.setExecutor(executor); @@ -168,32 +186,21 @@ final ServiceRegistration registration =3D new ServiceRegistration= (serviceType, groupName, name, localRequestHandlerSource); final AbstractSimpleCloseable newHandle =3D new AbstractSimpleClos= eable(executor) { protected void closeAction() throws IOException { - synchronized (serviceLock) { - serviceRegistrations.remove(registration); - } + // todo fix + registeredLocalServices.remove(serviceKey); } }; registration.setHandle(newHandle); - synchronized (serviceLock) { - serviceRegistrations.add(registration); - for (final ServiceListenerRegistration slr : serviceListenerMa= p.values()) { - final ServiceListener listener =3D slr.getServiceListener(= ); - try { - final ServiceListener.ServiceInfo serviceInfo =3D new = ServiceListener.ServiceInfo(); - serviceInfo.setEndpointName(name); - serviceInfo.setGroupName(groupName); - serviceInfo.setServiceType(serviceType); - serviceInfo.setMetric(metric); - serviceInfo.setRegistrationHandle(newHandle); - serviceInfo.setRemote(false); - serviceInfo.setRequestHandlerSource(localRequestHandle= rSource); - listener.serviceRegistered(slr.handle, serviceInfo); - } catch (Throwable t) { - logListenerError(t); - } + final Lock lock =3D serviceRegistrationLock; + lock.lock(); + try { + if (registeredLocalServices.putIfAbsent(serviceKey, registrati= on) !=3D null) { + throw new ServiceRegistrationException("Registration of se= rvice of type \"" + serviceType + "\" in group \"" + groupName + "\" duplic= ates an already-registered service's specification"); } + } finally { + lock.unlock(); } - final WeakCloseable lrhCloseable =3D new WeakCloseable(new WeakRef= erence<Closeable>(localRequestHandlerSource)); + final WeakCloseable lrhCloseable =3D new WeakCloseable(localReques= tHandlerSource); final Key key =3D addCloseHandler(new CloseHandler<Endpoint>() { public void handleClose(final Endpoint closed) { IoUtils.safeClose(lrhCloseable); @@ -205,6 +212,23 @@ } }); localRequestHandlerSource.open(); + for (Registration<ServiceRegistrationListener> slr : serviceListen= erRegistrations) { + final ServiceRegistrationListener registrationListener =3D slr= .getResource(); + try { + final ServiceRegistrationListener.ServiceInfo serviceInfo = =3D new ServiceRegistrationListener.ServiceInfo(); + serviceInfo.setGroupName(groupName); + serviceInfo.setServiceType(serviceType); + serviceInfo.setMetric(metric); + serviceInfo.setRegistrationHandle(newHandle); + serviceInfo.setRequestHandlerSource(localRequestHandlerSou= rce); + registrationListener.serviceRegistered(slr, serviceInfo); + } catch (VirtualMachineError vme) { + // panic! + throw vme; + } catch (Throwable t) { + logListenerError(t); + } + } return localRequestHandlerSource.getHandle(); } = @@ -270,204 +294,231 @@ } } = - public <I, O> IoFuture<ClientSource<I, O>> locateService(final URI ser= viceUri, final Class<I> requestClass, final Class<O> replyClass) throws Ill= egalArgumentException { - if (serviceUri =3D=3D null) { - throw new NullPointerException("serviceUri is null"); + public <I, O> IoFuture<ClientSource<I, O>> openClientSource(final URI = uri, final Class<I> requestClass, final Class<O> replyClass) throws Illegal= ArgumentException { + final ConnectionProvider<RequestHandlerSource> cp =3D getConnectio= nProvider(uri); + if (cp.getResourceType() !=3D ResourceType.CLIENT_SOURCE) { + throw new IllegalArgumentException("URI can not be used to ope= n a client source"); } - if (! ServiceURI.isRemotingServiceUri(serviceUri)) { - throw new IllegalArgumentException("Not a valid remoting servi= ce URI"); + final FutureResult<ClientSource<I, O>> futureClientSource =3D new = FutureResult<ClientSource<I, O>>(); + cp.connect(uri, new ConnectionProvider.Result<RequestHandlerSource= >() { + public void setResult(final RequestHandlerSource result) { + final ClientSource<I, O> clientSource; + try { + clientSource =3D createClientSource(result, requestCla= ss, replyClass); + } catch (IOException e) { + IoUtils.safeClose(result); + futureClientSource.setException(e); + return; + } + futureClientSource.setResult(clientSource); + } + + public void setException(final IOException exception) { + futureClientSource.setException(exception); + } + + public void setCancelled() { + futureClientSource.finishCancel(); + } + }); + return futureClientSource; + } + + public <I, O> IoFuture<? extends Client<I, O>> openClient(final URI ur= i, final Class<I> requestClass, final Class<O> replyClass) throws IllegalAr= gumentException { + final ConnectionProvider<RequestHandler> cp =3D getConnectionProvi= der(uri); + if (cp.getResourceType() !=3D ResourceType.CLIENT) { + throw new IllegalArgumentException("URI can not be used to ope= n a client"); } - final String endpointName =3D ServiceURI.getEndpointName(serviceUr= i); - final String groupName =3D ServiceURI.getGroupName(serviceUri); - final String serviceType =3D ServiceURI.getServiceType(serviceUri); - synchronized (serviceLock) { - int bestMetric =3D Integer.MAX_VALUE; - List<ServiceRegistration> candidates =3D new ArrayList<Service= Registration>(); - for (ServiceRegistration svc : serviceRegistrations) { - if (svc.matches(serviceType, groupName, endpointName)) { - final int metric =3D svc.getMetric(); - if (metric < bestMetric) { - candidates.clear(); - candidates.add(svc); - } else if (metric =3D=3D bestMetric) { - candidates.add(svc); - } + final FutureResult<Client<I, O>> futureClient =3D new FutureResult= <Client<I, O>>(); + cp.connect(uri, new ConnectionProvider.Result<RequestHandler>() { + public void setResult(final RequestHandler result) { + final Client<I, O> client; + try { + client =3D createClient(result, requestClass, replyCla= ss); + } catch (IOException e) { + IoUtils.safeClose(result); + futureClient.setException(e); + return; } + futureClient.setResult(client); } - final int size =3D candidates.size(); - if (size =3D=3D 0) { - final FutureClientSource<I, O> futureClientSource =3D new = FutureClientSource<I, O>(); - final SimpleCloseable listenerHandle =3D addServiceListene= r(new ServiceListener() { - public void serviceRegistered(final SimpleCloseable li= stenerHandle, final ServiceInfo info) { - final String addedEndpointName =3D info.getEndpoin= tName(); - final String addedServiceType =3D info.getServiceT= ype(); - final String addedGroupName =3D info.getGroupName(= ); - final RequestHandlerSource requestHandlerSource = =3D info.getRequestHandlerSource(); - if (endpointName !=3D null && endpointName.length(= ) > 0 && !endpointName.equals(addedEndpointName)) { - // no match - return; - } - if (serviceType !=3D null && serviceType.length() = > 0 && !serviceType.equals(addedServiceType)) { - // no match - return; - } - if (groupName !=3D null && groupName.length() > 0 = && !groupName.equals(addedGroupName)) { - // no match - return; - } - try { - // match! - final ClientSource<I, O> clientSource =3D crea= teClientSource(requestHandlerSource, requestClass, replyClass); - futureClientSource.setResult(clientSource); - } catch (IOException e) { - futureClientSource.setException(e); - } finally { - IoUtils.safeClose(listenerHandle); - } + + public void setException(final IOException exception) { + futureClient.setException(exception); + } + + public void setCancelled() { + futureClient.finishCancel(); + } + }); + return futureClient; + } + + public IoFuture<? extends Closeable> openEndpointConnection(final URI = endpointUri) throws IllegalArgumentException { + final ConnectionProvider<EndpointConnection> cp =3D getConnectionP= rovider(endpointUri); + if (cp.getResourceType() !=3D ResourceType.CLIENT) { + throw new IllegalArgumentException("URI can not be used to ope= n an endpoint connection"); + } + final FutureResult<SimpleCloseable> futureEndpointConn =3D new Fut= ureResult<SimpleCloseable>(); + cp.connect(endpointUri, new ConnectionProvider.Result<EndpointConn= ection>() { + public void setResult(final EndpointConnection result) { + if (futureEndpointConn.setResult(new AbstractSimpleCloseab= le(executor) { + protected void closeAction() throws IOException { + result.close(); } - }, true); - futureClientSource.setListenerHandle(listenerHandle); - return futureClientSource; + })) { + // todo - add the endpoint connection to the endpoint = registry; notify listeners; etc. + } } - final RequestHandlerSource handlerSource; - if (size =3D=3D 1) { - handlerSource =3D candidates.get(0).getHandlerSource(); - } else { - int idx =3D (int) ((double) candidates.size() * Math.rando= m()); - handlerSource =3D candidates.get(idx).getHandlerSource(); + + public void setException(final IOException exception) { + futureEndpointConn.setException(exception); } - try { - return new FinishedIoFuture<ClientSource<I,O>>(createClien= tSource(handlerSource, requestClass, replyClass)); - } catch (IOException e) { - return new FailedIoFuture<ClientSource<I,O>>(e); + + public void setCancelled() { + futureEndpointConn.finishCancel(); } - } + }); + return futureEndpointConn; } = - public SimpleCloseable registerRemoteService(final RemoteServiceConfig= uration configuration) throws IllegalArgumentException, IOException { - SecurityManager sm =3D System.getSecurityManager(); + public SimpleCloseable addConnectionProvider(final String uriScheme, f= inal ConnectionProvider<?> provider) { + final SecurityManager sm =3D System.getSecurityManager(); if (sm !=3D null) { - sm.checkPermission(REGISTER_REMOTE_SERVICE_PERM); + sm.checkPermission(ADD_CONNECTION_PROVIDER_PERM); } - final RequestHandlerSource handlerSource =3D configuration.getRequ= estHandlerSource(); - final String serviceType =3D configuration.getServiceType(); - final String groupName =3D configuration.getGroupName(); - final String endpointName =3D configuration.getEndpointName(); - final int metric =3D configuration.getMetric(); - if (handlerSource =3D=3D null) { - throw new NullPointerException("handlerSource is null"); + final String key =3D uriScheme.toLowerCase(); + if (connectionProviders.putIfAbsent(key, provider) !=3D null) { + throw new IllegalArgumentException("Provider already registere= d for scheme \"" + uriScheme + "\""); } - if (serviceType =3D=3D null) { - throw new NullPointerException("serviceType is null"); + return new AbstractSimpleCloseable(executor) { + protected void closeAction() throws IOException { + connectionProviders.remove(key, provider); + } + }; + } + + public ResourceType getResourceType(final URI uri) { + final String scheme =3D uri.getScheme().toLowerCase(); + final ConnectionProvider<?> provider =3D connectionProviders.get(s= cheme); + return provider !=3D null ? provider.getResourceType() : ResourceT= ype.UNKNOWN; + } + + @SuppressWarnings({ "unchecked" }) + private <T> ConnectionProvider<T> getConnectionProvider(final URI uri)= { + if (uri =3D=3D null) { + throw new NullPointerException("serviceUri is null"); } - if (groupName =3D=3D null) { - throw new NullPointerException("groupName is null"); + final String scheme =3D uri.getScheme(); + // this cast is checked later, indirectly + final ConnectionProvider<T> cp =3D (ConnectionProvider<T>) connect= ionProviders.get(scheme); + if (cp =3D=3D null) { + throw new IllegalArgumentException("No connection providers av= ailable for URI scheme \"" + scheme + "\""); } - if (endpointName =3D=3D null) { - throw new NullPointerException("endpointName is null"); + if (! ServiceURI.isRemotingServiceUri(uri)) { + throw new IllegalArgumentException("Not a valid remoting servi= ce URI"); } - if (serviceType.length() =3D=3D 0) { - throw new IllegalArgumentException("serviceType is empty"); + return cp; + } + + public SimpleCloseable addServiceRegistrationListener(final ServiceReg= istrationListener listener, final Set<ListenerFlag> flags) { + final SecurityManager sm =3D System.getSecurityManager(); + if (sm !=3D null) { + sm.checkPermission(ADD_SERVICE_LISTENER_PERM); } - if (groupName.length() =3D=3D 0) { - throw new IllegalArgumentException("groupName is empty"); + final Registration<ServiceRegistrationListener> registration =3D n= ew Registration<ServiceRegistrationListener>(executor, listener, serviceLis= tenerRegistrations); + final Lock lock =3D serviceRegistrationLock; + final Collection<ServiceRegistration> services; + lock.lock(); + try { + if (flags =3D=3D null || ! flags.contains(ListenerFlag.INCLUDE= _OLD)) { + services =3D new ArrayList<ServiceRegistration>(registered= LocalServices.values()); + } else { + services =3D Collections.emptySet(); + } + } finally { + lock.unlock(); } - if (endpointName.length() =3D=3D 0) { - throw new IllegalArgumentException("endpointName is empty"); + serviceListenerRegistrations.add(registration); + for (ServiceRegistration service : services) { + final ServiceRegistrationListener.ServiceInfo serviceInfo =3D = new ServiceRegistrationListener.ServiceInfo(); + serviceInfo.setGroupName(service.getGroupName()); + serviceInfo.setMetric(service.getMetric()); + serviceInfo.setRegistrationHandle(service.getHandle()); + serviceInfo.setRequestHandlerSource(service.getHandlerSource()= ); + serviceInfo.setServiceType(service.getServiceType()); + listener.serviceRegistered(registration, serviceInfo); + if (! registration.isOpen()) { + break; + } } - if (endpointName.equals(name)) { - throw new IllegalArgumentException("remote endpoint has the sa= me name as the local endpoint"); + return registration; + } + + private static final class Registration<T> extends AbstractSimpleClose= able { + private final T resource; + private final Queue<Registration<T>> resourceQueue; + + private Registration(final Executor executor, final T resource, fi= nal Queue<Registration<T>> resourceQueue) { + super(executor); + this.resource =3D resource; + this.resourceQueue =3D resourceQueue; } - if (metric < 1) { - throw new IllegalArgumentException("metric must be greater tha= n zero"); + + protected void closeAction() throws IOException { + resourceQueue.remove(this); } - final ServiceRegistration registration =3D new ServiceRegistration= (serviceType, groupName, endpointName, metric, handlerSource); - final AbstractSimpleCloseable newHandle =3D new AbstractSimpleClos= eable(executor) { - protected void closeAction() throws IOException { - synchronized (serviceLock) { - serviceRegistrations.remove(registration); - } - } - }; - registration.setHandle(newHandle); - synchronized (serviceLock) { - serviceRegistrations.add(registration); - for (final ServiceListenerRegistration slr : serviceListenerMa= p.values()) { - final ServiceListener listener =3D slr.getServiceListener(= ); - try { - final ServiceListener.ServiceInfo info =3D new Service= Listener.ServiceInfo(); - info.setEndpointName(endpointName); - info.setGroupName(groupName); - info.setMetric(metric); - info.setRegistrationHandle(newHandle); - info.setRemote(true); - info.setRequestHandlerSource(handlerSource); - info.setServiceType(serviceType); - listener.serviceRegistered(slr.handle, info); - } catch (Throwable t) { - logListenerError(t); - } - } + + protected boolean isOpen() { + return super.isOpen(); } - return newHandle; + + T getResource() { + return resource; + } } = - public SimpleCloseable addServiceListener(final ServiceListener servic= eListener, final boolean onlyNew) { - SecurityManager sm =3D System.getSecurityManager(); - if (sm !=3D null) { - sm.checkPermission(ADD_SERVICE_LISTENER_PERM); - } - final Object key =3D new Object(); - synchronized (serviceLock) { - final ServiceListenerRegistration registration =3D new Service= ListenerRegistration(serviceListener); - serviceListenerMap.put(key, registration); - final AbstractSimpleCloseable handle =3D new AbstractSimpleClo= seable(executor) { - protected void closeAction() throws IOException { - synchronized (serviceLock) { - serviceListenerMap.remove(key); - } + public String toString() { + return "endpoint \"" + name + "\" <" + Integer.toHexString(hashCod= e()) + ">"; + } + + final class JrsConnectionProvider implements ConnectionProvider<Reques= tHandlerSource> { + + public Cancellable connect(final URI uri, final Result<RequestHand= lerSource> requestHandlerSourceResult) throws IllegalArgumentException { + final ServiceSpecification spec =3D ServiceSpecification.fromU= ri(uri); + for (ServiceRegistration sr : registeredLocalServices.values()= ) { + if (sr.matches(spec)) { + requestHandlerSourceResult.setResult(sr.getHandlerSour= ce()); } - }; - registration.setHandle(handle); - if (! onlyNew) { - for (final ServiceRegistration reg : serviceRegistrations)= { - try { - final ServiceListener.ServiceInfo info =3D new Ser= viceListener.ServiceInfo(); - info.setEndpointName(reg.getEndpointName()); - info.setGroupName(reg.getGroupName()); - info.setMetric(reg.getMetric()); - info.setRegistrationHandle(reg.getHandle()); - info.setRemote(reg.isRemote()); - info.setRequestHandlerSource(reg.getHandlerSource(= )); - info.setServiceType(reg.getServiceType()); - serviceListener.serviceRegistered(handle, info); - } catch (Throwable t) { - logListenerError(t); - } - } } - return handle; + // todo - iterate through discovered services as well + return Cancellable.NULL_CANCELLABLE; } + + public URI getConnectionUri(final URI uri) { + return uri; + } + + public ResourceType getResourceType() { + return ResourceType.CLIENT_SOURCE; + } } = - private static final class ServiceListenerRegistration { - private final ServiceListener serviceListener; - private volatile SimpleCloseable handle; + /** + * + */ + static final class FutureResult<T> extends AbstractIoFuture<T> { = - private ServiceListenerRegistration(final ServiceListener serviceL= istener) { - this.serviceListener =3D serviceListener; + protected boolean setException(final IOException exception) { + return super.setException(exception); } = - ServiceListener getServiceListener() { - return serviceListener; + protected boolean setResult(final T result) { + return super.setResult(result); } = - void setHandle(final SimpleCloseable handle) { - this.handle =3D handle; + protected boolean finishCancel() { + return super.finishCancel(); } } - - public String toString() { - return "endpoint \"" + name + "\" <" + Integer.toString(hashCode()= ) + ">"; - } } Deleted: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/F= utureClientSource.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Future= ClientSource.java 2009-04-14 10:34:23 UTC (rev 5031) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Future= ClientSource.java 2009-04-14 17:18:15 UTC (rev 5032) @@ -1,53 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2008, 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.remoting3; - -import java.io.IOException; -import org.jboss.xnio.AbstractIoFuture; -import org.jboss.xnio.IoFuture; -import org.jboss.xnio.IoUtils; - -/** - * - */ -final class FutureClientSource<I, O> extends AbstractIoFuture<ClientSource= <I, O>> { - - private volatile SimpleCloseable listenerHandle; - - protected boolean setException(final IOException exception) { - return super.setException(exception); - } - - protected boolean setResult(final ClientSource<I, O> result) { - return super.setResult(result); - } - - public IoFuture<ClientSource<I, O>> cancel() { - IoUtils.safeClose(listenerHandle); - return this; - } - - void setListenerHandle(final SimpleCloseable listenerHandle) { - this.listenerHandle =3D listenerHandle; - } -} Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/= HandleableCloseable.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Handle= ableCloseable.java 2009-04-14 10:34:23 UTC (rev 5031) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Handle= ableCloseable.java 2009-04-14 17:18:15 UTC (rev 5032) @@ -35,15 +35,16 @@ public interface HandleableCloseable<T> extends Closeable { = /** - * Close, waiting for any outstanding processing to finish. + * Close this resource. Call any registered close handlers. Calling = this method more than once will not have + * any additional effect. * * @throws IOException if the close failed */ void close() throws IOException; = /** - * Add a handler that will be called upon close. The handler may be c= alled before or after the close acutally - * takes place. + * Add a handler that will be called upon close. If the resource is a= lready closed, the handler will be called + * immediately. * * @param handler the close handler * @return a key which may be used to later remove this handler Deleted: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/R= emoteServiceConfiguration.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Remote= ServiceConfiguration.java 2009-04-14 10:34:23 UTC (rev 5031) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Remote= ServiceConfiguration.java 2009-04-14 17:18:15 UTC (rev 5032) @@ -1,134 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2008, 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.remoting3; - -import org.jboss.remoting3.spi.RequestHandlerSource; - -/** - * A configuration for registering a remote service with an endpoint. - * - * @apiviz.exclude - */ -public final class RemoteServiceConfiguration { - private String serviceType; - private String groupName; - private String endpointName; - private RequestHandlerSource requestHandlerSource; - private int metric; - - /** - * Construct a new instance. - */ - public RemoteServiceConfiguration() { - } - - /** - * Get the service type. - * - * @return the service type - */ - public String getServiceType() { - return serviceType; - } - - /** - * Set the service type. - * - * @param serviceType the service type - */ - public void setServiceType(final String serviceType) { - this.serviceType =3D serviceType; - } - - /** - * Get the service group name. - * - * @return the group name - */ - public String getGroupName() { - return groupName; - } - - /** - * Set the service group name. - * - * @param groupName the group name - */ - public void setGroupName(final String groupName) { - this.groupName =3D groupName; - } - - /** - * Get the remote endpoint name. - * - * @return the remote endpoint name - */ - public String getEndpointName() { - return endpointName; - } - - /** - * Set the remote endpoint name. - * - * @param endpointName the remote endpoint name - */ - public void setEndpointName(final String endpointName) { - this.endpointName =3D endpointName; - } - - /** - * Get the request handler source of the remote service. - * - * @return the request handler source - */ - public RequestHandlerSource getRequestHandlerSource() { - return requestHandlerSource; - } - - /** - * Set the request handler source of the remote service. - * - * @param requestHandlerSource the request handler source - */ - public void setRequestHandlerSource(final RequestHandlerSource request= HandlerSource) { - this.requestHandlerSource =3D requestHandlerSource; - } - - /** - * Get the metric of the remote service. - * - * @return the metric - */ - public int getMetric() { - return metric; - } - - /** - * Set the metric of the remote service. - * - * @param metric the metric - */ - public void setMetric(final int metric) { - this.metric =3D metric; - } -} Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/= Remoting.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Remoti= ng.java 2009-04-14 10:34:23 UTC (rev 5031) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Remoti= ng.java 2009-04-14 17:18:15 UTC (rev 5032) @@ -126,7 +126,7 @@ * @throws IOException if an error occurs */ public static <I, O> Client<I, O> createLocalClient(final Endpoint end= point, final RequestListener<I, O> requestListener, final Class<I> requestC= lass, final Class<O> replyClass) throws IOException { - final Handle<RequestHandler> handle =3D endpoint.createRequestHand= ler(requestListener, requestClass, replyClass); + final Handle<RequestHandler> handle =3D endpoint.createLocalReques= tHandler(requestListener, requestClass, replyClass); try { return endpoint.createClient(handle.getResource(), requestClas= s, replyClass); } finally { Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/= RequestListener.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Reques= tListener.java 2009-04-14 10:34:23 UTC (rev 5031) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Reques= tListener.java 2009-04-14 17:18:15 UTC (rev 5032) @@ -49,8 +49,7 @@ * Handle a request. If this method throws {@code RemoteExecutionExce= ption}, then that exception is passed * back to the caller and the request is marked as complete. Otherwis= e, the request * listener must send back either a reply (using the {@code sendReply(= )} method on the {@code RequestContext}) or - * an exception (using the {@code sendException()} method on the {@cod= e RequestContext}). Failure to do so may - * cause the client to hang indefinitely. + * an exception (using the {@code sendException()} method on the {@cod= e RequestContext}). * * @param context the context on which a reply may be sent * @param request the received request Added: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Res= ourceType.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Resour= ceType.java (rev 0) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Resour= ceType.java 2009-04-14 17:18:15 UTC (rev 5032) @@ -0,0 +1,33 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2009, 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.remoting3; + +/** + * + */ +public enum ResourceType { + UNKNOWN, + CLIENT, + CLIENT_SOURCE, + ENDPOINT, +} Deleted: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/S= erviceListener.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Servic= eListener.java 2009-04-14 10:34:23 UTC (rev 5031) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Servic= eListener.java 2009-04-14 17:18:15 UTC (rev 5032) @@ -1,188 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2008, 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.remoting3; - -import org.jboss.remoting3.spi.RequestHandlerSource; - -/** - * A listener for watching service registrations on an endpoint. - * - * @apiviz.landmark - */ -public interface ServiceListener { - - /** - * Receive notification that a service was registered. - * - * @param listenerHandle the handle to this listener - * @param info the servce information - */ - void serviceRegistered(SimpleCloseable listenerHandle, ServiceInfo inf= o); - - /** - * Information about a registered service. - * - * @apiviz.exclude - */ - final class ServiceInfo { - private String endpointName; - private String serviceType; - private String groupName; - private boolean remote; - private int metric; - private RequestHandlerSource requestHandlerSource; - private SimpleCloseable registrationHandle; - - /** - * Construct a new instance. - */ - public ServiceInfo() { - } - - /** - * Get the service type. - * - * @return the service type - */ - public String getServiceType() { - return serviceType; - } - - /** - * Set the service type. - * - * @param serviceType the service type - */ - public void setServiceType(final String serviceType) { - this.serviceType =3D serviceType; - } - - /** - * Get the group name. - * - * @return the group name - */ - public String getGroupName() { - return groupName; - } - - /** - * Set the group name. - * - * @param groupName the group name - */ - public void setGroupName(final String groupName) { - this.groupName =3D groupName; - } - - /** - * Get the metric. - * - * @return the metric - */ - public int getMetric() { - return metric; - } - - /** - * Set the metric. - * - * @param metric the metric - */ - public void setMetric(final int metric) { - this.metric =3D metric; - } - - /** - * Get the request handler source. - * - * @return the request handler source - */ - public RequestHandlerSource getRequestHandlerSource() { - return requestHandlerSource; - } - - /** - * Set the request handler source. - * - * @param requestHandlerSource the request handler source - */ - public void setRequestHandlerSource(final RequestHandlerSource req= uestHandlerSource) { - this.requestHandlerSource =3D requestHandlerSource; - } - - /** - * Get the registration handle. Closing this handle will remove t= he registration. - * - * @return the registration handle - */ - public SimpleCloseable getRegistrationHandle() { - return registrationHandle; - } - - /** - * Set the registration handle. - * - * @param registrationHandle the registration handle - */ - public void setRegistrationHandle(final SimpleCloseable registrati= onHandle) { - this.registrationHandle =3D registrationHandle; - } - - /** - * Get the endpoint name. For local services, this will be the na= me of the local endpoint. - * - * @return the endpoint name - */ - public String getEndpointName() { - return endpointName; - } - - /** - * Set the endpoint name. - * - * @param endpointName the endpoint name - */ - public void setEndpointName(final String endpointName) { - this.endpointName =3D endpointName; - } - - /** - * Determine whether this service is remote. - * - * @return {@code true} if this service is remote - */ - public boolean isRemote() { - return remote; - } - - /** - * Specify whether this service is remote. - * - * @param remote {@code true} if this service is remote - */ - public void setRemote(final boolean remote) { - this.remote =3D remote; - } - } -} Added: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Ser= viceLocationListener.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Servic= eLocationListener.java (rev 0) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Servic= eLocationListener.java 2009-04-14 17:18:15 UTC (rev 5032) @@ -0,0 +1,64 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2009, 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.remoting3; + +import java.net.URI; + +/** + * A listener for watching service location events on an endpoint. + * + * @apiviz.landmark + */ +public interface ServiceLocationListener { + void serviceLocated(SimpleCloseable listenerHandler, ServiceInfo info); + + final class ServiceInfo { + private URI serviceUri; + private URI locationUri; + private int preference; + + public URI getServiceUri() { + return serviceUri; + } + + public void setServiceUri(final URI serviceUri) { + this.serviceUri =3D serviceUri; + } + + public URI getLocationUri() { + return locationUri; + } + + public void setLocationUri(final URI locationUri) { + this.locationUri =3D locationUri; + } + + public int getPreference() { + return preference; + } + + public void setPreference(final int preference) { + this.preference =3D preference; + } + } +} Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/= ServiceRegistration.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Servic= eRegistration.java 2009-04-14 10:34:23 UTC (rev 5031) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Servic= eRegistration.java 2009-04-14 17:18:15 UTC (rev 5032) @@ -55,11 +55,18 @@ } = public boolean matches(final String serviceType, final String groupNam= e, final String endpointName) { - return (serviceType =3D=3D null || serviceType.length() =3D=3D 0 = || serviceType.equals(this.serviceType)) && - (groupName =3D=3D null || groupName.length() =3D=3D 0 || g= roupName.equals(this.groupName)) && - (endpointName =3D=3D null || endpointName.length() =3D=3D = 0 || endpointName.equals(this.endpointName)); + return (serviceType =3D=3D null || serviceType.length() =3D=3D 0 = || "*".equals(serviceType) || serviceType.equals(this.serviceType)) && + (groupName =3D=3D null || groupName.length() =3D=3D 0 || "= *".equals(groupName) || groupName.equals(this.groupName)) && + (endpointName =3D=3D null || endpointName.length() =3D=3D = 0 || "*".equals(endpointName) || endpointName.equals(this.endpointName)); } = + public boolean matches(final ServiceSpecification spec) { + final String serviceType =3D spec.getServiceType(); + final String groupName =3D spec.getGroupName(); + final String endpointName =3D spec.getEndpointName(); + return matches(serviceType, groupName, endpointName); + } + public boolean isRemote() { return remote; } Copied: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Se= rviceRegistrationListener.java (from rev 4903, remoting3/trunk/jboss-remoti= ng/src/main/java/org/jboss/remoting3/ServiceListener.java) =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Servic= eRegistrationListener.java (rev 0) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Servic= eRegistrationListener.java 2009-04-14 17:18:15 UTC (rev 5032) @@ -0,0 +1,150 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2008, 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.remoting3; + +import org.jboss.remoting3.spi.RequestHandlerSource; + +/** + * A listener for watching service registrations on an endpoint. + * + * @apiviz.landmark + */ +public interface ServiceRegistrationListener { + + /** + * Receive notification that a service was registered. + * + * @param listenerHandle the handle to this listener + * @param info the servce information + */ + void serviceRegistered(SimpleCloseable listenerHandle, ServiceInfo inf= o); + + /** + * Information about a registered service. + * + * @apiviz.exclude + */ + final class ServiceInfo { + private String serviceType; + private String groupName; + private int metric; + private RequestHandlerSource requestHandlerSource; + private SimpleCloseable registrationHandle; + + /** + * Construct a new instance. + */ + public ServiceInfo() { + } + + /** + * Get the service type. + * + * @return the service type + */ + public String getServiceType() { + return serviceType; + } + + /** + * Set the service type. + * + * @param serviceType the service type + */ + public void setServiceType(final String serviceType) { + this.serviceType =3D serviceType; + } + + /** + * Get the group name. + * + * @return the group name + */ + public String getGroupName() { + return groupName; + } + + /** + * Set the group name. + * + * @param groupName the group name + */ + public void setGroupName(final String groupName) { + this.groupName =3D groupName; + } + + /** + * Get the metric. + * + * @return the metric + */ + public int getMetric() { + return metric; + } + + /** + * Set the metric. + * + * @param metric the metric + */ + public void setMetric(final int metric) { + this.metric =3D metric; + } + + /** + * Get the request handler source. + * + * @return the request handler source + */ + public RequestHandlerSource getRequestHandlerSource() { + return requestHandlerSource; + } + + /** + * Set the request handler source. + * + * @param requestHandlerSource the request handler source + */ + public void setRequestHandlerSource(final RequestHandlerSource req= uestHandlerSource) { + this.requestHandlerSource =3D requestHandlerSource; + } + + /** + * Get the registration handle. Closing this handle will remove t= he registration. + * + * @return the registration handle + */ + public SimpleCloseable getRegistrationHandle() { + return registrationHandle; + } + + /** + * Set the registration handle. + * + * @param registrationHandle the registration handle + */ + public void setRegistrationHandle(final SimpleCloseable registrati= onHandle) { + this.registrationHandle =3D registrationHandle; + } + } +} Added: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Ser= viceSpecification.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Servic= eSpecification.java (rev 0) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Servic= eSpecification.java 2009-04-14 17:18:15 UTC (rev 5032) @@ -0,0 +1,122 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2009, 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.remoting3; + +import java.net.URI; + +/** + * A specification of a JBoss Remoting service. + * + * @apiviz.exclude + */ +public final class ServiceSpecification { + private final String serviceType; + private final String groupName; + private final String endpointName; + + public ServiceSpecification(final String serviceType, final String gro= upName, final String endpointName) { + if (serviceType =3D=3D null) { + throw new NullPointerException("serviceType is null"); + } + if (groupName =3D=3D null) { + throw new NullPointerException("groupName is null"); + } + if (endpointName =3D=3D null) { + throw new NullPointerException("endpointName is null"); + } + if (serviceType.length() > 0 && ! "*".equals(serviceType)) { + ServiceURI.validateServiceType(serviceType); + this.serviceType =3D serviceType.toLowerCase(); + } else { + this.serviceType =3D "*"; + } + if (groupName.length() > 0 && ! "*".equals(groupName)) { + ServiceURI.validateGroupName(groupName); + this.groupName =3D groupName.toLowerCase(); + } else { + this.groupName =3D "*"; + } + if (endpointName.length() > 0 && ! "*".equals(endpointName)) { + ServiceURI.validateEndpointName(endpointName); + this.endpointName =3D endpointName.toLowerCase(); + } else { + this.endpointName =3D "*"; + } + } + + public static ServiceSpecification fromUri(final URI uri) { + return new ServiceSpecification(ServiceURI.getServiceType(uri), Se= rviceURI.getGroupName(uri), ServiceURI.getEndpointName(uri)); + } + + public String getServiceType() { + return serviceType; + } + + public String getGroupName() { + return groupName; + } + + public String getEndpointName() { + return endpointName; + } + + public boolean matches(final URI serviceUri) { + if (! ServiceURI.isRemotingServiceUri(serviceUri)) { + return false; + } + if (! "*".equals(serviceType)) { + if (! serviceType.equals(ServiceURI.getServiceType(serviceUri)= )) { + return false; + } + } + if (! "*".equals(groupName)) { + if (! groupName.equals(ServiceURI.getGroupName(serviceUri))) { + return false; + } + } + if (! "*".equals(endpointName)) { + if (! endpointName.equals(ServiceURI.getEndpointName(serviceUr= i))) { + return false; + } + } + return true; + } + + public boolean equals(final Object o) { + if (this =3D=3D o) return true; + if (! (o instanceof ServiceSpecification)) return false; + final ServiceSpecification that =3D (ServiceSpecification) o; + if (!endpointName.equals(that.endpointName)) return false; + if (!groupName.equals(that.groupName)) return false; + if (!serviceType.equals(that.serviceType)) return false; + return true; + } + + @Override + public int hashCode() { + int result =3D serviceType.hashCode(); + result =3D 31 * result + groupName.hashCode(); + result =3D 31 * result + endpointName.hashCode(); + return result; + } +} Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/= ServiceURI.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Servic= eURI.java 2009-04-14 10:34:23 UTC (rev 5031) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Servic= eURI.java 2009-04-14 17:18:15 UTC (rev 5032) @@ -24,6 +24,7 @@ = import java.net.URI; import java.net.URISyntaxException; +import java.util.regex.Pattern; = /** * A parser for JBoss Remoting URI types. @@ -65,7 +66,7 @@ } else { serviceType =3D ssp.substring(0, firstColon); } - return serviceType; + return serviceType.toLowerCase(); } = /** @@ -91,7 +92,7 @@ } else { groupName =3D ssp.substring(firstColon + 1, secondColon); } - return groupName; + return groupName.toLowerCase(); } = /** @@ -122,7 +123,7 @@ } else { endpointName =3D ssp.substring(secondColon + 1, thirdColon); } - return endpointName; + return endpointName.toLowerCase(); } = /** @@ -152,4 +153,35 @@ throw new IllegalStateException("URI syntax exception should n= ot be possible here", e); } } + + private static final Pattern VALID_SERVICE_TYPE =3D Pattern.compile("^= (?:[_a-z][_a-z0-9]*)(?:\\.[_a-z][_a-z0-9]*)*$", Pattern.CASE_INSENSITIVE); + private static final Pattern VALID_GROUP_NAME =3D Pattern.compile("^(?= :[_a-z0-9]+)(?:\\.[_a-z0-9]+)*$", Pattern.CASE_INSENSITIVE); + private static final Pattern VALID_ENDPOINT_NAME =3D VALID_SERVICE_TYP= E; + + public static void validateServiceType(final CharSequence serviceType)= { + if (serviceType =3D=3D null) { + throw new NullPointerException("serviceType is null"); + } + if (! VALID_SERVICE_TYPE.matcher(serviceType).matches()) { + throw new IllegalArgumentException("Service type \"" + service= Type + "\" is not valid"); + } + } + + public static void validateGroupName(final CharSequence groupName) { + if (groupName =3D=3D null) { + throw new NullPointerException("groupName is null"); + } + if (! VALID_GROUP_NAME.matcher(groupName).matches()) { + throw new IllegalArgumentException("Group name \"" + groupName= + "\" is not valid"); + } + } + + public static void validateEndpointName(final String endpointName) { + if (endpointName =3D=3D null) { + throw new NullPointerException("endpointName is null"); + } + if (! VALID_ENDPOINT_NAME.matcher(endpointName).matches()) { + throw new IllegalArgumentException("Endpoint name \"" + endpoi= ntName + "\" is not valid"); + } + } } Added: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi= /Cancellable.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Ca= ncellable.java (rev 0) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Ca= ncellable.java 2009-04-14 17:18:15 UTC (rev 5032) @@ -0,0 +1,43 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2009, 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.remoting3.spi; + +/** + * A handle which can be used to cancel an operation. Cancellation is not= mandatory; calling this method merely indicates + * that the operation need not complete. + */ +public interface Cancellable { + + /** + * Cancel the operation. Calling this method more than one time has n= o additional effect. + */ + void cancel(); + + /** + * A Cancellable instance which does nothing. + */ + Cancellable NULL_CANCELLABLE =3D new Cancellable() { + public void cancel() { + } + }; +} Added: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi= /ConnectionProvider.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Co= nnectionProvider.java (rev 0) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Co= nnectionProvider.java 2009-04-14 17:18:15 UTC (rev 5032) @@ -0,0 +1,46 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2009, 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.remoting3.spi; + +import java.io.IOException; +import java.net.URI; +import org.jboss.remoting3.ResourceType; + +/** + * + */ +public interface ConnectionProvider<T> { + Cancellable connect(URI uri, Result<T> result) throws IllegalArgumentE= xception; + + URI getConnectionUri(URI uri); + + ResourceType getResourceType(); + + interface Result<T> { + void setResult(T result); + + void setException(IOException exception); + + void setCancelled(); + } +} Added: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi= /EndpointConnection.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/En= dpointConnection.java (rev 0) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/En= dpointConnection.java 2009-04-14 17:18:15 UTC (rev 5032) @@ -0,0 +1,38 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2009, 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.remoting3.spi; + +import java.io.Closeable; + +/** + * A connection to a foreign endpoint. + */ +public interface EndpointConnection extends Closeable { + String getEndpointName(); + + int getMetric(); + + ConnectionProvider<RequestHandler> getRequestHandlerConnectionProvider= (); + + ConnectionProvider<RequestHandlerSource> getRequestHandlerSourceConnec= tionProvider(); +} Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/= spi/RemoteRequestContext.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Re= moteRequestContext.java 2009-04-14 10:34:23 UTC (rev 5031) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Re= moteRequestContext.java 2009-04-14 17:18:15 UTC (rev 5032) @@ -26,7 +26,7 @@ * The context of an outstanding remote request. This instance should be = discarded when a reply (of any sort) * is received for the request. */ -public interface RemoteRequestContext { +public interface RemoteRequestContext extends Cancellable { = /** * Signal that the request should be cancelled, if possible. Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/= spi/RequestHandler.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Re= questHandler.java 2009-04-14 10:34:23 UTC (rev 5031) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Re= questHandler.java 2009-04-14 17:18:15 UTC (rev 5032) @@ -22,9 +22,6 @@ = package org.jboss.remoting3.spi; = -import java.io.IOException; -import org.jboss.remoting3.CloseHandler; - /** * A request handler, which can be passed to remote endpoints. Remote sys= tems can then use the handler * to make invocations, or they may forward a handler on to other remote s= ystems. @@ -46,30 +43,4 @@ * @return a context which may be used to cancel the request */ RemoteRequestContext receiveRequest(Object request, ReplyHandler reply= Handler); - - /** - * Get a handle to this request handler. The request handler will not= auto-close as long as there is at least - * one open handle. If a handle is "leaked", it will be closed - * automatically if/when the garbage collector invokes its {@link Obje= ct#finalize()} method, with a log message - * warning of the leak. - * - * @return the handle - * @throws IOException if a handle could not be acquired - */ - Handle<RequestHandler> getHandle() throws IOException; - - /** - * Close this request handler. The outcome of any outstanding request= s is not defined, though implementations - * should make an effort to cancel any outstanding requests. - * - * @throws java.io.IOException if the client endpoint could not be clo= sed - */ - void close() throws IOException; - - /** - * Add a handler that is called when the request handler is closed. - * - * @param handler the handler to be called - */ - Key addCloseHandler(final CloseHandler<? super RequestHandler> handler= ); } Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/= spi/RequestHandlerSource.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Re= questHandlerSource.java 2009-04-14 10:34:23 UTC (rev 5031) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Re= questHandlerSource.java 2009-04-14 17:18:15 UTC (rev 5032) @@ -23,8 +23,6 @@ package org.jboss.remoting3.spi; = import java.io.IOException; -import org.jboss.remoting3.CloseHandler; -import org.jboss.remoting3.RemotingException; = /** * A request handler source, which can be passed to remote endpoints. Rem= ote systems can then use the handler source @@ -38,30 +36,7 @@ * Create a request handler for the service corresponding to this requ= est handler source. * * @return a request handler - * @throws RemotingException if a client could not be opened + * @throws IOException if a client could not be opened */ Handle<RequestHandler> createRequestHandler() throws IOException; - - /** - * Get a handle to this request handler source. The request handler s= ource will not auto-close as long as there is at least - * one open handle, or request handler. If a handle is "leaked", it w= ill be closed - * automatically if/when the garbage collector invokes its {@link Obje= ct#finalize()} method, with a log message - * warning of the leak. - * - * @return the handle - * @throws RemotingException if a handle could not be acquired - */ - Handle<RequestHandlerSource> getHandle() throws IOException; - - /** - * Close this request handler source immediately. - */ - void close() throws IOException; - - /** - * Add a handler that is called when the request handler source is clo= sed. - * - * @param handler the handler to be called - */ - Key addCloseHandler(final CloseHandler<? super RequestHandlerSource> h= andler); } Modified: remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/= EndpointTestCase.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/Endpoi= ntTestCase.java 2009-04-14 10:34:23 UTC (rev 5031) +++ remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/Endpoi= ntTestCase.java 2009-04-14 17:18:15 UTC (rev 5032) @@ -68,7 +68,7 @@ final Object requestObj =3D new Object(); final Object replyObj =3D new Object(); try { - final Handle<RequestHandler> handle =3D endpoint.createReq= uestHandler(new AbstractRequestListener<Object, Object>() { + final Handle<RequestHandler> handle =3D endpoint.createLoc= alRequestHandler(new AbstractRequestListener<Object, Object>() { public void handleRequest(final RequestContext<Object>= context, final Object request) throws RemoteExecutionException { assertEquals(request, requestObj); try { @@ -126,7 +126,7 @@ try { final Object requestObj =3D new Object(); final Object replyObj =3D new Object(); - final Handle<RequestHandler> handle =3D endpoint.createReq= uestHandler(new AbstractRequestListener<Object, Object>() { + final Handle<RequestHandler> handle =3D endpoint.createLoc= alRequestHandler(new AbstractRequestListener<Object, Object>() { public void handleRequest(final RequestContext<Object>= context, final Object request) throws RemoteExecutionException { assertEquals(request, requestObj); try { @@ -183,7 +183,7 @@ final EndpointImpl endpoint =3D new EndpointImpl(executorServi= ce, "test-endpoint"); try { final Object requestObj =3D new Object(); - final Handle<RequestHandler> handle =3D endpoint.createReq= uestHandler(new AbstractRequestListener<Object, Object>() { + final Handle<RequestHandler> handle =3D endpoint.createLoc= alRequestHandler(new AbstractRequestListener<Object, Object>() { public void handleRequest(final RequestContext<Object>= context, final Object request) throws RemoteExecutionException { assertEquals(request, requestObj); // don't send a reply!! @@ -220,7 +220,7 @@ final EndpointImpl endpoint =3D new EndpointImpl(executorServi= ce, "test-endpoint"); try { final Object requestObj =3D new Object(); - final Handle<RequestHandler> handle =3D endpoint.createReq= uestHandler(new AbstractRequestListener<Object, Object>() { + final Handle<RequestHandler> handle =3D endpoint.createLoc= alRequestHandler(new AbstractRequestListener<Object, Object>() { public void handleRequest(final RequestContext<Object>= context, final Object request) throws RemoteExecutionException { assertEquals(request, requestObj); context.execute(new Runnable() { Modified: remoting3/trunk/samples/src/test/java/org/jboss/remoting3/samples= /protocol/basic/BasicTestCase.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/samples/src/test/java/org/jboss/remoting3/samples/proto= col/basic/BasicTestCase.java 2009-04-14 10:34:23 UTC (rev 5031) +++ remoting3/trunk/samples/src/test/java/org/jboss/remoting3/samples/proto= col/basic/BasicTestCase.java 2009-04-14 17:18:15 UTC (rev 5032) @@ -63,7 +63,7 @@ configuration.setMarshallingConfiguration(marshallingConfi= guration); final Endpoint endpoint =3D Remoting.createEndpoint(execut= or, "test"); try { - final Handle<RequestHandler> requestHandlerHandle =3D = endpoint.createRequestHandler(new AbstractRequestListener<Object, Object>()= { + final Handle<RequestHandler> requestHandlerHandle =3D = endpoint.createLocalRequestHandler(new AbstractRequestListener<Object, Obje= ct>() { public void handleRequest(final RequestContext<Obj= ect> context, final Object request) throws RemoteExecutionException { System.out.println("Got a request! " + request= .toString()); try { --===============5211739153465984071==-- From jboss-remoting-commits at lists.jboss.org Tue Apr 14 14:01:02 2009 Content-Type: multipart/mixed; boundary="===============9159718742113559912==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5033 - in remoting3/trunk: jboss-remoting/src/main/java/org/jboss/remoting3/spi and 2 other directories. Date: Tue, 14 Apr 2009 14:00:58 -0400 Message-ID: <E1LtmwM-0006tQ-I7@committer01.frg.pub.inap.atl.jboss.com> --===============9159718742113559912== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: david.lloyd(a)jboss.com Date: 2009-04-14 14:00:58 -0400 (Tue, 14 Apr 2009) New Revision: 5033 Removed: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/ClientC= onnector.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/ClientS= ourceConnector.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Endpoin= tConnector.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Qualifi= edName.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Nam= edServiceRegistry.java remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/spi/Nam= eTestCase.java Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Resourc= eType.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Service= Specification.java remoting3/trunk/samples/src/main/java/org/jboss/remoting3/samples/simple= /MultiplexClientExample.java remoting3/trunk/samples/src/main/java/org/jboss/remoting3/samples/simple= /MultiplexServerExample.java Log: API cleanup, javadoc Deleted: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/C= lientConnector.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Client= Connector.java 2009-04-14 17:18:15 UTC (rev 5032) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Client= Connector.java 2009-04-14 18:00:58 UTC (rev 5033) @@ -1,47 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2009, 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.remoting3; - -import java.net.URI; -import org.jboss.xnio.IoFuture; - -/** - * A client connector. Opens a connection to a URI which provides a singl= e {@code Client} instance. Instances of this - * interface may only be able to support a single URI scheme. Depending o= n the implementation, the URI may be a - * protocol URI or a service URI. - */ -public interface ClientConnector extends HandleableCloseable<ClientConnect= or> { - - /** - * Establish a client connection. - * - * @param requestType the request class - * @param replyType the reply class - * @param connectUri the URI to connect to - * @param <I> the request type - * @param <O> the reply type - * @return the future client - * @throws IllegalArgumentException if the provided URI scheme is not = supported by this connector - */ - <I, O> IoFuture<? extends Client<I, O>> openClient(Class<I> requestTyp= e, Class<O> replyType, URI connectUri) throws IllegalArgumentException; -} Deleted: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/C= lientSourceConnector.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Client= SourceConnector.java 2009-04-14 17:18:15 UTC (rev 5032) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Client= SourceConnector.java 2009-04-14 18:00:58 UTC (rev 5033) @@ -1,47 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2009, 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.remoting3; - -import java.net.URI; -import org.jboss.xnio.IoFuture; - -/** - * A client source connector. Opens a connection to a URI which provides = a {@code ClientSource} instance. Instances of this - * interface may only be able to support a single URI scheme. Depending o= n the implementation, the URI may be a - * protocol URI or a service URI. - */ -public interface ClientSourceConnector extends HandleableCloseable<ClientS= ourceConnector> { - - /** - * Establish a client source connection. - * - * @param requestType the request class - * @param replyType the reply class - * @param connectUri the URI to connect to - * @param <I> the request type - * @param <O> the reply type - * @return the future client - * @throws IllegalArgumentException if the provided URI scheme is not = supported by this connector - */ - <I, O> IoFuture<? extends ClientSource<I, O>> openClientSource(Class<I= > requestType, Class<O> replyType, URI connectUri) throws IllegalArgumentEx= ception; -} \ No newline at end of file Deleted: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/E= ndpointConnector.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Endpoi= ntConnector.java 2009-04-14 17:18:15 UTC (rev 5032) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Endpoi= ntConnector.java 2009-04-14 18:00:58 UTC (rev 5033) @@ -1,42 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2009, 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.remoting3; - -import java.net.URI; -import org.jboss.xnio.IoFuture; - -/** - * An endpoint connector. Used to connect a whole endpoint to another who= le endpoint. Typically, services are then - * shared between the endpoints in some fashion, though this need not be t= he case. - */ -public interface EndpointConnector extends HandleableCloseable<EndpointCon= nector> { - - /** - * Connect the given endpoint to the remote URI. - * - * @param endpoint the endpoint to connect - * @param connectUri the connection URI - * @return the future handle, which may be used to terminate the conne= ction - */ - IoFuture<? extends HandleableCloseable> connect(Endpoint endpoint, URI= connectUri); -} Deleted: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Q= ualifiedName.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Qualif= iedName.java 2009-04-14 17:18:15 UTC (rev 5032) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Qualif= iedName.java 2009-04-14 18:00:58 UTC (rev 5033) @@ -1,258 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2008, 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.remoting3; - -import java.io.UnsupportedEncodingException; -import java.net.URLDecoder; -import java.net.URLEncoder; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Iterator; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * A qualified name for service registration. A qualified name is a path-= like structure comprised of a series of - * zero or more name segments. The string representation of a qualified n= ame is a sequence of a forward slash - * ({@code /}) followed by a non-empty URL-encoded name segment. - */ -public final class QualifiedName implements Comparable<QualifiedName>, Ite= rable<String> { - - /** - * The root name. - */ - public static final QualifiedName ROOT_NAME =3D new QualifiedName(new = String[0]); - - private final String[] segments; - - /** - * Create a new qualified name from the given name segments. - * - * @param nameSegments the name segments - * @throws NullPointerException if {@code nameSegments} is {@code null= } or if any element of that array is {@code null} - * @throws IllegalArgumentException if an element of {@code nameSegmen= ts} is an empty string - */ - public QualifiedName(final String[] nameSegments) throws NullPointerEx= ception, IllegalArgumentException { - if (nameSegments =3D=3D null) { - throw new NullPointerException("segments is null"); - } - String[] segments =3D nameSegments.clone(); - for (String s : segments) { - if (s =3D=3D null) { - throw new NullPointerException("Null segment"); - } - if (s.length() =3D=3D 0) { - throw new IllegalArgumentException("Empty segment"); - } - } - this.segments =3D segments; - } - - /** - * Compare this qualified name to another for equality. Returns {@cod= e true} if both names have the same number of segments - * with the same content. - * - * @param o the object to compare to - * @return {@code true} if the given object is a qualified name which = is equal to this name - */ - public boolean equals(final Object o) { - if (this =3D=3D o) return true; - if (! (o instanceof QualifiedName)) return false; - final QualifiedName name =3D (QualifiedName) o; - if (!Arrays.equals(segments, name.segments)) return false; - return true; - } - - /** - * Get the hash code of this qualified name. Equal to the return valu= e of {@link Arrays#hashCode(Object[]) Arrays.hashCode(segments)} - * where {@code segments} is the array of decoded segment strings. - * - * @return the hash code - */ - public int hashCode() { - return Arrays.hashCode(segments); - } - - /** - * Compare this qualified name to another. Each segment is compared i= n turn; if they are equal then the comparison - * carries on to the next segment. If all leading segments are equal = but one qualified name has more segments, - * then the longer name is said to come after the shorter name. - * - * @param o the other name - * @return {@code 0} if the elements are equal, {@code -1} if this nam= e comes before the given name, or {@code 1} if - * this name comes after the given name - */ - public int compareTo(final QualifiedName o) { - if (this =3D=3D o) return 0; - String[] a =3D segments; - String[] b =3D o.segments; - final int alen =3D a.length; - final int blen =3D b.length; - for (int i =3D 0; i < alen && i < blen; i ++) { - final int cmp =3D a[i].compareTo(b[i]); - if (cmp !=3D 0) { - return cmp; - } - } - if (alen < blen) { - return -1; - } else if (alen > blen) { - return 1; - } else { - return 0; - } - } - - /** - * Get the string representation of this qualified name. The root nam= e is "{@code /}"; all other names are comprised - * of one or more consecutive character sequences of a forward slash f= ollowed by one or more URL-encoded characters. - * - * @return the string representation of this name - */ - public String toString() { - StringBuilder builder =3D new StringBuilder(); - if (segments.length =3D=3D 0) { - return "/"; - } else for (String segment : segments) { - try { - builder.append('/'); - builder.append(URLEncoder.encode(segment, "utf-8")); - } catch (UnsupportedEncodingException e) { - // cannot happen - throw new IllegalStateException(e); - } - } - return builder.toString(); - } - - /** - * Parse an absolute qualified name. An absolute qualified name must = consist of either a single forward slash ("{@code /}") or else - * a series of path components, each comprised of a single forward sla= sh followed by a URL-encoded series of non-forward-slash - * characters. - * - * @param path the encoded absolute path - * @return the qualified name - */ - public static QualifiedName parse(String path) { - final int len =3D path.length(); - if (len < 1) { - throw new IllegalArgumentException("Empty path"); - } - if (path.charAt(0) !=3D '/') { - throw new IllegalArgumentException("Relative paths are not all= owed"); - } - if (len =3D=3D 1) { - return ROOT_NAME; - } - return ROOT_NAME.parseRelative(path.substring(1)); - } - - /** - * Get an iterator over the sequence of strings. - * - * @return an iterator - */ - public Iterator<String> iterator() { - return new Iterator<String>() { - int i; - - public boolean hasNext() { - return i < segments.length; - } - - public String next() { - try { - return segments[i++]; - } catch (ArrayIndexOutOfBoundsException e) { - throw new NoSuchElementException("next() past end"); - } - } - - public void remove() { - throw new UnsupportedOperationException("remove()"); - } - }; - } - - /** - * Parse a qualified name relative to this one. A relative qualified = name must consist of - * a series of segments comprised of one or more URL-encoded character= s separated by forward slashes ("{@code /}"). - * - * @param path the encoded relative path - * @return the qualified name - */ - public QualifiedName parseRelative(String path) { - if (path =3D=3D null) { - throw new NullPointerException("path is null"); - } - List<String> decoded =3D new ArrayList<String>(); - int segStart =3D 0; - int segEnd; - do { - segEnd =3D path.indexOf('/', segStart); - String segment =3D segEnd =3D=3D -1 ? path.substring(segStart)= : path.substring(segStart, segEnd); - if (segment.length() =3D=3D 0) { - throw new IllegalArgumentException(segEnd =3D=3D -1 ? "Inv= alid trailing slash" : "Empty segment in path"); - } - try { - decoded.add(URLDecoder.decode(segment, "utf-8")); - } catch (UnsupportedEncodingException e) { - // cannot happen - throw new IllegalStateException(e); - } - segStart =3D segEnd + 1; - } while (segEnd !=3D -1); - final String[] segments =3D this.segments; - final int length =3D segments.length; - final String[] newSegments =3D new String[length + decoded.size()]; - System.arraycopy(segments, 0, newSegments, 0, length); - for (int i =3D 0; i < decoded.size(); i ++) { - newSegments[i + length] =3D decoded.get(i); - } - return new QualifiedName(newSegments); - } - - /** - * Get a new {@code org.jboss.remoting.QualifiedName} relative to this= one. - * - * @param relativePath the segment to append - * @return the new {@code org.jboss.remoting.QualifiedName} instance - */ - public QualifiedName appendRelative(String relativePath) { - final String[] segments =3D this.segments; - final int length =3D segments.length; - final String[] newSegments =3D new String[length + 1]; - System.arraycopy(segments, 0, newSegments, 0, length); - newSegments[length] =3D relativePath; - return new QualifiedName(newSegments); - } - - /** - * Get the number of segments in this name. - * - * @return the number of segments - */ - public int length() { - return segments.length; - } -} Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/= ResourceType.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Resour= ceType.java 2009-04-14 17:18:15 UTC (rev 5032) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Resour= ceType.java 2009-04-14 18:00:58 UTC (rev 5033) @@ -23,11 +23,29 @@ package org.jboss.remoting3; = /** + * The type of resource supported by a specific connection manager. * + * @apiviz.excluded */ public enum ResourceType { + + /** + * An unknown resource. Such a resource cannot be opened by an endpoi= nt. + */ UNKNOWN, + /** + * A client resource. Use {@link Endpoint#openClient(java.net.URI, Cl= ass, Class) Endpoint.openClient(*)} to open + * a client resource URI. + */ CLIENT, + /** + * A client source resource. Use {@link Endpoint#openClientSource(jav= a.net.URI, Class, Class) Endpoint.openClientSource(*)} to open + * a client source resource URI. + */ CLIENT_SOURCE, + /** + * An endpoint resource. Use {@link Endpoint#openEndpointConnection(j= ava.net.URI) Endpoint.openEndpointConnection(*)} to open + * an endpoint resource URI. + */ ENDPOINT, } Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/= ServiceSpecification.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Servic= eSpecification.java 2009-04-14 17:18:15 UTC (rev 5032) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Servic= eSpecification.java 2009-04-14 18:00:58 UTC (rev 5033) @@ -34,6 +34,14 @@ private final String groupName; private final String endpointName; = + /** + * Construct a new instance. Each argument is validated and converted= into a canonical form. The arguments + * may be "*" indicating that anything will match. + * + * @param serviceType the service type + * @param groupName the group name + * @param endpointName the endpoint name + */ public ServiceSpecification(final String serviceType, final String gro= upName, final String endpointName) { if (serviceType =3D=3D null) { throw new NullPointerException("serviceType is null"); @@ -64,22 +72,49 @@ } } = + /** + * Create an instance from a service URI. + * + * @param uri the URI + * @return the specificaion + */ public static ServiceSpecification fromUri(final URI uri) { return new ServiceSpecification(ServiceURI.getServiceType(uri), Se= rviceURI.getGroupName(uri), ServiceURI.getEndpointName(uri)); } = + /** + * Get the service type of this specification. + * + * @return the service type + */ public String getServiceType() { return serviceType; } = + /** + * Get the group name of this specification. + * + * @return the group name + */ public String getGroupName() { return groupName; } = + /** + * Get the endpoint name of this specification. + * + * @return the endpoint name + */ public String getEndpointName() { return endpointName; } = + /** + * Determine whether the given URI matches this specification. + * + * @param serviceUri the service URI + * @return {@code true} if the URI is a service which matches this spe= cification + */ public boolean matches(final URI serviceUri) { if (! ServiceURI.isRemotingServiceUri(serviceUri)) { return false; @@ -102,6 +137,7 @@ return true; } = + /** {@inheritDoc} */ public boolean equals(final Object o) { if (this =3D=3D o) return true; if (! (o instanceof ServiceSpecification)) return false; @@ -112,7 +148,7 @@ return true; } = - @Override + /** {@inheritDoc} */ public int hashCode() { int result =3D serviceType.hashCode(); result =3D 31 * result + groupName.hashCode(); Deleted: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/s= pi/NamedServiceRegistry.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Na= medServiceRegistry.java 2009-04-14 17:18:15 UTC (rev 5032) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Na= medServiceRegistry.java 2009-04-14 18:00:58 UTC (rev 5033) @@ -1,117 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2008, 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.remoting3.spi; - -import java.io.IOException; -import java.util.Collections; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; -import org.jboss.remoting3.CloseHandler; -import org.jboss.remoting3.QualifiedName; -import org.jboss.remoting3.ServiceRegistrationException; -import org.jboss.xnio.IoUtils; -import org.jboss.xnio.log.Logger; - -/** - * A registry associating names with services. Specifically, the name is = associated with a handle to a request handler - * source instance; this handle is owned by the registry, so closing the h= andle will remove the entry. - */ -public final class NamedServiceRegistry { - private static final Logger log =3D Logger.getLogger("org.jboss.remoti= ng.named-registry"); - - private final ConcurrentMap<QualifiedName, Handle<RequestHandlerSource= >> map =3D new ConcurrentHashMap<QualifiedName, Handle<RequestHandlerSource= >>(); - - /** - * Construct a new empty registry. - */ - public NamedServiceRegistry() { - } - - /** - * Register a service at the given path. If the given service is clos= ed, an exception will be thrown. Returns - * a handle to the service which may be used to unregister this servic= e from the registry. In addition, if the - * service is closed, the registration will be automatically removed. = To monitor the registration, add a close - * handler to the returned handle. - * - * @param path the path of the service registration - * @param service the service - * @return a handle which can be used to unregister the service - * @throws IOException if an error occurs - */ - public Handle<RequestHandlerSource> registerService(final QualifiedNam= e path, final RequestHandlerSource service) throws IOException { - if (path =3D=3D null) { - throw new NullPointerException("path is null"); - } - if (service =3D=3D null) { - throw new NullPointerException("service is null"); - } - final Handle<RequestHandlerSource> handle =3D service.getHandle(); - boolean ok =3D false; - try { - final Handle<RequestHandlerSource> oldHandle =3D map.putIfAbse= nt(path, handle); - if (oldHandle !=3D null) { - throw new ServiceRegistrationException(String.format("Fail= ed to register a service at path \"%s\" on %s (a service is already registe= red at that location)", path, this)); - } - handle.addCloseHandler(new CloseHandler<Handle<RequestHandlerS= ource>>() { - public void handleClose(final Handle<RequestHandlerSource>= closed) { - if (map.remove(path, service)) { - log.trace("Removed service %s at path \"%s\" on %s= (service handle was closed)", service, path, this); - } - } - }); - log.trace("Registered %s at path \"%s\" on %s", service, path,= this); - ok =3D true; - return handle; - } finally { - if (! ok) IoUtils.safeClose(handle); - } - } - - /** - * Find a service at a location in the registry. - * - * @param path the path - * @return a handle to the service, or {@code null} if it is not found - */ - public Handle<RequestHandlerSource> lookupService(QualifiedName path) { - return map.get(path); - } - - /** - * Get an unmodifiable view of the entry set of the registry. - * - * @return a set view - */ - public Set<Map.Entry<QualifiedName, Handle<RequestHandlerSource>>> get= EntrySet() { - return Collections.unmodifiableSet(map.entrySet()); - } - - /** - * Returns a brief description of this object. - */ - public String toString() { - return "named service registry <" + Integer.toHexString(hashCode()= ) + ">"; - } -} Deleted: remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/s= pi/NameTestCase.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/spi/Na= meTestCase.java 2009-04-14 17:18:15 UTC (rev 5032) +++ remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/spi/Na= meTestCase.java 2009-04-14 18:00:58 UTC (rev 5033) @@ -1,89 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2008, 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.remoting3.spi; - -import junit.framework.TestCase; -import org.jboss.remoting3.QualifiedName; -import java.util.Iterator; - -/** - * - */ -public final class NameTestCase extends TestCase { - - public void testParseEmpty() { - boolean ok =3D false; - try { - QualifiedName.parse(""); - } catch (IllegalArgumentException e) { - assertEquals("Wrong exception message", "Empty path", e.getMes= sage()); - ok =3D true; - } - assertTrue("Exception not thrown", ok); - } - - public void testParseRelative() { - boolean ok =3D false; - try { - QualifiedName.parse("some relative path/foo/bar"); - } catch (IllegalArgumentException e) { - assertEquals("Wrong exception message", "Relative paths are no= t allowed", e.getMessage()); - ok =3D true; - } - assertTrue("Exception not thrown", ok); - } - - public void testParseRoot() { - final Iterator<String> i =3D QualifiedName.parse("/").iterator(); - assertFalse(i.hasNext()); - } - - public void testParseOneLevel() { - final Iterator<String> i =3D QualifiedName.parse("/firstElement").= iterator(); - assertTrue(i.hasNext()); - assertEquals("Wrong segment name", "firstElement", i.next()); - assertFalse(i.hasNext()); - } - - public void testParseTwoLevel() { - final Iterator<String> i =3D QualifiedName.parse("/firstElement/se= condElement").iterator(); - assertTrue(i.hasNext()); - assertEquals("Wrong segment name", "firstElement", i.next()); - assertTrue(i.hasNext()); - assertEquals("Wrong segment name", "secondElement", i.next()); - assertFalse(i.hasNext()); - } - - public void testParseManyLevel() { - final Iterator<String> i =3D QualifiedName.parse("/firstElement/se= condElement/boo/test+with+spaces%20test").iterator(); - assertTrue(i.hasNext()); - assertEquals("Wrong segment name", "firstElement", i.next()); - assertTrue(i.hasNext()); - assertEquals("Wrong segment name", "secondElement", i.next()); - assertTrue(i.hasNext()); - assertEquals("Wrong segment name", "boo", i.next()); - assertTrue(i.hasNext()); - assertEquals("Wrong segment name", "test with spaces test", i.next= ()); - assertFalse(i.hasNext()); - } -} Modified: remoting3/trunk/samples/src/main/java/org/jboss/remoting3/samples= /simple/MultiplexClientExample.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/samples/src/main/java/org/jboss/remoting3/samples/simpl= e/MultiplexClientExample.java 2009-04-14 17:18:15 UTC (rev 5032) +++ remoting3/trunk/samples/src/main/java/org/jboss/remoting3/samples/simpl= e/MultiplexClientExample.java 2009-04-14 18:00:58 UTC (rev 5033) @@ -26,11 +26,9 @@ import org.jboss.remoting3.Remoting; import org.jboss.remoting3.ClientSource; import org.jboss.remoting3.Client; -import org.jboss.remoting3.QualifiedName; import org.jboss.remoting3.multiplex.MultiplexProtocol; import org.jboss.remoting3.multiplex.MultiplexConfiguration; import org.jboss.remoting3.multiplex.MultiplexConnection; -import org.jboss.remoting3.spi.NamedServiceRegistry; import org.jboss.remoting3.spi.RequestHandlerSource; import org.jboss.remoting3.spi.Handle; import org.jboss.xnio.IoUtils; Modified: remoting3/trunk/samples/src/main/java/org/jboss/remoting3/samples= /simple/MultiplexServerExample.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/samples/src/main/java/org/jboss/remoting3/samples/simpl= e/MultiplexServerExample.java 2009-04-14 17:18:15 UTC (rev 5032) +++ remoting3/trunk/samples/src/main/java/org/jboss/remoting3/samples/simpl= e/MultiplexServerExample.java 2009-04-14 18:00:58 UTC (rev 5033) @@ -29,8 +29,6 @@ import org.jboss.remoting3.multiplex.MultiplexConfiguration; import org.jboss.remoting3.spi.RequestHandlerSource; import org.jboss.remoting3.spi.Handle; -import org.jboss.remoting3.spi.NamedServiceRegistry; -import org.jboss.remoting3.QualifiedName; import org.jboss.xnio.IoUtils; import org.jboss.xnio.Buffers; import org.jboss.xnio.IoHandlerFactory; --===============9159718742113559912==-- From jboss-remoting-commits at lists.jboss.org Tue Apr 14 14:04:38 2009 Content-Type: multipart/mixed; boundary="===============5539510748369857988==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5034 - remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3. Date: Tue, 14 Apr 2009 14:04:38 -0400 Message-ID: <E1Ltmzu-0007Cl-Oc@committer01.frg.pub.inap.atl.jboss.com> --===============5539510748369857988== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: david.lloyd(a)jboss.com Date: 2009-04-14 14:04:38 -0400 (Tue, 14 Apr 2009) New Revision: 5034 Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Endpoin= t.java Log: Javadoc Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/= Endpoint.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Endpoi= nt.java 2009-04-14 18:00:58 UTC (rev 5033) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Endpoi= nt.java 2009-04-14 18:04:38 UTC (rev 5034) @@ -155,7 +155,9 @@ */ ResourceType getResourceType(URI uri); = - + /** + * Flags which can be passed in to listener registration methods. + */ enum ListenerFlag { = /** --===============5539510748369857988==-- From jboss-remoting-commits at lists.jboss.org Tue Apr 14 21:30:21 2009 Content-Type: multipart/mixed; boundary="===============7343364029245820581==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5035 - remoting2/branches/2.x/docs/guide/en. Date: Tue, 14 Apr 2009 21:30:20 -0400 Message-ID: <E1LttxE-0007Fh-9j@committer01.frg.pub.inap.atl.jboss.com> --===============7343364029245820581== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-14 21:30:20 -0400 (Tue, 14 Apr 2009) New Revision: 5035 Modified: remoting2/branches/2.x/docs/guide/en/chap9.xml Log: JBREM-1082: Added reference to Client.USE_ALL_PARAMETERS; (2) JBREM-1112: a= dded reference to FAILURE_DISCONNECT_TIMEOUT; (3) JBREM-1108: noted validat= orPingPeriod should be longer than validatorPingTimeout. Modified: remoting2/branches/2.x/docs/guide/en/chap9.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/docs/guide/en/chap9.xml 2009-04-14 18:04:38 UTC = (rev 5034) +++ remoting2/branches/2.x/docs/guide/en/chap9.xml 2009-04-15 01:30:20 UTC = (rev 5035) @@ -57,13 +57,46 @@ "validatorPingTimeout") - specifies the time, in milliseconds, allowed= for arrival of a response to a PING message. The default value is 1000.</p= ara> = = - <para>For more configuration parameters, see <xref - linkend=3D"section-interactions"/>.</para> + <para><emphasis role=3D"bold">FAILURE_DISCONNECT_TIMEOUT</emphasis> (a= ctual value + "failureDisconnectTimeout") - if the parameter "stopLeaseOnFailure" = + (see <xref linkend=3D"section-interactions"/>) is set to + "true", then "failureDisconnectTimeout" determines the disconnect time= out value + to be used by <classname>org.jboss.remoting.LeasePinger</classname> in= shutting + down. In particular, if "failureDisconnectTimeout" is set to "0", the= n = + <classname>LeasePinger</classname> will avoid any network i/o.</para> = - <para>Note, also, that <classname>ConnectionValidator</classname> crea= tes a + <para> Normally, the values for these parameters are obtained either f= rom + the <classname>Client</classname>'s configuration map or the metadata = map + passed to <methodname>addConnectionListener()</methodname>, with value= s in + the metadata map taking precedence. However, another relevant paramete= r is + defined in <classname>org.jboss.remoting.Client</classname>:</para> + = + <para><emphasis role=3D"bold">USE_ALL_PARAMS</emphasis> (actual value + "useAllParams") - this parameter is searched for in the + <classname>InvokerLocator</classname>, in the configuration map passed= to + the <classname>Client</classname>, and in the metadata map (in that or= der). + If the last occurrence found is set to "true", then parameter values a= re + first obtained from the <classname>InvokerLocator</classname>, followe= d by + the <classname>Client</classname>'s configuration map and the + metadata map.</para> + = + <para>Note that <classname>ConnectionValidator</classname> creates a client invoker to sends the PING messages, and it passes the metadata = map to configure the client invoker.</para> = + <para><emphasis role=3D"bold">NOTE.</emphasis> The default values of V= ALIDATOR_PING_PERIOD + and VALIDATOR_PING_TIMEOUT have often been found in practice to be too= small, increasing + the likelihood of spurious connection failures.</para> + = + <para><emphasis role=3D"bold">NOTE.</emphasis> It is important to set = VALIDATOR_PING_PERIOD + to a value greater than the value of VALIDATOR_PING_TIMEOUT. Doing so= gives the + <classname>ConnectionValidator</classname> a chance to notify all + <classname>ConnectionListener</classname>s, which might result in shut= ting down the + connection, before the next PING is sent.</para> + = + <para>For more configuration parameters, see <xref + linkend=3D"section-interactions"/>.</para> + = </section> = <section id=3D"section-server-side" xreflabel=3D"Server side monitoring"> --===============7343364029245820581==-- From jboss-remoting-commits at lists.jboss.org Tue Apr 14 21:31:36 2009 Content-Type: multipart/mixed; boundary="===============0763982638467157269==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5036 - remoting2/branches/2.2/docs/guide/en. Date: Tue, 14 Apr 2009 21:31:36 -0400 Message-ID: <E1LttyS-0007nk-8o@committer01.frg.pub.inap.atl.jboss.com> --===============0763982638467157269== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-14 21:31:36 -0400 (Tue, 14 Apr 2009) New Revision: 5036 Modified: remoting2/branches/2.2/docs/guide/en/chap8.xml Log: JBREM-1082: Added reference to Client.USE_ALL_PARAMETERS; (2) JBREM-1112: a= dded reference to FAILURE_DISCONNECT_TIMEOUT; (3) JBREM-1108: noted validat= orPingPeriod should be longer than validatorPingTimeout. Modified: remoting2/branches/2.2/docs/guide/en/chap8.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.2/docs/guide/en/chap8.xml 2009-04-15 01:30:20 UTC = (rev 5035) +++ remoting2/branches/2.2/docs/guide/en/chap8.xml 2009-04-15 01:31:36 UTC = (rev 5036) @@ -57,13 +57,46 @@ "validatorPingTimeout") - specifies the time, in milliseconds, allowed= for arrival of a response to a PING message. The default value is 1000.</p= ara> = = - <para>For more configuration parameters, see <xref - linkend=3D"section-interactions"/>.</para> + <para><emphasis role=3D"bold">FAILURE_DISCONNECT_TIMEOUT</emphasis> (a= ctual value + "failureDisconnectTimeout") - if the parameter "stopLeaseOnFailure" = + (see <xref linkend=3D"section-interactions"/>) is set to + "true", then "failureDisconnectTimeout" determines the disconnect time= out value + to be used by <classname>org.jboss.remoting.LeasePinger</classname> in= shutting + down. In particular, if "failureDisconnectTimeout" is set to "0", the= n = + <classname>LeasePinger</classname> will avoid any network i/o.</para> = - <para>Note, also, that <classname>ConnectionValidator</classname> crea= tes a + <para> Normally, the values for these parameters are obtained either f= rom + the <classname>Client</classname>'s configuration map or the metadata = map + passed to <methodname>addConnectionListener()</methodname>, with value= s in + the metadata map taking precedence. However, another relevant paramete= r is + defined in <classname>org.jboss.remoting.Client</classname>:</para> + = + <para><emphasis role=3D"bold">USE_ALL_PARAMS</emphasis> (actual value + "useAllParams") - this parameter is searched for in the + <classname>InvokerLocator</classname>, in the configuration map passed= to + the <classname>Client</classname>, and in the metadata map (in that or= der). + If the last occurrence found is set to "true", then parameter values a= re + first obtained from the <classname>InvokerLocator</classname>, followe= d by + the <classname>Client</classname>'s configuration map and the + metadata map.</para> + = + <para>Note that <classname>ConnectionValidator</classname> creates a client invoker to sends the PING messages, and it passes the metadata = map to configure the client invoker.</para> = + <para><emphasis role=3D"bold">NOTE.</emphasis> The default values of V= ALIDATOR_PING_PERIOD + and VALIDATOR_PING_TIMEOUT have often been found in practice to be too= small, increasing + the likelihood of spurious connection failures.</para> + = + <para><emphasis role=3D"bold">NOTE.</emphasis> It is important to set = VALIDATOR_PING_PERIOD + to a value greater than the value of VALIDATOR_PING_TIMEOUT. Doing so= gives the + <classname>ConnectionValidator</classname> a chance to notify all + <classname>ConnectionListener</classname>s, which might result in shut= ting down the + connection, before the next PING is sent.</para> + = + <para>For more configuration parameters, see <xref + linkend=3D"section-interactions"/>.</para> + = </section> = <section id=3D"section-server-side" xreflabel=3D"Server side monitoring"> @@ -94,7 +127,7 @@ = <programlisting>public void addConnectionListener(ConnectionListener l= istener)</programlisting> = - <para>or though the use of the + <para>or through the use of the <code>ServerInvoker.CONNECTION_LISTENER</code> parameter (actual value "connectionListener") in the <classname>Connector</classname>'s configuration map or XML configuration file. Once both criteria are me= t, the --===============0763982638467157269==-- From jboss-remoting-commits at lists.jboss.org Tue Apr 14 21:59:44 2009 Content-Type: multipart/mixed; boundary="===============6415419786866811947==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5037 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket. Date: Tue, 14 Apr 2009 21:59:44 -0400 Message-ID: <E1LtuPg-0007T8-Nh@committer01.frg.pub.inap.atl.jboss.com> --===============6415419786866811947== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-14 21:59:44 -0400 (Tue, 14 Apr 2009) New Revision: 5037 Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/Micr= oSocketClientInvoker.java Log: JBREM-1088: Added original exception as RuntimeException cause. Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/sock= et/MicroSocketClientInvoker.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/Mic= roSocketClientInvoker.java 2009-04-15 01:31:36 UTC (rev 5036) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/Mic= roSocketClientInvoker.java 2009-04-15 01:59:44 UTC (rev 5037) @@ -277,7 +277,7 @@ catch (Exception ex) { log.debug("Error setting up " + this, ex); - throw new RuntimeException(ex.getMessage()); + throw new RuntimeException(ex.getMessage(), ex); } = log.debug(this + " constructed"); --===============6415419786866811947==-- From jboss-remoting-commits at lists.jboss.org Tue Apr 14 22:00:56 2009 Content-Type: multipart/mixed; boundary="===============2757269726294183447==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5038 - remoting2/branches/2.2/src/main/org/jboss/remoting/transport/socket. Date: Tue, 14 Apr 2009 22:00:56 -0400 Message-ID: <E1LtuQq-0000Rt-7u@committer01.frg.pub.inap.atl.jboss.com> --===============2757269726294183447== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-14 22:00:56 -0400 (Tue, 14 Apr 2009) New Revision: 5038 Modified: remoting2/branches/2.2/src/main/org/jboss/remoting/transport/socket/Micr= oSocketClientInvoker.java Log: JBREM-1088: Added original exception as RuntimeException cause. Modified: remoting2/branches/2.2/src/main/org/jboss/remoting/transport/sock= et/MicroSocketClientInvoker.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.2/src/main/org/jboss/remoting/transport/socket/Mic= roSocketClientInvoker.java 2009-04-15 01:59:44 UTC (rev 5037) +++ remoting2/branches/2.2/src/main/org/jboss/remoting/transport/socket/Mic= roSocketClientInvoker.java 2009-04-15 02:00:56 UTC (rev 5038) @@ -255,7 +255,7 @@ catch (Exception ex) { log.error("Error setting up " + this, ex); - throw new RuntimeException(ex.getMessage()); + throw new RuntimeException(ex.getMessage(), ex); } = log.debug(this + " constructed"); --===============2757269726294183447==-- From jboss-remoting-commits at lists.jboss.org Wed Apr 15 00:37:18 2009 Content-Type: multipart/mixed; boundary="===============1728498448035851014==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5039 - remoting2/branches/2.2/src/main/org/jboss/remoting/ident. Date: Wed, 15 Apr 2009 00:37:17 -0400 Message-ID: <E1Ltws9-00009r-RA@committer01.frg.pub.inap.atl.jboss.com> --===============1728498448035851014== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-15 00:37:16 -0400 (Wed, 15 Apr 2009) New Revision: 5039 Modified: remoting2/branches/2.2/src/main/org/jboss/remoting/ident/Identity.java Log: JBREM-1104: Ported David Lloyd's fix to 2.2 branch. Modified: remoting2/branches/2.2/src/main/org/jboss/remoting/ident/Identity= .java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.2/src/main/org/jboss/remoting/ident/Identity.java = 2009-04-15 02:00:56 UTC (rev 5038) +++ remoting2/branches/2.2/src/main/org/jboss/remoting/ident/Identity.java = 2009-04-15 04:37:16 UTC (rev 5039) @@ -208,7 +208,10 @@ } catch(Exception ex) { - throw new RuntimeException("Exception creating identity: " + ex.g= etMessage()); + String type =3D ex.getClass().getName(); + final RuntimeException rex =3D new RuntimeException("Exception cr= eating identity: " + type + ": " + ex.getMessage()); + rex.setStackTrace(ex.getStackTrace()); + throw rex; } } = --===============1728498448035851014==-- From jboss-remoting-commits at lists.jboss.org Wed Apr 15 01:13:13 2009 Content-Type: multipart/mixed; boundary="===============2470018063423346770==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5040 - remoting2/branches/2.x/docs/guide/en. Date: Wed, 15 Apr 2009 01:13:04 -0400 Message-ID: <E1LtxQm-0000BH-VO@committer01.frg.pub.inap.atl.jboss.com> --===============2470018063423346770== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-15 01:13:04 -0400 (Wed, 15 Apr 2009) New Revision: 5040 Modified: remoting2/branches/2.x/docs/guide/en/chap5.xml Log: JBREM-1084: Added discussion of Client.USE_ALL_PARAMS. Modified: remoting2/branches/2.x/docs/guide/en/chap5.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/docs/guide/en/chap5.xml 2009-04-15 04:37:16 UTC = (rev 5039) +++ remoting2/branches/2.x/docs/guide/en/chap5.xml 2009-04-15 05:13:04 UTC = (rev 5040) @@ -3316,6 +3316,15 @@ <methodname>addListener()</methodname>. </para> = + <para><emphasis role=3D"bold">Note.</emphasis> Since release 2.5.1= , if the first instance + of the parameter <code>org.jboss.remoting.Client.USE_ALL_PARAMS<= /code> + (actual value "useAllParams") found successively in the <classna= me>InvokerLocator</classname>, the + <classname>Client</classname>'s configuration map, or the metada= ta map is set + to "true", then polled callbacks can be configured by parameters= in the = + <classname>InvokerLocator</classname> and <classname>Client</cla= ssname>'s = + configuration map as well as the metadata map passed to <methodn= ame>addListener()</methodname>. + </para> + = <para> If the client is in an environment where the server is not allow= ed to establish a network connection to the client (e.g. firewall rules @@ -5807,6 +5816,14 @@ javax.net.ssl.HandshakeCompletedListener implementation, which will be called on when ssl handshake completed with server.</para> = + <para><emphasis role=3D"bold">USE_ALL_PARAMS</emphasis> + (actual value is 'useAllParameters') - used by + <classname>org.jboss.remoting.ConnectionValidator</classname> and + <classname>org.jboss.remoting.callback.CallbackPoller</classname> to + determine if configuration parameters should be retrieved from the + <classname>InvokerLocator</classname> or the = + <classname>Client</classname>'s configuration map.</para> + = <para></para> = <para>The following three configuration properties are only useful when --===============2470018063423346770==-- From jboss-remoting-commits at lists.jboss.org Wed Apr 15 01:13:46 2009 Content-Type: multipart/mixed; boundary="===============8022665384756132575==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5041 - remoting2/branches/2.2/docs/guide/en. Date: Wed, 15 Apr 2009 01:13:39 -0400 Message-ID: <E1LtxRL-0000C6-3t@committer01.frg.pub.inap.atl.jboss.com> --===============8022665384756132575== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-15 01:13:38 -0400 (Wed, 15 Apr 2009) New Revision: 5041 Modified: remoting2/branches/2.2/docs/guide/en/chap5.xml Log: JBREM-1084: Added discussion of Client.USE_ALL_PARAMS. Modified: remoting2/branches/2.2/docs/guide/en/chap5.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.2/docs/guide/en/chap5.xml 2009-04-15 05:13:04 UTC = (rev 5040) +++ remoting2/branches/2.2/docs/guide/en/chap5.xml 2009-04-15 05:13:38 UTC = (rev 5041) @@ -3712,6 +3712,15 @@ <methodname>addListener()</methodname>. </para> = + <para><emphasis role=3D"bold">Note.</emphasis> Since release 2.2.2= .SP12, if the first instance + of the parameter <code>org.jboss.remoting.Client.USE_ALL_PARAMS<= /code> + (actual value "useAllParams") found successively in the <classna= me>InvokerLocator</classname>, the + <classname>Client</classname>'s configuration map, or the metada= ta map is set + to "true", then polled callbacks can be configured by parameters= in the = + <classname>InvokerLocator</classname> and <classname>Client</cla= ssname>'s = + configuration map as well as the metadata map passed to <methodn= ame>addListener()</methodname>. + </para> + = <para> If the client is in an environment where the server is not allow= ed to establish a network connection to the client (e.g. firewall rules @@ -6005,6 +6014,14 @@ map passed to the Client constructor providing a ssl javax.net.ssl.HandshakeCompletedListener implementation, which will be called on when ssl handshake completed with server.</para> + = + <para><emphasis role=3D"bold">USE_ALL_PARAMS</emphasis> + (actual value is 'useAllParameters') - used by + <classname>org.jboss.remoting.ConnectionValidator</classname> and + <classname>org.jboss.remoting.callback.CallbackPoller</classname> to + determine if configuration parameters should be retrieved from the + <classname>InvokerLocator</classname> or the = + <classname>Client</classname>'s configuration map.</para> = <para></para> = --===============8022665384756132575==-- From jboss-remoting-commits at lists.jboss.org Wed Apr 15 01:29:33 2009 Content-Type: multipart/mixed; boundary="===============1605535997443635481==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5042 - remoting2/branches/2.x/docs/guide/en. Date: Wed, 15 Apr 2009 01:29:30 -0400 Message-ID: <E1Ltxgg-0006Lm-Od@committer01.frg.pub.inap.atl.jboss.com> --===============1605535997443635481== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-15 01:29:29 -0400 (Wed, 15 Apr 2009) New Revision: 5042 Modified: remoting2/branches/2.x/docs/guide/en/chap5.xml Log: JBREM-1113: Added discussion of ServerInvokerCallbackHandler.shutdown(). Modified: remoting2/branches/2.x/docs/guide/en/chap5.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/docs/guide/en/chap5.xml 2009-04-15 05:13:38 UTC = (rev 5041) +++ remoting2/branches/2.x/docs/guide/en/chap5.xml 2009-04-15 05:29:29 UTC = (rev 5042) @@ -2786,6 +2786,16 @@ </para> = <para> + <emphasis role=3D"bold">Note.</emphasis> As of release 2.5.1, + <classname>ServerInvokerCallbackHandler</classname> + has a new method, <methodname>shutdown()</methodname>, which can= be used by, for example, the + <classname>ServerInvocationHandler</classname> with which it is = registered, or by an = + <classname>org.jboss.remoting.ConnectionListener</classname> upo= n being informed of a = + connection failure, to clean up the <classname>ServerInvokerCall= backHandler</classname> + and references thereto. + </para> + = + <para> The client side of a callback connection is identified in one of= two ways, according to whether there is a callback <classname>Connector</classname> associated with the connection.= If --===============1605535997443635481==-- From jboss-remoting-commits at lists.jboss.org Wed Apr 15 01:31:11 2009 Content-Type: multipart/mixed; boundary="===============0002056513197512058==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5043 - remoting2/branches/2.x/docs/guide/en. Date: Wed, 15 Apr 2009 01:31:11 -0400 Message-ID: <E1LtxiJ-0006QA-8f@committer01.frg.pub.inap.atl.jboss.com> --===============0002056513197512058== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-15 01:31:11 -0400 (Wed, 15 Apr 2009) New Revision: 5043 Modified: remoting2/branches/2.x/docs/guide/en/master.xml Log: JBREM-1118: Updated version and release date. Modified: remoting2/branches/2.x/docs/guide/en/master.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/docs/guide/en/master.xml 2009-04-15 05:29:29 UTC= (rev 5042) +++ remoting2/branches/2.x/docs/guide/en/master.xml 2009-04-15 05:31:11 UTC= (rev 5043) @@ -24,9 +24,9 @@ <bookinfo> <title>JBoss Remoting Guide = - JBoss Remoting version 2.5.0.SP2 + JBoss Remoting version 2.5.1 = - November 20, 2008 + April 15, 2009 = --===============0002056513197512058==-- From jboss-remoting-commits at lists.jboss.org Wed Apr 15 01:40:19 2009 Content-Type: multipart/mixed; boundary="===============6104380659379987385==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5044 - remoting2/branches/2.x/docs/guide/en. Date: Wed, 15 Apr 2009 01:40:10 -0400 Message-ID: --===============6104380659379987385== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-15 01:40:09 -0400 (Wed, 15 Apr 2009) New Revision: 5044 Modified: remoting2/branches/2.x/docs/guide/en/chap1.xml Log: JBREM-1118: Added section for release 2.5.1. Modified: remoting2/branches/2.x/docs/guide/en/chap1.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/docs/guide/en/chap1.xml 2009-04-15 05:31:11 UTC = (rev 5043) +++ remoting2/branches/2.x/docs/guide/en/chap1.xml 2009-04-15 05:40:09 UTC = (rev 5044) @@ -189,6 +189,24 @@ support jdk 1.4. =
+ Release 2.5.1 + + + Security fix (JBREM-1116 "Remove SecurityUtility") + + + More flexible configuration (see org.jboss.remoting.= Client.USE_ALL_PARAMS) + + + Jars updated to conform to Application Server 5.1.0.CR1 + + + Multiple bug fixes. + + +
+ = +
Release 2.5.0.SP2 --===============6104380659379987385==-- From jboss-remoting-commits at lists.jboss.org Wed Apr 15 02:01:53 2009 Content-Type: multipart/mixed; boundary="===============5935919393902830607==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5045 - remoting2/branches/2.x/docs/guide/en. Date: Wed, 15 Apr 2009 02:01:52 -0400 Message-ID: --===============5935919393902830607== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-15 02:01:51 -0400 (Wed, 15 Apr 2009) New Revision: 5045 Modified: remoting2/branches/2.x/docs/guide/en/chap17.xml Log: JBREM-1118: Added release notes for 2.5.1. Modified: remoting2/branches/2.x/docs/guide/en/chap17.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/docs/guide/en/chap17.xml 2009-04-15 05:40:09 UTC= (rev 5044) +++ remoting2/branches/2.x/docs/guide/en/chap17.xml 2009-04-15 06:01:51 UTC= (rev 5045) @@ -69,7 +69,47 @@ =
Version 2.5 + + Release Notes - JBoss Remoting - Version 2.5.1 (Flounder)<= /bridgehead> = + Bug + = + * [JBREM-992] - Can't restart a Connector that uses SocketS= erverInvoker + * [JBREM-1069] - Make ConnectorValidator configure ping peri= od correctly + * [JBREM-1070] - Fix deadlock in ConnectionValidator + * [JBREM-1071] - IllegalStateException in ConnectorValidator= .run() + * [JBREM-1072] - Synchronize access to static maps in Marsha= lFactory + * [JBREM-1076] - SocketServerInvoker.processInvocation() sho= uld return if running =3D=3D false + * [JBREM-1081] - Fix NPE in ServerInvokerCallbackHandler + * [JBREM-1083] - Each Client creates a new invokerDestructio= nTimer + * [JBREM-1088] - MicroSocketClientInvoker(InvokerLocator loc= ator, Map configuration) ctor - not propagating exceptions (only message is= wrapped) + * [JBREM-1099] - Make MulticastDetector detection message se= nd buffer size configurable = + * [JBREM-1109] - Eliminate race in MicroRemoteClientInvoker.= getDataType() = + * [JBREM-1111] - CLONE [JBREM-851] - In LeasePinger replace = Timer if it has shut down = + * [JBREM-1112] - Potential race between ConnectionValidator = and ConnectionListener upon connection failure + * [JBREM-1113] - ServerInvokerCallbackHandlers leak when cli= ent doesn't shut down + = + Feature request + * [JBREM-1082] - Allow ConnectionValidator to access Invoker= Locator parameters + * [JBREM-1084] - Allow CallbackPoller to access Client and I= nvokerLocator parameters + * [JBREM-1102] - Make configuration map available to Marshal= Factory + * [JBREM-1114] - Update servlet transport to support JBossMe= ssaging + = + Release + = + * [JBREM-1118] - Release 2.5.1 = + = + Task + = + * [JBREM-139] - need automated test for servlet server invo= ker + * [JBREM-1085] - Reduce log level of ServerSocketWrapper.clo= se() log messages + * [JBREM-1103] - correct javadoc for Client.invokeOneway() + * [JBREM-1104] - Identity.get() should create a more meaning= ful RuntimeException message + * [JBREM-1108] - Warn against making ConnectionValidator.val= idatorPingPeriod shorter than ConnectionValidator.validatorPingTimeout + * [JBREM-1110] - InvokerLocator.getParameters() should not r= eturn null + * [JBREM-1115] - Update jars to match AS 5.1.0.CR1 + * [JBREM-1117] - Assure version compatibility with earlier v= ersions of Remoting + = Release Notes - JBoss Remoting - Version 2.5.0.SP2 (Flound= er) = Bug --===============5935919393902830607==-- From jboss-remoting-commits at lists.jboss.org Wed Apr 15 02:05:12 2009 Content-Type: multipart/mixed; boundary="===============3487565387923172038==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5046 - remoting2/branches/2.x/src/main/org/jboss/remoting. Date: Wed, 15 Apr 2009 02:05:08 -0400 Message-ID: --===============3487565387923172038== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-15 02:05:08 -0400 (Wed, 15 Apr 2009) New Revision: 5046 Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/ServerConfiguration.j= ava Log: JBREM-1118: Updated note about ServerConfiguration example in javadoc. Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/ServerConfigur= ation.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/ServerConfiguration.= java 2009-04-15 06:01:51 UTC (rev 5045) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/ServerConfiguration.= java 2009-04-15 06:05:08 UTC (rev 5046) @@ -36,7 +36,7 @@ * Connector. * = * For an example of the use of ServerConfiguration with the microcontaine= r, - * see the org.jboss.test.remoting.configuration package in the testsuite + * see the configuration file remoting-jboss-beans.xml in the server/defau= lt/deploy * directory of the JBoss Application Server 5.0.0. * = * @author Ron Sigal --===============3487565387923172038==-- From jboss-remoting-commits at lists.jboss.org Wed Apr 15 02:05:44 2009 Content-Type: multipart/mixed; boundary="===============5117809001049157535==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5047 - remoting2/branches/2.x/src/main/org/jboss/remoting. Date: Wed, 15 Apr 2009 02:05:44 -0400 Message-ID: --===============5117809001049157535== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-15 02:05:44 -0400 (Wed, 15 Apr 2009) New Revision: 5047 Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/Version.java Log: JBREM-1118: Updated version. Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/Version.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/Version.java 2009-04= -15 06:05:08 UTC (rev 5046) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/Version.java 2009-04= -15 06:05:44 UTC (rev 5047) @@ -38,7 +38,7 @@ public static final byte VERSION_2 =3D 2; public static final byte VERSION_2_2 =3D 22; = - public static final String VERSION =3D "2.5.0.SP2 (Flounder)"; + public static final String VERSION =3D "2.5.1 (Flounder)"; private static final byte byteVersion =3D VERSION_2_2; private static byte defaultByteVersion =3D byteVersion; private static boolean performVersioning =3D true; --===============5117809001049157535==-- From jboss-remoting-commits at lists.jboss.org Wed Apr 15 02:08:04 2009 Content-Type: multipart/mixed; boundary="===============3938623891543057871==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5048 - remoting2/branches/2.x. Date: Wed, 15 Apr 2009 02:08:03 -0400 Message-ID: --===============3938623891543057871== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-15 02:08:03 -0400 (Wed, 15 Apr 2009) New Revision: 5048 Modified: remoting2/branches/2.x/build.xml Log: (1) JBREM-1118: Updated version; (2) JBREM-1117: added 2.5.0.SP2 to version= ing tests. Modified: remoting2/branches/2.x/build.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/build.xml 2009-04-15 06:05:44 UTC (rev 5047) +++ remoting2/branches/2.x/build.xml 2009-04-15 06:08:03 UTC (rev 5048) @@ -225,9 +225,9 @@ - + - + = @@ -2123,8 +2123,26 @@ - = + = + + + + + + + + + + + + + + + + + = + --===============3938623891543057871==-- From jboss-remoting-commits at lists.jboss.org Wed Apr 15 02:12:37 2009 Content-Type: multipart/mixed; boundary="===============8189929025957149375==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5049 - remoting2/tags. Date: Wed, 15 Apr 2009 02:12:37 -0400 Message-ID: --===============8189929025957149375== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-15 02:12:37 -0400 (Wed, 15 Apr 2009) New Revision: 5049 Added: remoting2/tags/2.5.1/ Log: Copied: remoting2/tags/2.5.1 (from rev 5048, remoting2/branches/2.x) --===============8189929025957149375==-- From jboss-remoting-commits at lists.jboss.org Wed Apr 15 20:26:11 2009 Content-Type: multipart/mixed; boundary="===============5031628716669335307==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5050 - in remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3: spi and 1 other directory. Date: Wed, 15 Apr 2009 20:26:11 -0400 Message-ID: --===============5031628716669335307== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: david.lloyd(a)jboss.com Date: 2009-04-15 20:26:11 -0400 (Wed, 15 Apr 2009) New Revision: 5050 Added: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Abs= tractEndpointConnectionAcceptor.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/End= pointConnectionAcceptor.java Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Endpoin= t.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Endpoin= tImpl.java Log: Add a mechanism for an endpoint to receive incoming connections Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/= Endpoint.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Endpoi= nt.java 2009-04-15 06:12:37 UTC (rev 5049) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Endpoi= nt.java 2009-04-16 00:26:11 UTC (rev 5050) @@ -9,6 +9,7 @@ import org.jboss.remoting3.spi.RequestHandler; import org.jboss.remoting3.spi.RequestHandlerSource; import org.jboss.remoting3.spi.ConnectionProvider; +import org.jboss.remoting3.spi.EndpointConnectionAcceptor; import org.jboss.xnio.IoFuture; = /** @@ -145,7 +146,7 @@ * @param provider the provider * @return a handle which may be used to remove the registration */ - SimpleCloseable addConnectionProvider(String uriScheme, ConnectionProv= ider provider); + EndpointConnectionAcceptor addConnectionProvider(String uriScheme, Con= nectionProvider provider); = /** * Get the type of resource specified by the given URI. If the type c= annot be determined, returns {@link org.jboss.remoting3.ResourceType#UNKNOW= N UNKNOWN}. Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/= EndpointImpl.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Endpoi= ntImpl.java 2009-04-15 06:12:37 UTC (rev 5049) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Endpoi= ntImpl.java 2009-04-16 00:26:11 UTC (rev 5050) @@ -48,6 +48,8 @@ import org.jboss.remoting3.spi.RequestHandlerSource; import org.jboss.remoting3.spi.Cancellable; import org.jboss.remoting3.spi.EndpointConnection; +import org.jboss.remoting3.spi.EndpointConnectionAcceptor; +import org.jboss.remoting3.spi.AbstractEndpointConnectionAcceptor; import org.jboss.xnio.IoFuture; import org.jboss.xnio.IoUtils; import org.jboss.xnio.WeakCloseable; @@ -382,7 +384,7 @@ return futureEndpointConn; } = - public SimpleCloseable addConnectionProvider(final String uriScheme, f= inal ConnectionProvider provider) { + public EndpointConnectionAcceptor addConnectionProvider(final String u= riScheme, final ConnectionProvider provider) { final SecurityManager sm =3D System.getSecurityManager(); if (sm !=3D null) { sm.checkPermission(ADD_CONNECTION_PROVIDER_PERM); @@ -391,10 +393,14 @@ if (connectionProviders.putIfAbsent(key, provider) !=3D null) { throw new IllegalArgumentException("Provider already registere= d for scheme \"" + uriScheme + "\""); } - return new AbstractSimpleCloseable(executor) { + return new AbstractEndpointConnectionAcceptor(executor) { protected void closeAction() throws IOException { connectionProviders.remove(key, provider); } + + public void accept(final EndpointConnection connection) { + // todo - add the endpoint connection to the endpoint regi= stry; notify listeners; etc. + } }; } = Added: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi= /AbstractEndpointConnectionAcceptor.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Ab= stractEndpointConnectionAcceptor.java (rev 0) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Ab= stractEndpointConnectionAcceptor.java 2009-04-16 00:26:11 UTC (rev 5050) @@ -0,0 +1,37 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2009, 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.remoting3.spi; + +import java.util.concurrent.Executor; + +public abstract class AbstractEndpointConnectionAcceptor extends AbstractH= andleableCloseable implements EndpointConnectio= nAcceptor { + + /** + * Basic constructor. + * + * @param executor the executor used to execute the close notification= handlers + */ + protected AbstractEndpointConnectionAcceptor(final Executor executor) { + super(executor); + } +} Added: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi= /EndpointConnectionAcceptor.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/En= dpointConnectionAcceptor.java (rev 0) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/En= dpointConnectionAcceptor.java 2009-04-16 00:26:11 UTC (rev 5050) @@ -0,0 +1,32 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2009, 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.remoting3.spi; + +import org.jboss.remoting3.HandleableCloseable; + +/** + * + */ +public interface EndpointConnectionAcceptor extends HandleableCloseable { + void accept(EndpointConnection connection); +} --===============5031628716669335307==-- From jboss-remoting-commits at lists.jboss.org Wed Apr 15 21:03:34 2009 Content-Type: multipart/mixed; boundary="===============5870572062920025395==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5051 - in remoting-mc-int/trunk: metadata/src/main/java/org/jboss and 3 other directories. Date: Wed, 15 Apr 2009 21:03:32 -0400 Message-ID: --===============5870572062920025395== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: david.lloyd(a)jboss.com Date: 2009-04-15 21:03:32 -0400 (Wed, 15 Apr 2009) New Revision: 5051 Added: remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/ remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadat= a/ Removed: remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting/ remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadat= a/ Modified: remoting-mc-int/trunk/build.xml remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadat= a/ClientMetaData.java remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadat= a/ClientSourceMetaData.java remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadat= a/LocalServiceMetaData.java remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadat= a/LocateServiceMetaData.java remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadat= a/RemoteServiceMetaData.java remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadat= a/RemotingHelper.java remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadat= a/RemotingMetaData.java remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metadat= a/ServiceListenerMetaData.java remoting-mc-int/trunk/metadata/src/main/resources/META-INF/jboss-remotin= g_3_0.xsd remoting-mc-int/trunk/metadata/src/main/resources/META-INF/remoting-depl= oyer-beans.xml Log: Package rename... Modified: remoting-mc-int/trunk/build.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting-mc-int/trunk/build.xml 2009-04-16 00:26:11 UTC (rev 5050) +++ remoting-mc-int/trunk/build.xml 2009-04-16 01:03:32 UTC (rev 5051) @@ -61,7 +61,7 @@ - + = @@ -70,7 +70,7 @@ - + = Copied: remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3 (f= rom rev 4796, remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoti= ng) Copied: remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/me= tadata (from rev 5050, remoting-mc-int/trunk/metadata/src/main/java/org/jbo= ss/remoting/metadata) Modified: remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/= metadata/ClientMetaData.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting/metadat= a/ClientMetaData.java 2009-04-16 00:26:11 UTC (rev 5050) +++ remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metada= ta/ClientMetaData.java 2009-04-16 01:03:32 UTC (rev 5051) @@ -20,7 +20,7 @@ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ = -package org.jboss.remoting.metadata; +package org.jboss.remoting3.metadata; = import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlAttribute; Modified: remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/= metadata/ClientSourceMetaData.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting/metadat= a/ClientSourceMetaData.java 2009-04-16 00:26:11 UTC (rev 5050) +++ remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metada= ta/ClientSourceMetaData.java 2009-04-16 01:03:32 UTC (rev 5051) @@ -20,7 +20,7 @@ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ = -package org.jboss.remoting.metadata; +package org.jboss.remoting3.metadata; = import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlType; Modified: remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/= metadata/LocalServiceMetaData.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting/metadat= a/LocalServiceMetaData.java 2009-04-16 00:26:11 UTC (rev 5050) +++ remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metada= ta/LocalServiceMetaData.java 2009-04-16 01:03:32 UTC (rev 5051) @@ -20,7 +20,7 @@ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ = -package org.jboss.remoting.metadata; +package org.jboss.remoting3.metadata; = import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlAttribute; Modified: remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/= metadata/LocateServiceMetaData.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting/metadat= a/LocateServiceMetaData.java 2009-04-16 00:26:11 UTC (rev 5050) +++ remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metada= ta/LocateServiceMetaData.java 2009-04-16 01:03:32 UTC (rev 5051) @@ -20,7 +20,7 @@ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ = -package org.jboss.remoting.metadata; +package org.jboss.remoting3.metadata; = import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlAttribute; Modified: remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/= metadata/RemoteServiceMetaData.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting/metadat= a/RemoteServiceMetaData.java 2009-04-16 00:26:11 UTC (rev 5050) +++ remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metada= ta/RemoteServiceMetaData.java 2009-04-16 01:03:32 UTC (rev 5051) @@ -20,7 +20,7 @@ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ = -package org.jboss.remoting.metadata; +package org.jboss.remoting3.metadata; = import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlAttribute; Modified: remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/= metadata/RemotingHelper.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting/metadat= a/RemotingHelper.java 2009-04-16 00:26:11 UTC (rev 5050) +++ remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metada= ta/RemotingHelper.java 2009-04-16 01:03:32 UTC (rev 5051) @@ -20,17 +20,16 @@ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ = -package org.jboss.remoting.metadata; +package org.jboss.remoting3.metadata; = -import org.jboss.remoting.spi.RequestHandlerSource; -import org.jboss.remoting.spi.Handle; -import org.jboss.remoting.spi.RequestHandler; -import org.jboss.remoting.Endpoint; -import org.jboss.remoting.RequestListener; -import org.jboss.remoting.LocalServiceConfiguration; -import org.jboss.remoting.Client; -import org.jboss.remoting.SimpleCloseable; -import org.jboss.remoting.RemoteServiceConfiguration; +import org.jboss.remoting3.spi.RequestHandlerSource; +import org.jboss.remoting3.spi.Handle; +import org.jboss.remoting3.spi.RequestHandler; +import org.jboss.remoting3.Endpoint; +import org.jboss.remoting3.RequestListener; +import org.jboss.remoting3.LocalServiceConfiguration; +import org.jboss.remoting3.Client; +import org.jboss.remoting3.SimpleCloseable; import org.jboss.xnio.IoUtils; import java.io.IOException; = @@ -47,7 +46,7 @@ config.setGroupName(groupName); config.setServiceType(serviceType); config.setMetric(metric); - return endpoint.registerService(config); + return endpoint.bindLocalService(config); } = public static Client createClient(final Endpoint endpoint= , final RequestHandlerSource handlerSource, final Class requestClass, fi= nal Class replyClass) throws IOException { Modified: remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/= metadata/RemotingMetaData.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting/metadat= a/RemotingMetaData.java 2009-04-16 00:26:11 UTC (rev 5050) +++ remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metada= ta/RemotingMetaData.java 2009-04-16 01:03:32 UTC (rev 5051) @@ -1,4 +1,4 @@ -package org.jboss.remoting.metadata; +package org.jboss.remoting3.metadata; = import java.io.Serializable; import java.util.ArrayList; @@ -8,10 +8,9 @@ import org.jboss.beans.metadata.spi.BeanMetaDataFactory; import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder; import org.jboss.beans.metadata.api.annotations.Inject; -import org.jboss.remoting.core.util.CollectionUtil; -import org.jboss.remoting.Endpoint; -import org.jboss.remoting.ServiceListener; -import org.jboss.remoting.spi.RequestHandlerSource; +import org.jboss.remoting3.Endpoint; +import org.jboss.remoting3.ServiceRegistrationListener; +import org.jboss.remoting3.spi.RequestHandlerSource; import org.jboss.xb.annotations.JBossXmlSchema; = import javax.xml.bind.annotation.XmlElement; @@ -126,7 +125,7 @@ try { final ClassLoader classLoader =3D getClassLoader(); final String endpoint =3D this.endpoint =3D=3D null ? "default= -remoting-endpoint" : this.endpoint; - final List metaDataList =3D CollectionUtil.array= List(); + final List metaDataList =3D new ArrayList(); for (LocalServiceMetaData localService : localServices) { BeanMetaDataBuilder builder =3D BeanMetaDataBuilder.create= Builder(localService.getName()); builder.setFactoryClass(RemotingHelper.class.getName()); @@ -179,7 +178,7 @@ BeanMetaDataBuilder builder =3D BeanMetaDataBuilder.create= Builder(serviceListener.getName()); builder.setFactory(builder.createInject(endpoint)); builder.setFactoryMethod("addServiceListener"); - builder.addConstructorParameter(ServiceListener.class.getN= ame(), builder.createInject(serviceListener.getListenerBean())); + builder.addConstructorParameter(ServiceRegistrationListene= r.class.getName(), builder.createInject(serviceListener.getListenerBean())); builder.addConstructorParameter(boolean.class.getName(), B= oolean.valueOf(serviceListener.isOnlyNew())); builder.setStop("close"); metaDataList.add(builder.getBeanMetaData()); Modified: remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/= metadata/ServiceListenerMetaData.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting/metadat= a/ServiceListenerMetaData.java 2009-04-16 00:26:11 UTC (rev 5050) +++ remoting-mc-int/trunk/metadata/src/main/java/org/jboss/remoting3/metada= ta/ServiceListenerMetaData.java 2009-04-16 01:03:32 UTC (rev 5051) @@ -20,7 +20,7 @@ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ = -package org.jboss.remoting.metadata; +package org.jboss.remoting3.metadata; = import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlAttribute; Modified: remoting-mc-int/trunk/metadata/src/main/resources/META-INF/jboss-= remoting_3_0.xsd =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting-mc-int/trunk/metadata/src/main/resources/META-INF/jboss-remoti= ng_3_0.xsd 2009-04-16 00:26:11 UTC (rev 5050) +++ remoting-mc-int/trunk/metadata/src/main/resources/META-INF/jboss-remoti= ng_3_0.xsd 2009-04-16 01:03:32 UTC (rev 5051) @@ -59,5 +59,22 @@ = + + + + + + + + + + + + + + + + + Modified: remoting-mc-int/trunk/metadata/src/main/resources/META-INF/remoti= ng-deployer-beans.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting-mc-int/trunk/metadata/src/main/resources/META-INF/remoting-dep= loyer-beans.xml 2009-04-16 00:26:11 UTC (rev 5050) +++ remoting-mc-int/trunk/metadata/src/main/resources/META-INF/remoting-dep= loyer-beans.xml 2009-04-16 01:03:32 UTC (rev 5051) @@ -6,7 +6,7 @@ - org.jboss.remoting.metadata.RemotingMetaData + org.jboss.remoting3.metadata.RemotingMetaData jboss-remoting.xml true @@ -15,7 +15,7 @@ = - org.jboss.remoting.metadata.RemotingMetaData + org.jboss.remoting3.metadata.RemotingMetaData = @@ -24,4 +24,27 @@ + + + + + + + + + + + + + multiplex + + + + + + + + + + \ No newline at end of file --===============5870572062920025395==-- From jboss-remoting-commits at lists.jboss.org Thu Apr 16 01:03:23 2009 Content-Type: multipart/mixed; boundary="===============6361935374705672459==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5052 - remoting2/branches/2.x/docs. Date: Thu, 16 Apr 2009 01:03:18 -0400 Message-ID: --===============6361935374705672459== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-16 01:03:17 -0400 (Thu, 16 Apr 2009) New Revision: 5052 Modified: remoting2/branches/2.x/docs/README.txt Log: JBREM-1118: Added section for 2.5.1. Modified: remoting2/branches/2.x/docs/README.txt =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/docs/README.txt 2009-04-16 01:03:32 UTC (rev 505= 1) +++ remoting2/branches/2.x/docs/README.txt 2009-04-16 05:03:17 UTC (rev 505= 2) @@ -1,5 +1,5 @@ -JBoss Remoting 2.4.0.Beta1 -January 31, 2008 +JBoss Remoting 2.5.1 +April 15, 2009 = This distribution of JBoss Remoting contains the following directories: = @@ -41,6 +41,47 @@ = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D +Release Notes - JBoss Remoting - Version 2.5.1 (Flounder) - Text format +Bug + + * [JBREM-992] - Can't restart a Connector that uses SocketServerInvoker + * [JBREM-1069] - Make ConnectorValidator configure ping period correct= ly + * [JBREM-1070] - Fix deadlock in ConnectionValidator + * [JBREM-1071] - IllegalStateException in ConnectorValidator.run() + * [JBREM-1072] - Synchronize access to static maps in MarshalFactory + * [JBREM-1076] - SocketServerInvoker.processInvocation() should return= if running =3D=3D false + * [JBREM-1081] - Fix NPE in ServerInvokerCallbackHandler + * [JBREM-1083] - Each Client creates a new invokerDestructionTimer + * [JBREM-1088] - MicroSocketClientInvoker(InvokerLocator locator, Map = configuration) ctor - not propagating exceptions (only message is wrapped) + * [JBREM-1099] - Make MulticastDetector detection message send buffer = size configurable + * [JBREM-1109] - Eliminate race in MicroRemoteClientInvoker.getDataTyp= e() + * [JBREM-1111] - CLONE [JBREM-851] - In LeasePinger replace Timer if i= t has shut down + * [JBREM-1112] - Potential race between ConnectionValidator and Connec= tionListener upon connection failure + * [JBREM-1113] - ServerInvokerCallbackHandlers leak when client doesn'= t shut down + * [JBREM-1116] - Remove SecurityUtility + +Feature Request + + * [JBREM-1082] - Allow ConnectionValidator to access InvokerLocator pa= rameters + * [JBREM-1084] - Allow CallbackPoller to access Client and InvokerLoca= tor parameters + * [JBREM-1102] - Make configuration map available to MarshalFactory + * [JBREM-1114] - Update servlet transport to support JBossMessaging + +Release + + * [JBREM-1118] - Release 2.5.1 + +Task + + * [JBREM-139] - need automated test for servlet server invoker + * [JBREM-1085] - Reduce log level of ServerSocketWrapper.close() log m= essages + * [JBREM-1103] - Correct javadoc for Client.invokeOneway() + * [JBREM-1108] - Warn against making ConnectionValidator.validatorPing= Period shorter than ConnectionValidator.validatorPingTimeout + * [JBREM-1110] - InvokerLocator.getParameters() should not return null + * [JBREM-1115] - Update jars to match AS 5.1.0.CR1 + * [JBREM-1117] - Assure version compatibility with earlier versions of= Remoting + +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D Release Notes - JBoss Remoting - Version 2.5.0.SP2 (Flounder) Bug = --===============6361935374705672459==-- From jboss-remoting-commits at lists.jboss.org Thu Apr 16 01:08:40 2009 Content-Type: multipart/mixed; boundary="===============8271286731236314413==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5053 - remoting2/branches/2.x/docs/guide/en. Date: Thu, 16 Apr 2009 01:08:35 -0400 Message-ID: --===============8271286731236314413== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-16 01:08:34 -0400 (Thu, 16 Apr 2009) New Revision: 5053 Modified: remoting2/branches/2.x/docs/guide/en/master.xml Log: JBREM-1118: Changed copyright date to 2009. Modified: remoting2/branches/2.x/docs/guide/en/master.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/docs/guide/en/master.xml 2009-04-16 05:03:17 UTC= (rev 5052) +++ remoting2/branches/2.x/docs/guide/en/master.xml 2009-04-16 05:08:34 UTC= (rev 5053) @@ -35,7 +35,7 @@ = - 2008 JBoss, a division of Red Hat + 2009 JBoss, a division of Red Hat = . --===============8271286731236314413==-- From jboss-remoting-commits at lists.jboss.org Thu Apr 16 01:12:26 2009 Content-Type: multipart/mixed; boundary="===============6451932506426575548==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5054 - remoting2/branches/2.x. Date: Thu, 16 Apr 2009 01:12:21 -0400 Message-ID: --===============6451932506426575548== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-16 01:12:21 -0400 (Thu, 16 Apr 2009) New Revision: 5054 Modified: remoting2/branches/2.x/JBossORG-EULA.txt Log: JBREM-1118: Changed copyright date to 2009. Modified: remoting2/branches/2.x/JBossORG-EULA.txt =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/JBossORG-EULA.txt 2009-04-16 05:08:34 UTC (rev 5= 053) +++ remoting2/branches/2.x/JBossORG-EULA.txt 2009-04-16 05:12:21 UTC (rev 5= 054) @@ -99,9 +99,9 @@ State of North Carolina and of the United States, without regard to any co= nflict of laws provisions, = except that the United Nations Convention on the International Sale of Goo= ds shall not apply. = -Copyright 2006 Red Hat, Inc. All rights reserved. = +Copyright 2009 Red Hat, Inc. All rights reserved. = "JBoss" and the JBoss logo are registered trademarks of Red Hat, Inc. = All other trademarks are the property of their respective owners. = = - Page 1 of 1 18 October 2006 + Page 1 of 1 15 April 2009 = --===============6451932506426575548==-- From jboss-remoting-commits at lists.jboss.org Fri Apr 17 23:44:40 2009 Content-Type: multipart/mixed; boundary="===============5989019040203998807==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5055 - remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/socket/configuration. Date: Fri, 17 Apr 2009 23:44:38 -0400 Message-ID: --===============5989019040203998807== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-17 23:44:38 -0400 (Fri, 17 Apr 2009) New Revision: 5055 Modified: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/socke= t/configuration/SocketRetryConfigTestCase.java Log: JBREM-1078: Removed reference to MicroSocketClientInvoker.getNumberOfRetrie= s(). Modified: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transpor= t/socket/configuration/SocketRetryConfigTestCase.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/sock= et/configuration/SocketRetryConfigTestCase.java 2009-04-16 05:12:21 UTC (re= v 5054) +++ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/sock= et/configuration/SocketRetryConfigTestCase.java 2009-04-18 03:44:38 UTC (re= v 5055) @@ -39,7 +39,7 @@ public void testConfig() throws Throwable { InvokerLocator locator =3D new InvokerLocator("socket://localhost:88= 88" + "/?" + SocketClientInvoker.SO_TIMEOUT_FLAG + "=3D" + timeout + "&" + - "NumberOfRetries=3D" + s= ocketRetries + "&NumberOfCallRetries=3D" + callRetries); + "&NumberOfCallRetries=3D= " + callRetries); = Connector connector =3D new Connector("socket://localhost:8888"); Client client =3D new Client(locator); @@ -52,7 +52,6 @@ = SocketClientInvoker invoker =3D (SocketClientInvoker)client.getIn= voker(); = - assertEquals(socketRetries, invoker.getNumberOfRetries()); assertEquals(callRetries, invoker.getNumberOfCallRetries()); assertEquals(timeout, invoker.getTimeout()); assertEquals(Boolean.FALSE.booleanValue(), invoker.checkingConnec= tion()); --===============5989019040203998807==-- From jboss-remoting-commits at lists.jboss.org Fri Apr 17 23:45:55 2009 Content-Type: multipart/mixed; boundary="===============9207442386698209563==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5056 - remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/socket/configuration. Date: Fri, 17 Apr 2009 23:45:55 -0400 Message-ID: --===============9207442386698209563== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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/socke= t/configuration/SocketRetryConfigTestCase.java Log: JBREM-1078: Removed unused socketRetries variable. Modified: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transpor= t/socket/configuration/SocketRetryConfigTestCase.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/sock= et/configuration/SocketRetryConfigTestCase.java 2009-04-18 03:44:38 UTC (re= v 5055) +++ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/sock= et/configuration/SocketRetryConfigTestCase.java 2009-04-18 03:45:55 UTC (re= v 5056) @@ -32,7 +32,6 @@ */ public class SocketRetryConfigTestCase extends TestCase { - private int socketRetries =3D 5; private int callRetries =3D 6; private int timeout =3D 1000; = --===============9207442386698209563==-- From jboss-remoting-commits at lists.jboss.org Fri Apr 17 23:46:47 2009 Content-Type: multipart/mixed; boundary="===============5205127335330138330==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5057 - remoting2/branches/2.2/src/main/org/jboss/remoting/transport/socket. Date: Fri, 17 Apr 2009 23:46:47 -0400 Message-ID: --===============5205127335330138330== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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/Micr= oSocketClientInvoker.java Log: JBREM-1078: Removed umberOfRetries. Modified: remoting2/branches/2.2/src/main/org/jboss/remoting/transport/sock= et/MicroSocketClientInvoker.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.2/src/main/org/jboss/remoting/transport/socket/Mic= roSocketClientInvoker.java 2009-04-18 03:45:55 UTC (rev 5056) +++ remoting2/branches/2.2/src/main/org/jboss/remoting/transport/socket/Mic= roSocketClientInvoker.java 2009-04-18 03:46:46 UTC (rev 5057) @@ -83,13 +83,6 @@ public static final boolean TCP_NODELAY_DEFAULT =3D false; = /** - * Default maximum number of retries to get a valid socket from the* so= cket pool. This also - * translates to number of seconds will wait for connection to be retur= ned to connection pool - * before erroring. Default is 30. - */ - public static final int MAX_RETRIES =3D 30; - - /** * Default maximum number of times a invocation will be made when it ge= ts 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 =3D TCP_NODELAY_DEFAULT; clientSocketClassName =3D ClientSocketWrapper.class.getName(); clientSocketClass =3D null; - numberOfRetries =3D MAX_RETRIES; numberOfCallRetries =3D MAX_CALL_RETRIES; pool =3D null; maxPoolSize =3D 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 =3D MAX_RETRIES; - } - else - { - this.numberOfRetries =3D numberOfRetries; - } - } - - public int getNumberOfRetries() - { - return numberOfRetries; - } - public boolean isWrapInterruptedException() { return wrapInterruptedException; --===============5205127335330138330==-- From jboss-remoting-commits at lists.jboss.org Sat Apr 18 00:10:00 2009 Content-Type: multipart/mixed; boundary="===============8734180827013300280==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5058 - remoting2/branches/2.2/docs/guide/en. Date: Sat, 18 Apr 2009 00:09:58 -0400 Message-ID: --===============8734180827013300280== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- 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 fr= om the socket client invoker. The default is 50. = - numberOfRetries - number of - retries to get a socket from the pool. This basically equates to num= ber - 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 SocketExcep= tion - saying how long it waited for socket connection from pool). The defa= ult - is 30 (MAX_RETRIES) - numberOfCallRetries - numbe= r of - retries for making invocation. This is unrelated to numberOfRetries = in - that when this comes into play is after it has already received a cl= ient - 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 (wh= ich @@ -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 tryin= g to - get an available connection from the pool, waiting 1 second in bet= ween - 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. + 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. = - Once the socket client invoker goes get an available socket + Once the socket client invoker goes and get an available soc= ket connection from the pool, are not out of the woods yet. There is s= till a possibility that the socket connection returned, while still appearing to be valid, has timed out while sitting in the pool. So= if --===============8734180827013300280==-- From jboss-remoting-commits at lists.jboss.org Sat Apr 18 02:33:22 2009 Content-Type: multipart/mixed; boundary="===============2750593734775774867==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5059 - in remoting2/branches/2.2/src/tests/org/jboss/test/remoting/callback: leak and 1 other directory. Date: Sat, 18 Apr 2009 02:33:21 -0400 Message-ID: --===============2750593734775774867== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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/S= erverInvokerCallbackHandlerLeakTestCase.java Log: JBREM-1119: New unit tests. Added: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/callback/le= ak/ServerInvokerCallbackHandlerLeakTestCase.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- 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 Ron Sigal + * @version $Rev$ + *

+ * Copyright Apr 13, 2009 + *

+ */ +public class ServerInvokerCallbackHandlerLeakTestCase extends TestCase +{ + private static Logger log =3D Logger.getLogger(ServerInvokerCallbackHan= dlerLeakTestCase.class); + = + private static boolean firstTime =3D true; + private static int COUNT =3D 10; + private static Object lock =3D 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 =3D false; + Logger.getLogger("org.jboss.remoting").setLevel(Level.INFO); + Logger.getLogger("org.jboss.test.remoting").setLevel(Level.INFO); + String pattern =3D "[%d{ABSOLUTE}] [%t] %5p (%F:%L) - %m%n"; + PatternLayout layout =3D new PatternLayout(pattern); + ConsoleAppender consoleAppender =3D new ConsoleAppender(layout); + Logger.getRootLogger().addAppender(consoleAppender); = + } + TestConnectionListener.count =3D 0; + } + + = + public void tearDown() + { + } + = + = + public void testLeakWithCallbackHandlersListening() throws Throwable + { + doLeakTest(true); + } + = + = + public void testLeakWithoutCallbackHandlersListening() throws Throwable + { + doLeakTest(false); + } + = + = + public void doLeakTest(boolean registerCallbackListener) throws Throwab= le + { + log.info("entering " + getName()); + setupServer(registerCallbackListener); + = + // Get fields. + ServerInvoker serverInvoker =3D connector.getServerInvoker(); + Field field =3D ServerInvoker.class.getDeclaredField("connectionNoti= fier"); + field.setAccessible(true); + ConnectionNotifier connectionNotifier =3D (ConnectionNotifier) field= .get(serverInvoker); + field =3D ServerInvoker.class.getDeclaredField("callbackHandlers"); + field.setAccessible(true); + Map callbackHandlers =3D (Map) field.get(serverInvoker); + = + // Create client. + HashMap clientConfig =3D new HashMap(); + clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); + addExtraClientConfig(clientConfig); + Client client =3D null; + = + for (int i =3D 0; i < COUNT; i++) + { + client =3D 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 =3D new TestCallbackHandler(); + client.addListener(callbackHandler, null, null, true); + } + = + field =3D MicroRemoteClientInvoker.class.getDeclaredField("leasePing= er"); + field.setAccessible(true); + LeasePinger pinger =3D (LeasePinger) field.get(client.getInvoker()); + field =3D LeasePinger.class.getDeclaredField("timerTask"); + field.setAccessible(true); + TimerTask timerTask =3D (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 Exc= eption + { + host =3D InetAddress.getLocalHost().getHostAddress(); + port =3D PortUtil.findFreePort(host); + locatorURI =3D getTransport() + "://" + host + ":" + port; + locatorURI +=3D "/?leasing=3Dtrue"; + if (registerCallbackListener) + { + locatorURI +=3D "&" + ServerInvoker.REGISTER_CALLBACK_LISTENER + = "=3Dtrue"; + } + else + { + locatorURI +=3D "&" + ServerInvoker.REGISTER_CALLBACK_LISTENER + = "=3Dfalse"; + } + serverLocator =3D new InvokerLocator(locatorURI); + log.info("Starting remoting server with locator uri of: " + locatorU= RI); + HashMap config =3D new HashMap(); + config.put(InvokerLocator.FORCE_REMOTE, "true"); + addExtraServerConfig(config); + connector =3D new Connector(serverLocator, config); + connector.create(); + invocationHandler =3D new TestInvocationHandler(); + connector.addInvocationHandler("test", invocationHandler); + connector.start(); + connector.setLeasePeriod(2000); + TestConnectionListener listener =3D new TestConnectionListener(!regi= sterCallbackListener); + connector.addConnectionListener(listener); + } + = + = + protected void shutdownServer() throws Exception + { + if (connector !=3D null) + connector.stop(); + } + = + = + static class TestInvocationHandler implements ServerInvocationHandler + { + static public Set callbackHandlers =3D new HashSet(); + public void addListener(InvokerCallbackHandler callbackHandler) + { + callbackHandlers.add(callbackHandler); + } + public Object invoke(final InvocationRequest invocation) throws Thro= wable + { + 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 HandleCallbackE= xception + { + log.info("received callback"); + } = + } + = + = + static class TestConnectionListener implements ConnectionListener + { + static public int count; + boolean shutdownCallbackHandlers; + = + public TestConnectionListener(boolean shutdownCallbackHandlers) + { + this.shutdownCallbackHandlers =3D shutdownCallbackHandlers; + } + + public synchronized void handleConnectionException(Throwable throwab= le, Client client) + { + log.info("got connection exception"); + if(++count =3D=3D COUNT) + { + if (shutdownCallbackHandlers) + { + Iterator it =3D TestInvocationHandler.callbackHandlers.iter= ator(); + while (it.hasNext()) + { + ServerInvokerCallbackHandler callbackHandler =3D (Server= InvokerCallbackHandler) it.next(); + callbackHandler.shutdown(); + log.info("shut down: " + callbackHandler); + } + TestInvocationHandler.callbackHandlers.clear(); + } + synchronized(lock) + { + lock.notify(); + } + } + } = + } +} \ No newline at end of file --===============2750593734775774867==-- From jboss-remoting-commits at lists.jboss.org Sat Apr 18 02:33:43 2009 Content-Type: multipart/mixed; boundary="===============6653971786478900984==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5060 - remoting2/branches/2.2/src/main/org/jboss/remoting. Date: Sat, 18 Apr 2009 02:33:42 -0400 Message-ID: --===============6653971786478900984== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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.ja= va Log: JBREM-1119: Use copies of lists to avoid ConcurrentModificationException. = Modified: remoting2/branches/2.2/src/main/org/jboss/remoting/ConnectionNoti= fier.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.2/src/main/org/jboss/remoting/ConnectionNotifier.j= ava 2009-04-18 06:33:21 UTC (rev 5059) +++ remoting2/branches/2.2/src/main/org/jboss/remoting/ConnectionNotifier.j= ava 2009-04-18 06:33:42 UTC (rev 5060) @@ -47,14 +47,17 @@ Client client =3D new Client(new InvokerLocator(locatorurl), requ= estPayload); client.setSessionId(clientSessionId); = + ArrayList localListeners =3D null; synchronized (listeners) { - Iterator it =3D listeners.iterator(); - while (it.hasNext()) - { - ((ConnectionListener) it.next()).handleConnectionException(= null, client); - } + localListeners =3D new ArrayList(listeners); } + = + Iterator it =3D localListeners.iterator(); + while (it.hasNext()) + { + ((ConnectionListener) it.next()).handleConnectionException(nul= l, client); + } } catch(Exception e) { @@ -74,14 +77,17 @@ client.setSessionId(clientSessionId); ClientDisconnectedException ex =3D new ClientDisconnectedExceptio= n(); = + ArrayList localListeners =3D null; synchronized (listeners) { - Iterator it =3D listeners.iterator(); - while (it.hasNext()) - { - ((ConnectionListener) it.next()).handleConnectionException(= ex, client); - } + localListeners =3D new ArrayList(listeners); } + = + Iterator it =3D localListeners.iterator(); + while (it.hasNext()) + { + ((ConnectionListener) it.next()).handleConnectionException(ex,= client); + } } catch(Exception e) { --===============6653971786478900984==-- From jboss-remoting-commits at lists.jboss.org Sat Apr 18 02:34:10 2009 Content-Type: multipart/mixed; boundary="===============6346650403544680043==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5061 - remoting2/branches/2.2/src/main/org/jboss/remoting/callback. Date: Sat, 18 Apr 2009 02:34:10 -0400 Message-ID: --===============6346650403544680043== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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/ServerInvoke= rCallbackHandler.java Log: JBREM-1119: Added shutdown() method. Modified: remoting2/branches/2.2/src/main/org/jboss/remoting/callback/Serve= rInvokerCallbackHandler.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.2/src/main/org/jboss/remoting/callback/ServerInvok= erCallbackHandler.java 2009-04-18 06:33:42 UTC (rev 5060) +++ remoting2/branches/2.2/src/main/org/jboss/remoting/callback/ServerInvok= erCallbackHandler.java 2009-04-18 06:34:10 UTC (rev 5061) @@ -81,6 +81,7 @@ = private SerializableStore callbackStore =3D null; private CallbackErrorHandler callbackErrorHandler =3D 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) th= rows Exception { + serverInvoker =3D owner; clientSessionId =3D invocation.getSessionId(); sessionId =3D 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 clien= t) { if (clientSessionId.equals(client.getSessionId())) { - destroy(); - log.debug(this + " shut down"); + shutdown(); } } = --===============6346650403544680043==-- From jboss-remoting-commits at lists.jboss.org Sat Apr 18 02:34:55 2009 Content-Type: multipart/mixed; boundary="===============0107027812434870177==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5062 - remoting2/branches/2.2/src/main/org/jboss/remoting. Date: Sat, 18 Apr 2009 02:34:54 -0400 Message-ID: --===============0107027812434870177== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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 shutdownCall= backHandler(). Modified: remoting2/branches/2.2/src/main/org/jboss/remoting/ServerInvoker.= java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.2/src/main/org/jboss/remoting/ServerInvoker.java 2= 009-04-18 06:34:10 UTC (rev 5061) +++ remoting2/branches/2.2/src/main/org/jboss/remoting/ServerInvoker.java 2= 009-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 =3D null; - = - if (singleHandler !=3D null) - { - handler =3D singleHandler; - } - else - { = - if (subsystem !=3D null) - { - handler =3D (ServerInvocationHandler)handlers.get(subsys= tem.toUpperCase()); - } - else - { - // subsystem not specified, so will hope for a default o= ne being set - if (!handlers.isEmpty()) - { - if (trace) { log.trace(this + " handling invocation w= ith no subsystem explicitely specified, using the default handler"); } - handler =3D (ServerInvocationHandler)handlers.values(= ).iterator().next(); - } - } - } + ServerInvocationHandler handler =3D findInvocationHandler(subs= ystem); = if (param instanceof InternalInvocation) { @@ -1506,6 +1485,14 @@ ServerInvokerCallbackHandler callbackHandler =3D removeCallbackHa= ndler(invocation); if(callbackHandler !=3D null) { + if (registerCallbackListeners) + { +// connectionNotifier.removeListener(callbackHandler); + removeConnectionListener(callbackHandler); + } + = + callbackHandler.destroy(); + = if(handler =3D=3D null) { throw new InvalidConfigurationException( @@ -1513,15 +1500,10 @@ "registered. Please add via xml configuration or via th= e Connector's " + "addInvocationHandler() method."); } - if (registerCallbackListeners) - { - connectionNotifier.removeListener(callbackHandler); - } + = handler.removeListener(callbackHandler); = if(trace) { log.trace("ServerInvoker (" + this + ") removing s= erver 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 =3D=3D 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 (optiona= l) must be supplied as " + @@ -1636,7 +1618,34 @@ } return result; } + = + protected ServerInvocationHandler findInvocationHandler(String subsyste= m) + { + ServerInvocationHandler handler =3D null; = + if (singleHandler !=3D null) + { + handler =3D singleHandler; + } + else + { = + if (subsystem !=3D null) + { + handler =3D (ServerInvocationHandler)handlers.get(subsystem.to= UpperCase()); + } + else + { + // subsystem not specified, so will hope for a default one bei= ng set + if (!handlers.isEmpty()) + { + if (trace) { log.trace(this + " handling invocation with no= subsystem explicitely specified, using the default handler"); } + handler =3D (ServerInvocationHandler)handlers.values().iter= ator().next(); + } + } + } + return handler; + } + = /** * Called prior to an invocation. * TODO is sending in the arg appropriate? @@ -1865,7 +1874,7 @@ return callbackHandler; } = - private ServerInvokerCallbackHandler removeCallbackHandler(InvocationRe= quest invocation) + public ServerInvokerCallbackHandler removeCallbackHandler(InvocationReq= uest invocation) { String id =3D ServerInvokerCallbackHandler.getId(invocation); ServerInvokerCallbackHandler callbackHandler =3D null; @@ -1876,6 +1885,25 @@ } return callbackHandler; } + = + public void shutdownCallbackHandler(ServerInvokerCallbackHandler callba= ckHandler, InvocationRequest invocation) + { + removeCallbackHandler(invocation); + if (registerCallbackListeners) + { + removeConnectionListener(callbackHandler); + } + ServerInvocationHandler handler =3D findInvocationHandler(invocation= .getSessionId()); + if (handler !=3D null) + { + handler.removeListener(callbackHandler); + if(trace) { log.trace(this + " removing server callback handler "= + callbackHandler + "."); } + } + else + { + log.debug(this + " cannot remove " + callbackHandler + ": associa= ted ServerInvocationHandler not longer exists"); + } + } = // Inner classes ------------------------------------------------------= -------------------------- = --===============0107027812434870177==-- From jboss-remoting-commits at lists.jboss.org Sat Apr 18 23:44:19 2009 Content-Type: multipart/mixed; boundary="===============1166691186293460664==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5063 - remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/socket/oneway. Date: Sat, 18 Apr 2009 23:44:19 -0400 Message-ID: --===============1166691186293460664== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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/socke= t/oneway/OnewayInvocationTestCase.java Log: JBREM-1078: Removed references to MicroSocketClientInvoker.setNumberOfRetri= es(). Modified: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transpor= t/socket/oneway/OnewayInvocationTestCase.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/sock= et/oneway/OnewayInvocationTestCase.java 2009-04-18 06:34:54 UTC (rev 5062) +++ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/sock= et/oneway/OnewayInvocationTestCase.java 2009-04-19 03:44:19 UTC (rev 5063) @@ -98,7 +98,6 @@ Client client =3D new Client(locator, clientConfig); client.connect(); MicroSocketClientInvoker invoker =3D (MicroSocketClientInvoker) clie= nt.getInvoker(); - invoker.setNumberOfRetries(3); = int i =3D 0; try @@ -144,7 +143,6 @@ Client client =3D new Client(locator, clientConfig); client.connect(); MicroSocketClientInvoker invoker =3D (MicroSocketClientInvoker) clie= nt.getInvoker(); - invoker.setNumberOfRetries(3); = int i =3D 0; try --===============1166691186293460664==-- From jboss-remoting-commits at lists.jboss.org Sun Apr 19 00:29:55 2009 Content-Type: multipart/mixed; boundary="===============4616566031759779781==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5064 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket. Date: Sun, 19 Apr 2009 00:29:55 -0400 Message-ID: --===============4616566031759779781== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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/Serv= erThread.java Log: JBREM-1123: Added shutdownImmediately(). Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/sock= et/ServerThread.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/Ser= verThread.java 2009-04-19 03:44:19 UTC (rev 5063) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/Ser= verThread.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 =3D true; = + try + { + if (socketWrapper !=3D null) + { + String desc =3D 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 pro= cess on next invocation * request. If is set to true, will send an ACK to client to verify cl= ient is still connected --===============4616566031759779781==-- From jboss-remoting-commits at lists.jboss.org Sun Apr 19 00:30:18 2009 Content-Type: multipart/mixed; boundary="===============2480624236427815131==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5065 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket. Date: Sun, 19 Apr 2009 00:30:18 -0400 Message-ID: --===============2480624236427815131== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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/Sock= etServerInvoker.java Log: JBREM-1123: Added immediateShutdown property. Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/sock= et/SocketServerInvoker.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/Soc= ketServerInvoker.java 2009-04-19 04:29:54 UTC (rev 5064) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/Soc= ketServerInvoker.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 =3D MAX_POOL_SIZE_DEFAULT; protected LRUPool clientpool; protected LinkedList threadpool; + protected boolean immediateShutdown; = protected ServerSocketRefresh refreshThread; protected boolean newServerSocketFactory =3D false; @@ -457,7 +457,14 @@ { Object o =3D itr.next(); ServerThread st =3D (ServerThread) o; - st.shutdown(); + if (immediateShutdown) + { + st.shutdownImmediately(); + } + else + { + st.shutdown(); + } } = clientpool.flush(); @@ -471,7 +478,14 @@ for(int i =3D 0; i < threadsToShutdown; i++) { ServerThread thread =3D (ServerThread) threadpool.remove= First(); - 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 =3D immediateShutdown; + } + protected void configureSocket(Socket s) throws SocketException { s.setReuseAddress(getReuseAddress()); --===============2480624236427815131==-- From jboss-remoting-commits at lists.jboss.org Sun Apr 19 00:31:36 2009 Content-Type: multipart/mixed; boundary="===============4071564252301303890==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5066 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/socket/shutdown. Date: Sun, 19 Apr 2009 00:31:36 -0400 Message-ID: --===============4071564252301303890== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-19 00:31:35 -0400 (Sun, 19 Apr 2009) New Revision: 5066 Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/socke= t/shutdown/SocketImmediateShutdownTestCase.java Log: JBREM-1123: Added immediateShutdown property. Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/s= ocket/shutdown/SocketImmediateShutdownTestCase.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/sock= et/shutdown/SocketImmediateShutdownTestCase.java (r= ev 0) +++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/sock= et/shutdown/SocketImmediateShutdownTestCase.java 2009-04-19 04:31:35 UTC (r= ev 5066) @@ -0,0 +1,289 @@ +/* +* JBoss, Home of Professional Open Source +* Copyright 2009, JBoss Inc., and individual contributors as indicated +* by the @authors tag. See the copyright.txt in the distribution for a +* full listing of individual contributors. +* +* This is free software; you can redistribute it and/or modify it +* under the terms of the GNU Lesser General Public License as +* published by the Free Software Foundation; either version 2.1 of +* the License, or (at your option) any later version. +* +* This software is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this software; if not, write to the Free +* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA +* 02110-1301 USA, or see the FSF site: http://www.fsf.org. +*/ +package org.jboss.test.remoting.transport.socket.shutdown; + +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.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; + + +public class SocketImmediateShutdownTestCase extends TestCase +{ + private static Logger log =3D Logger.getLogger(SocketImmediateShutdownT= estCase.class); + = + private static boolean firstTime =3D true; + private static String SLEEP =3D "sleep"; + = + 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 =3D false; + Logger.getLogger("org.jboss.remoting").setLevel(Level.INFO); + Logger.getLogger("org.jboss.test.remoting").setLevel(Level.INFO); + String pattern =3D "[%d{ABSOLUTE}] [%t] %5p (%F:%L) - %m%n"; + PatternLayout layout =3D new PatternLayout(pattern); + ConsoleAppender consoleAppender =3D new ConsoleAppender(layout); + Logger.getRootLogger().addAppender(consoleAppender); = + } + } + + = + public void tearDown() + { + } + = + + public void testNoImmediateShutdownByDefault() throws Throwable + { + log.info("entering " + getName()); + = + // Start server. + setupServer(false, false); + = + // Create client. + InvokerLocator clientLocator =3D new InvokerLocator(locatorURI); + HashMap clientConfig =3D new HashMap(); + clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); + addExtraClientConfig(clientConfig); + Client client =3D new Client(clientLocator, clientConfig); + client.connect(); + log.info("client is connected"); + = + // Test connections. + assertEquals("abc", client.invoke("abc")); + log.info("connection is good"); + = + // Test immediate shutdown. + client.invokeOneway(SLEEP, null, true); + Thread.sleep(4000); + ServerInvoker serverInvoker =3D connector.getServerInvoker(); + new Thread() + { + public void run() + { + setName("shutdownServer:" + getName()); + try + { + shutdownServer(); + } + catch (Exception e) + { + e.printStackTrace(); + } = + } + }.start(); + Thread.sleep(4000); + log.info("testing server"); + assertTrue(serverInvoker.isStarted()); + Thread.sleep(8000); + assertFalse(serverInvoker.isStarted()); + log.info(getName() + " PASSES"); + } + = + = + public void testNoImmediateShutdownByConfig() throws Throwable + { + log.info("entering " + getName()); + = + // Start server. + setupServer(true, false); + = + // Create client. + InvokerLocator clientLocator =3D new InvokerLocator(locatorURI); + HashMap clientConfig =3D new HashMap(); + clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); + addExtraClientConfig(clientConfig); + Client client =3D new Client(clientLocator, clientConfig); + client.connect(); + log.info("client is connected"); + = + // Test connections. + assertEquals("abc", client.invoke("abc")); + log.info("connection is good"); + = + // Test immediate shutdown. + client.invokeOneway(SLEEP, null, true); + Thread.sleep(4000); + ServerInvoker serverInvoker =3D connector.getServerInvoker(); + new Thread() + { + public void run() + { + try + { + setName("shutdownServer:" + getName()); + shutdownServer(); + } + catch (Exception e) + { + e.printStackTrace(); + } = + } + }.start(); + Thread.sleep(4000); + log.info("testing server"); + assertTrue(serverInvoker.isStarted()); + Thread.sleep(8000); + assertFalse(serverInvoker.isStarted()); + log.info(getName() + " PASSES"); + } + = + = + public void testImmediateShutdown() throws Throwable + { + log.info("entering " + getName()); + = + // Start server. + setupServer(true, true); + = + // Create client. + InvokerLocator clientLocator =3D new InvokerLocator(locatorURI); + HashMap clientConfig =3D new HashMap(); + clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); + addExtraClientConfig(clientConfig); + Client client =3D new Client(clientLocator, clientConfig); + client.connect(); + log.info("client is connected"); + = + // Test connections. + assertEquals("abc", client.invoke("abc")); + log.info("connection is good"); + = + // Test immediate shutdown. + client.invokeOneway(SLEEP, null, true); + Thread.sleep(4000); + ServerInvoker serverInvoker =3D connector.getServerInvoker(); + new Thread() + { + public void run() + { + try + { + setName("shutdownServer:" + getName()); + shutdownServer(); + } + catch (Exception e) + { + e.printStackTrace(); + } = + } + }.start(); + Thread.sleep(4000); + log.info("testing server"); + assertFalse(serverInvoker.isStarted()); + log.info(getName() + " PASSES"); + } + = + = + protected String getTransport() + { + return "socket"; + } + = + = + protected void addExtraClientConfig(Map config) {} + protected void addExtraServerConfig(Map config) {} + = + + protected void setupServer(boolean setImmediateShutdown, boolean immedi= ateShutdown) throws Exception + { + host =3D InetAddress.getLocalHost().getHostAddress(); + port =3D PortUtil.findFreePort(host); + locatorURI =3D getTransport() + "://" + host + ":" + port; + String metadata =3D System.getProperty("remoting.metadata"); + if (metadata !=3D null) + { + locatorURI +=3D "/?" + metadata; + } + serverLocator =3D new InvokerLocator(locatorURI); + log.info("Starting remoting server with locator uri of: " + locatorU= RI); + HashMap config =3D new HashMap(); + if (setImmediateShutdown) + { + config.put("immediateShutdown", Boolean.toString(immediateShutdow= n)); + log.info("immediateShutdown: " + immediateShutdown); + } + config.put(InvokerLocator.FORCE_REMOTE, "true"); + addExtraServerConfig(config); + connector =3D new Connector(serverLocator, config); + connector.create(); + invocationHandler =3D new TestInvocationHandler(); + connector.addInvocationHandler("test", invocationHandler); + connector.start(); + } + = + = + protected void shutdownServer() throws Exception + { + if (connector !=3D null) + log.info("stopping Connector"); + connector.stop(); + log.info("stopped Connector"); + } + = + = + static class TestInvocationHandler implements ServerInvocationHandler + { + public void addListener(InvokerCallbackHandler callbackHandler) {} + public Object invoke(final InvocationRequest invocation) throws Thro= wable + { + String request =3D (String) invocation.getParameter(); + log.info("request: " + request); + if (SLEEP.equals(request)) + { + log.info("GOING TO SLEEP"); + Thread.sleep(12000); + log.info("WOKE UP"); + } + return invocation.getParameter(); + } + public void removeListener(InvokerCallbackHandler callbackHandler) {} + public void setMBeanServer(MBeanServer server) {} + public void setInvoker(ServerInvoker invoker) {} + } +} \ No newline at end of file --===============4071564252301303890==-- From jboss-remoting-commits at lists.jboss.org Sun Apr 19 00:34:35 2009 Content-Type: multipart/mixed; boundary="===============7573959724234156406==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5067 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/socket/shutdown. Date: Sun, 19 Apr 2009 00:34:34 -0400 Message-ID: --===============7573959724234156406== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-19 00:34:33 -0400 (Sun, 19 Apr 2009) New Revision: 5067 Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/socke= t/shutdown/SocketImmediateShutdownTestCase.java Log: JBREM-1123: Added javadoc. Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transpor= t/socket/shutdown/SocketImmediateShutdownTestCase.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/sock= et/shutdown/SocketImmediateShutdownTestCase.java 2009-04-19 04:31:35 UTC (r= ev 5066) +++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/sock= et/shutdown/SocketImmediateShutdownTestCase.java 2009-04-19 04:34:33 UTC (r= ev 5067) @@ -43,6 +43,15 @@ import org.jboss.remoting.transport.PortUtil; = = +/** + * Unit test for JBREM-1123. + * = + * @author Ron Sigal + * @version $Rev$ + *

+ * Copyright Apr 19, 2009 + *

+ */ public class SocketImmediateShutdownTestCase extends TestCase { private static Logger log =3D Logger.getLogger(SocketImmediateShutdownT= estCase.class); --===============7573959724234156406==-- From jboss-remoting-commits at lists.jboss.org Sun Apr 19 00:35:10 2009 Content-Type: multipart/mixed; boundary="===============1080247725364668216==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5068 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/bisocket. Date: Sun, 19 Apr 2009 00:35:10 -0400 Message-ID: --===============1080247725364668216== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-19 00:35:10 -0400 (Sun, 19 Apr 2009) New Revision: 5068 Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/bisoc= ket/BisocketImmediateShutdownTestCase.java Log: JBREM-1123: New unit test. Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/b= isocket/BisocketImmediateShutdownTestCase.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/biso= cket/BisocketImmediateShutdownTestCase.java (rev 0) +++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/biso= cket/BisocketImmediateShutdownTestCase.java 2009-04-19 04:35:10 UTC (rev 50= 68) @@ -0,0 +1,20 @@ +package org.jboss.test.remoting.transport.bisocket; + +import org.jboss.test.remoting.transport.socket.shutdown.SocketImmediateSh= utdownTestCase; + +/** + * Unit test for JBREM-1123. + * = + * @author Ron Sigal + * @version $Rev$ + *

+ * Copyright Apr 19, 2009 + *

+ */ +public class BisocketImmediateShutdownTestCase extends SocketImmediateShut= downTestCase +{ + protected String getTransport() + { + return "bisocket"; + } +} --===============1080247725364668216==-- From jboss-remoting-commits at lists.jboss.org Sun Apr 19 02:23:33 2009 Content-Type: multipart/mixed; boundary="===============0146989540259919877==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5070 - remoting2/branches/2.x/src/main/org/jboss/remoting. Date: Sun, 19 Apr 2009 02:23:32 -0400 Message-ID: --===============0146989540259919877== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-19 02:23:32 -0400 (Sun, 19 Apr 2009) New Revision: 5070 Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/Remoting.java Log: JBREM-1124: Added CONFIG_OVERRIDES_LOCATOR constant. Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/Remoting.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/Remoting.java 2009-0= 4-19 06:22:45 UTC (rev 5069) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/Remoting.java 2009-0= 4-19 06:23:32 UTC (rev 5070) @@ -100,4 +100,10 @@ * org.jboss.remoting.ServerInvoker.InvalidStateException to an org.jbo= ss.remoting.CannotConnectException. */ public static final String CHANGE_INVALID_STATE_TO_CANNOT_CONNECT =3D "= changeInvalidStateToCannotConnect"; + = + /** + * A flag indicating that AbstractInvoker should give priority to value= s in InvokerLocator over + * values in configuration map. + */ + public static final String CONFIG_OVERRIDES_LOCATOR =3D "configOverride= sLocator"; } --===============0146989540259919877==-- From jboss-remoting-commits at lists.jboss.org Sun Apr 19 02:24:27 2009 Content-Type: multipart/mixed; boundary="===============7800691651660065534==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5069 - remoting2/branches/2.x/src/main/org/jboss/remoting. Date: Sun, 19 Apr 2009 02:22:45 -0400 Message-ID: --===============7800691651660065534== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-19 02:22:45 -0400 (Sun, 19 Apr 2009) New Revision: 5069 Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/AbstractInvoker.java Log: JBREM-1124: Added option for configuration map parameter values to override= InvokerLocator parameter values. Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/AbstractInvoke= r.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/AbstractInvoker.java= 2009-04-19 04:35:10 UTC (rev 5068) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/AbstractInvoker.java= 2009-04-19 06:22:45 UTC (rev 5069) @@ -94,12 +94,22 @@ } this.locator =3D locator; = - if (configuration !=3D null) - this.configuration.putAll(configuration); + if (checkConfigOverridesLocator(locator, configuration)) + { + if (locator.getParameters() !=3D null) + this.configuration.putAll(locator.getParameters()); + = + if (configuration !=3D null) + this.configuration.putAll(configuration); + } + else + { + if (configuration !=3D null) + this.configuration.putAll(configuration); = - if (locator.getParameters() !=3D null) - this.configuration.putAll(locator.getParameters()); - + if (locator.getParameters() !=3D null) + this.configuration.putAll(locator.getParameters()); + } try { InvokerLocator loaderLocator =3D MarshallLoaderFactory.convertLoc= ator(locator); @@ -396,6 +406,44 @@ { return configuration; } + = + protected boolean checkConfigOverridesLocator(InvokerLocator locator, M= ap config) + { + boolean result =3D false; + if (config !=3D null) + { + Object o =3D config.get(Remoting.CONFIG_OVERRIDES_LOCATOR); + if (o !=3D null) + { + if (o instanceof String) + { + result =3D Boolean.valueOf((String) o).booleanValue(); + } + else + { + log.warn("value of " + Remoting.CONFIG_OVERRIDES_LOCATOR + = " in configuration Map should be a String instead of: " + o); + } + } + } + Map map =3D locator.parameters; + if (map !=3D null) + { + Object o =3D map.get(Remoting.CONFIG_OVERRIDES_LOCATOR); + if (o !=3D null) + { + if (o instanceof String) + { + result =3D Boolean.valueOf((String) o).booleanValue(); + } + else + { + log.warn("value of " + Remoting.CONFIG_OVERRIDES_LOCATOR + = " in " + locator + " should be a String"); + } + } + } + = + return result; + } = static public SocketFactory wrapSocketFactory(SocketFactory socketFacto= ry, Map config) { --===============7800691651660065534==-- From jboss-remoting-commits at lists.jboss.org Sun Apr 19 03:05:29 2009 Content-Type: multipart/mixed; boundary="===============8613047178783014893==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5071 - remoting2/branches/2.x/src/main/org/jboss/remoting. Date: Sun, 19 Apr 2009 03:05:28 -0400 Message-ID: --===============8613047178783014893== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-19 03:05:27 -0400 (Sun, 19 Apr 2009) New Revision: 5071 Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/ServerInvoker.java Log: JBREM-1124: Removed redundant parameter handling from constructor. Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/ServerInvoker.= java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/ServerInvoker.java 2= 009-04-19 06:23:32 UTC (rev 5070) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/ServerInvoker.java 2= 009-04-19 07:05:27 UTC (rev 5071) @@ -293,17 +293,6 @@ public ServerInvoker(InvokerLocator locator, Map configuration) { super(locator, configuration); - - if (configuration !=3D null) - { - this.configuration.putAll(configuration); - } - - Map locatorParams =3D locator.getParameters(); - if(locatorParams !=3D null) - { - this.configuration.putAll(locator.getParameters()); - } } = // Public -------------------------------------------------------------= -------------------------- --===============8613047178783014893==-- From jboss-remoting-commits at lists.jboss.org Sun Apr 19 03:06:14 2009 Content-Type: multipart/mixed; boundary="===============0557069970372810448==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5072 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/configuration. Date: Sun, 19 Apr 2009 03:06:14 -0400 Message-ID: --===============0557069970372810448== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-19 03:06:12 -0400 (Sun, 19 Apr 2009) New Revision: 5072 Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/configuration/C= onfigOverridesLocatorTestCase.java Log: JBREM-1124: New unit tests. Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/configurati= on/ConfigOverridesLocatorTestCase.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/configuration/= ConfigOverridesLocatorTestCase.java (rev 0) +++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/configuration/= ConfigOverridesLocatorTestCase.java 2009-04-19 07:06:12 UTC (rev 5072) @@ -0,0 +1,486 @@ +/* +* JBoss, Home of Professional Open Source +* Copyright 2009, 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.configuration; + +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.remoting.Client; +import org.jboss.remoting.InvocationRequest; +import org.jboss.remoting.InvokerLocator; +import org.jboss.remoting.Remoting; +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.Connector; +import org.jboss.remoting.transport.PortUtil; +import org.jboss.remoting.transport.socket.MicroSocketClientInvoker; +import org.jboss.remoting.transport.socket.SocketServerInvoker; + + +/** + * Unit test for JBREM-1124. + * = + * @author Ron Sigal + * @version $Rev$ + *

+ * Copyright Apr 19, 2009 + *

+ */ +public class ConfigOverridesLocatorTestCase extends TestCase +{ + private static Logger log =3D Logger.getLogger(ConfigOverridesLocatorTe= stCase.class); + = + private static boolean firstTime =3D true; + private static int LOCATOR_VALUE_CONNECTION_WAIT =3D 123; + private static String LOCATOR_VALUE_CONNECTION_WAIT_STRING =3D "123"; + private static int CONFIG_VALUE_CONNECTION_WAIT =3D 789; + private static String CONFIG_VALUE_CONNECTION_WAIT_STRING =3D "789"; + private static int LOCATOR_VALUE_BACKLOG =3D 321; + private static String LOCATOR_VALUE_BACKLOG_STRING =3D "321"; + private static int CONFIG_VALUE_BACKLOG =3D 987; + private static String CONFIG_VALUE_BACKLOG_STRING =3D "987"; + = + 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 =3D false; + Logger.getLogger("org.jboss.remoting").setLevel(Level.INFO); + Logger.getLogger("org.jboss.test.remoting").setLevel(Level.INFO); + String pattern =3D "[%d{ABSOLUTE}] [%t] %5p (%F:%L) - %m%n"; + PatternLayout layout =3D new PatternLayout(pattern); + ConsoleAppender consoleAppender =3D new ConsoleAppender(layout); + Logger.getRootLogger().addAppender(consoleAppender); = + } + } + + = + public void tearDown() + { + } + = + = + public void testDefault() throws Throwable + { + log.info("entering " + getName()); + = + // Start server. + setupServer(false, false, "", ""); + = + // Create client. + InvokerLocator clientLocator =3D new InvokerLocator(locatorURI); + HashMap clientConfig =3D new HashMap(); + clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); + clientConfig.put(MicroSocketClientInvoker.CONNECTION_WAIT, CONFIG_VA= LUE_CONNECTION_WAIT_STRING); + addExtraClientConfig(clientConfig); + log.info("client config: " + clientConfig); + Client client =3D new Client(clientLocator, clientConfig); + client.connect(); + log.info("client is connected"); + = + // Test connection. + assertEquals("abc", client.invoke("abc")); + log.info("connection is good"); + = + //Test configuration. + MicroSocketClientInvoker clientInvoker =3D (MicroSocketClientInvoker= ) client.getInvoker(); + SocketServerInvoker serverInvoker =3D (SocketServerInvoker) connecto= r.getServerInvoker(); + assertEquals(LOCATOR_VALUE_CONNECTION_WAIT, clientInvoker.getConnect= ionWait()); + assertEquals(LOCATOR_VALUE_BACKLOG, serverInvoker.getBacklog()); + = + client.disconnect(); + shutdownServer(); + log.info(getName() + " PASSES"); + } + = + = + public void testLocatorNoneConfigFalse() throws Throwable + { + log.info("entering " + getName()); + = + // Start server. + setupServer(false, true, "", "false"); + = + // Create client. + InvokerLocator clientLocator =3D new InvokerLocator(locatorURI); + HashMap clientConfig =3D new HashMap(); + clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); + clientConfig.put(MicroSocketClientInvoker.CONNECTION_WAIT, CONFIG_VA= LUE_CONNECTION_WAIT_STRING); + clientConfig.put(Remoting.CONFIG_OVERRIDES_LOCATOR, "false"); + addExtraClientConfig(clientConfig); + log.info("client config: " + clientConfig); + Client client =3D new Client(clientLocator, clientConfig); + client.connect(); + log.info("client is connected"); + = + // Test connection. + assertEquals("abc", client.invoke("abc")); + log.info("connection is good"); + = + //Test configuration. + MicroSocketClientInvoker clientInvoker =3D (MicroSocketClientInvoker= ) client.getInvoker(); + SocketServerInvoker serverInvoker =3D (SocketServerInvoker) connecto= r.getServerInvoker(); + assertEquals(LOCATOR_VALUE_CONNECTION_WAIT, clientInvoker.getConnect= ionWait()); + assertEquals(LOCATOR_VALUE_BACKLOG, serverInvoker.getBacklog()); + = + client.disconnect(); + shutdownServer(); + log.info(getName() + " PASSES"); + } + = + = + public void testLocatorNoneConfigTrue() throws Throwable + { + log.info("entering " + getName()); + = + // Start server. + setupServer(false, true, "", "true"); + = + // Create client. + InvokerLocator clientLocator =3D new InvokerLocator(locatorURI); + HashMap clientConfig =3D new HashMap(); + clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); + clientConfig.put(MicroSocketClientInvoker.CONNECTION_WAIT, CONFIG_VA= LUE_CONNECTION_WAIT_STRING); + clientConfig.put(Remoting.CONFIG_OVERRIDES_LOCATOR, "true"); + addExtraClientConfig(clientConfig); + log.info("client config: " + clientConfig); + Client client =3D new Client(clientLocator, clientConfig); + client.connect(); + log.info("client is connected"); + = + // Test connection. + assertEquals("abc", client.invoke("abc")); + log.info("connection is good"); + = + //Test configuration. + MicroSocketClientInvoker clientInvoker =3D (MicroSocketClientInvoker= ) client.getInvoker(); + SocketServerInvoker serverInvoker =3D (SocketServerInvoker) connecto= r.getServerInvoker(); + assertEquals(CONFIG_VALUE_CONNECTION_WAIT, clientInvoker.getConnecti= onWait()); + assertEquals(CONFIG_VALUE_BACKLOG, serverInvoker.getBacklog()); + = + client.disconnect(); + shutdownServer(); + log.info(getName() + " PASSES"); + } + = + = + public void testLocatorFalseConfigNone() throws Throwable + { + log.info("entering " + getName()); + = + // Start server. + setupServer(true, false, "false", ""); + = + // Create client. + InvokerLocator clientLocator =3D new InvokerLocator(locatorURI); + HashMap clientConfig =3D new HashMap(); + clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); + clientConfig.put(MicroSocketClientInvoker.CONNECTION_WAIT, CONFIG_VA= LUE_CONNECTION_WAIT_STRING); + clientConfig.put(Remoting.CONFIG_OVERRIDES_LOCATOR, "true"); + addExtraClientConfig(clientConfig); + log.info("client config: " + clientConfig); + Client client =3D new Client(clientLocator, clientConfig); + client.connect(); + log.info("client is connected"); + = + // Test connection. + assertEquals("abc", client.invoke("abc")); + log.info("connection is good"); + = + //Test configuration. + MicroSocketClientInvoker clientInvoker =3D (MicroSocketClientInvoker= ) client.getInvoker(); + SocketServerInvoker serverInvoker =3D (SocketServerInvoker) connecto= r.getServerInvoker(); + assertEquals(LOCATOR_VALUE_CONNECTION_WAIT, clientInvoker.getConnect= ionWait()); + assertEquals(LOCATOR_VALUE_BACKLOG, serverInvoker.getBacklog()); + = + client.disconnect(); + shutdownServer(); + log.info(getName() + " PASSES"); + } + = + = + public void testLocatorFalseConfigFalse() throws Throwable + { + log.info("entering " + getName()); + = + // Start server. + setupServer(true, true, "false", "false"); + = + // Create client. + InvokerLocator clientLocator =3D new InvokerLocator(locatorURI); + HashMap clientConfig =3D new HashMap(); + clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); + clientConfig.put(MicroSocketClientInvoker.CONNECTION_WAIT, CONFIG_VA= LUE_CONNECTION_WAIT_STRING); + clientConfig.put(Remoting.CONFIG_OVERRIDES_LOCATOR, "false"); + addExtraClientConfig(clientConfig); + log.info("client config: " + clientConfig); + Client client =3D new Client(clientLocator, clientConfig); + client.connect(); + log.info("client is connected"); + = + // Test connection. + assertEquals("abc", client.invoke("abc")); + log.info("connection is good"); + = + //Test configuration. + MicroSocketClientInvoker clientInvoker =3D (MicroSocketClientInvoker= ) client.getInvoker(); + SocketServerInvoker serverInvoker =3D (SocketServerInvoker) connecto= r.getServerInvoker(); + assertEquals(LOCATOR_VALUE_CONNECTION_WAIT, clientInvoker.getConnect= ionWait()); + assertEquals(LOCATOR_VALUE_BACKLOG, serverInvoker.getBacklog()); + = + client.disconnect(); + shutdownServer(); + log.info(getName() + " PASSES"); + } + = + = + public void testLocatorFalseConfigTrue() throws Throwable + { + log.info("entering " + getName()); + = + // Start server. + setupServer(true, true, "false", "true"); + = + // Create client. + InvokerLocator clientLocator =3D new InvokerLocator(locatorURI); + HashMap clientConfig =3D new HashMap(); + clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); + clientConfig.put(MicroSocketClientInvoker.CONNECTION_WAIT, CONFIG_VA= LUE_CONNECTION_WAIT_STRING); + clientConfig.put(Remoting.CONFIG_OVERRIDES_LOCATOR, "true"); + addExtraClientConfig(clientConfig); + log.info("client config: " + clientConfig); + Client client =3D new Client(clientLocator, clientConfig); + client.connect(); + log.info("client is connected"); + = + // Test connection. + assertEquals("abc", client.invoke("abc")); + log.info("connection is good"); + = + //Test configuration. + MicroSocketClientInvoker clientInvoker =3D (MicroSocketClientInvoker= ) client.getInvoker(); + SocketServerInvoker serverInvoker =3D (SocketServerInvoker) connecto= r.getServerInvoker(); + assertEquals(LOCATOR_VALUE_CONNECTION_WAIT, clientInvoker.getConnect= ionWait()); + assertEquals(LOCATOR_VALUE_BACKLOG, serverInvoker.getBacklog()); + = + client.disconnect(); + shutdownServer(); + log.info(getName() + " PASSES"); + } + = + = + public void testLocatorTrueConfigNone() throws Throwable + { + log.info("entering " + getName()); + = + // Start server. + setupServer(true, false, "true", ""); + = + // Create client. + InvokerLocator clientLocator =3D new InvokerLocator(locatorURI); + HashMap clientConfig =3D new HashMap(); + clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); + clientConfig.put(MicroSocketClientInvoker.CONNECTION_WAIT, CONFIG_VA= LUE_CONNECTION_WAIT_STRING); + addExtraClientConfig(clientConfig); + log.info("client config: " + clientConfig); + Client client =3D new Client(clientLocator, clientConfig); + client.connect(); + log.info("client is connected"); + = + // Test connection. + assertEquals("abc", client.invoke("abc")); + log.info("connection is good"); + = + //Test configuration. + MicroSocketClientInvoker clientInvoker =3D (MicroSocketClientInvoker= ) client.getInvoker(); + SocketServerInvoker serverInvoker =3D (SocketServerInvoker) connecto= r.getServerInvoker(); + assertEquals(CONFIG_VALUE_CONNECTION_WAIT, clientInvoker.getConnecti= onWait()); + assertEquals(CONFIG_VALUE_BACKLOG, serverInvoker.getBacklog()); + = + client.disconnect(); + shutdownServer(); + log.info(getName() + " PASSES"); + } + = + = + public void testLocatorTrueConfigFalse() throws Throwable + { + log.info("entering " + getName()); + = + // Start server. + setupServer(true, true, "true", "false"); + = + // Create client. + InvokerLocator clientLocator =3D new InvokerLocator(locatorURI); + HashMap clientConfig =3D new HashMap(); + clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); + clientConfig.put(MicroSocketClientInvoker.CONNECTION_WAIT, CONFIG_VA= LUE_CONNECTION_WAIT_STRING); + clientConfig.put(Remoting.CONFIG_OVERRIDES_LOCATOR, "false"); + addExtraClientConfig(clientConfig); + log.info("client config: " + clientConfig); + Client client =3D new Client(clientLocator, clientConfig); + client.connect(); + log.info("client is connected"); + = + // Test connection. + assertEquals("abc", client.invoke("abc")); + log.info("connection is good"); + = + //Test configuration. + MicroSocketClientInvoker clientInvoker =3D (MicroSocketClientInvoker= ) client.getInvoker(); + SocketServerInvoker serverInvoker =3D (SocketServerInvoker) connecto= r.getServerInvoker(); + assertEquals(CONFIG_VALUE_CONNECTION_WAIT, clientInvoker.getConnecti= onWait()); + assertEquals(CONFIG_VALUE_BACKLOG, serverInvoker.getBacklog()); + = + client.disconnect(); + shutdownServer(); + log.info(getName() + " PASSES"); + } + = + = + public void testLocatorTrueConfigTrue() throws Throwable + { + log.info("entering " + getName()); + = + // Start server. + setupServer(true, true, "true", "true"); + = + // Create client. + InvokerLocator clientLocator =3D new InvokerLocator(locatorURI); + HashMap clientConfig =3D new HashMap(); + clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); + clientConfig.put(MicroSocketClientInvoker.CONNECTION_WAIT, CONFIG_VA= LUE_CONNECTION_WAIT_STRING); + clientConfig.put(Remoting.CONFIG_OVERRIDES_LOCATOR, "true"); + addExtraClientConfig(clientConfig); + log.info("client config: " + clientConfig); + Client client =3D new Client(clientLocator, clientConfig); + client.connect(); + log.info("client is connected"); + = + // Test connection. + assertEquals("abc", client.invoke("abc")); + log.info("connection is good"); + = + //Test configuration. + MicroSocketClientInvoker clientInvoker =3D (MicroSocketClientInvoker= ) client.getInvoker(); + SocketServerInvoker serverInvoker =3D (SocketServerInvoker) connecto= r.getServerInvoker(); + assertEquals(CONFIG_VALUE_CONNECTION_WAIT, clientInvoker.getConnecti= onWait()); + assertEquals(CONFIG_VALUE_BACKLOG, serverInvoker.getBacklog()); + = + 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(boolean addToLocator, boolean addToConfig, S= tring locatorValue, String configValue) throws Exception + { + host =3D InetAddress.getLocalHost().getHostAddress(); + port =3D PortUtil.findFreePort(host); + locatorURI =3D getTransport() + "://" + host + ":" + port + "/?" + M= icroSocketClientInvoker.CONNECTION_WAIT + "=3D" + LOCATOR_VALUE_CONNECTION_= WAIT_STRING; + String metadata =3D System.getProperty("remoting.metadata"); + if (metadata !=3D null) + { + locatorURI +=3D "&" + metadata; + } + locatorURI +=3D "&" + "backlog=3D" + LOCATOR_VALUE_BACKLOG_STRING; + if (addToLocator) + { + locatorURI +=3D "&" + Remoting.CONFIG_OVERRIDES_LOCATOR + "=3D" += locatorValue; + } + serverLocator =3D new InvokerLocator(locatorURI); + log.info("Starting remoting server with locator uri of: " + locatorU= RI); + HashMap config =3D new HashMap(); + config.put(InvokerLocator.FORCE_REMOTE, "true"); + config.put("backlog", CONFIG_VALUE_BACKLOG_STRING); + addExtraServerConfig(config); + if (addToConfig) + { + config.put(Remoting.CONFIG_OVERRIDES_LOCATOR, configValue); + } + log.info("server config: " + config); + connector =3D new Connector(serverLocator, config); + connector.create(); + invocationHandler =3D new TestInvocationHandler(); + connector.addInvocationHandler("test", invocationHandler); + connector.start(); + } + = + = + protected void shutdownServer() throws Exception + { + if (connector !=3D null) + connector.stop(); + } + = + = + static class TestInvocationHandler implements ServerInvocationHandler + { + public void addListener(InvokerCallbackHandler callbackHandler) {} + public Object invoke(final InvocationRequest invocation) throws Thro= wable + { + 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 HandleCallbackE= xception + { + log.info("received callback"); + } = + } +} \ No newline at end of file --===============0557069970372810448==-- From jboss-remoting-commits at lists.jboss.org Mon Apr 20 22:41:41 2009 Content-Type: multipart/mixed; boundary="===============5355876809300018464==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5073 - remoting2/branches/2.x/docs/guide/en. Date: Mon, 20 Apr 2009 22:41:41 -0400 Message-ID: --===============5355876809300018464== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-20 22:41:41 -0400 (Mon, 20 Apr 2009) New Revision: 5073 Modified: remoting2/branches/2.x/docs/guide/en/chap5.xml Log: JBREM-1124: Added discussion of "configOverridesLocator" parameter. Modified: remoting2/branches/2.x/docs/guide/en/chap5.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/docs/guide/en/chap5.xml 2009-04-19 07:06:12 UTC = (rev 5072) +++ remoting2/branches/2.x/docs/guide/en/chap5.xml 2009-04-21 02:41:41 UTC = (rev 5073) @@ -90,7 +90,7 @@ locatorURI +=3D params; InvokerLocator locator =3D new InvokerLocator(locatorURI); HashMap config =3D new HashMap(); -config.put(ServerInvoker.TIMEOUT, 120000); +config.put(ServerInvoker.TIMEOUT, "120000"); config.put(ServerInvoker.SERVER_SOCKET_FACTORY, new MyServerSocketFactory(= )); Connector connector =3D new Connector(locator, config); connector.create(); @@ -119,7 +119,7 @@ locatorURI +=3D params; InvokerLocator locator =3D new InvokerLocator(locatorURI); HashMap config =3D new HashMap(); -config.put(ServerInvoker.TIMEOUT, 120000); +config.put(ServerInvoker.TIMEOUT, "120000"); Connector connector =3D new Connector(locator, config); connector.create(); ServerInvoker serverInvoker =3D connector.getServerInvoker(); @@ -144,7 +144,7 @@ above.
= HashMap config =3D new HashMap(); -config.put(ServerInvoker.TIMEOUT, 120000); +config.put(ServerInvoker.TIMEOUT, "120000"); Connector connector =3D new Connector(config); = // Set xml configuration element. @@ -189,7 +189,7 @@ examples above.
= HashMap config =3D new HashMap(); -config.put(ServerInvoker.TIMEOUT, 120000); +config.put(ServerInvoker.TIMEOUT, "120000"); Connector connector =3D new Connector(config); = // Create ServerConfiguration object for socket transport @@ -496,7 +496,7 @@ locatorURI +=3D params; InvokerLocator locator =3D new InvokerLocator(locatorURI); HashMap config =3D new HashMap(); -config.put(ServerInvoker.TIMEOUT, 360000); +config.put(ServerInvoker.TIMEOUT, "360000"); config.put(Remoting.CUSTOM_SOCKET_FACTORY, new MySocketFactory()); Client client =3D new Client(locator, config); client.connect(); @@ -520,17 +520,51 @@ locatorURI +=3D params; InvokerLocator locator =3D new InvokerLocator(locatorURI); HashMap config =3D new HashMap(); -config.put(ServerInvoker.TIMEOUT, 360000); +config.put(ServerInvoker.TIMEOUT, "360000"); Client client =3D new Client(locator, config); client.connect(); SocketFactory sf =3D new MySocketFactory(); ClientInvoker clientInvoker =3D client.getInvoker(); -clientInvoker.setSocketFactory(sf); +clientInvoker.setSocketFactory(sf); + = Note. The Client creates the client invoker during the = call to Client.connect(), so this option only wo= rks after that method has been called. + = + Note. Preference is given t= o values + in the InvokerLocator. For example, in + = + String locatorURI =3D "socket://test.somedomain.com:= 8084/?clientMaxPoolSize=3D10"; +InvokerLocator locator =3D new InvokerLocator(locatorURI); +HashMap config =3D new HashMap(); +config.put("clientMaxPoolSize", "20"); +Client client =3D new Client(locator, config); + + = + the value of the variable clientMaxPoolSize would= be set to 10. + As of release 2.5.2, that behavior can be reversed by setting the pa= rameter + org.jboss.remoting.Remoting.CONFIG_OVERRIDES_LOCATOR (a= ctual + value "configOverridesLocator") to true. As always, in determining = the + value of the variable configOverridesLocator, preferenc= e is + given to the InvokerLocator. But if the valu= e of + "configOverridesLocator" is set to true in the InvokerLoc= ator, + or if "configOverridesLocator" is absent from the = + InvokerLocator but it is set to "true" in + the configuration map, then preference will be given to values in + the configuration map. For example, in + + String locatorURI =3D "socket://test.somedomain.com:= 8084/?clientMaxPoolSize=3D10"; +InvokerLocator locator =3D new InvokerLocator(locatorURI); +HashMap config =3D new HashMap(); +config.put("clientMaxPoolSize", "20"); +config.put("configOverridesLocator", "true"); +Client client =3D new Client(locator, config); + + = + the value of the variable clientMaxPoolSize would= be set to 20. + =
= @@ -5953,6 +5987,12 @@ java.security.AccessController.doPrivileged() calls.. = = + CONFIG_OVERRIDES_LOCATOR (act= ual value is + "configOverridesLocator") - key for indicating that parameter values f= ound + in the configuration map passed to an org.jboss.remoting.Cl= ient + constructor should take precedence over values found in the = + InvokerLocator. = + =
=
--===============5355876809300018464==-- From jboss-remoting-commits at lists.jboss.org Tue Apr 21 01:28:51 2009 Content-Type: multipart/mixed; boundary="===============8658502128037851694==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5074 - remoting2/branches/2.x/src/main/org/jboss/remoting. Date: Tue, 21 Apr 2009 01:28:51 -0400 Message-ID: --===============8658502128037851694== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-21 01:28:50 -0400 (Tue, 21 Apr 2009) New Revision: 5074 Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/RemoteClientInvoker.j= ava Log: JBREM-1121: Added optional behavior for getting SocketFactory parameters fr= om InvokerLocator. Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/RemoteClientIn= voker.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/RemoteClientInvoker.= java 2009-04-21 02:41:41 UTC (rev 5073) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/RemoteClientInvoker.= java 2009-04-21 05:28:50 UTC (rev 5074) @@ -25,6 +25,8 @@ = import java.util.Map; = +import org.jboss.logging.Logger; + /** * This class extends the MicroRemoteClientInvoker and adds extra * functionality that can not be included in a J2ME envrionment, such as @@ -35,6 +37,8 @@ */ public abstract class RemoteClientInvoker extends MicroRemoteClientInvoker { + private static Logger log =3D Logger.getLogger(RemoteClientInvoker.clas= s); + = public RemoteClientInvoker(InvokerLocator locator) { super(locator); @@ -52,6 +56,35 @@ configuration.put(Remoting.SOCKET_FACTORY_CLASS_NAME, socketFa= ctoryClassName); } } - socketFactory =3D createSocketFactory(configuration); + if (useAllParams(getConfiguration())) + { + // getConfiguration() returns combination of InvokerLocator and c= onfiguration parameters. + socketFactory =3D createSocketFactory(getConfiguration()); + } + else + { + socketFactory =3D createSocketFactory(configuration); + } } + = + protected boolean useAllParams(Map configuration) + { + boolean result =3D false; + if (configuration !=3D null) + { + Object o =3D configuration.get(Remoting.USE_ALL_SOCKET_FACTORY_PA= RAMS); + if (o !=3D null) + { + if (o instanceof String) + { + result =3D Boolean.valueOf((String) o).booleanValue(); + } + else + { + log.warn("Value of " + Remoting.USE_ALL_SOCKET_FACTORY_PARA= MS + " must be a String: " + o); + } + } + } + return result; + } } --===============8658502128037851694==-- From jboss-remoting-commits at lists.jboss.org Tue Apr 21 01:29:34 2009 Content-Type: multipart/mixed; boundary="===============8667401594829597330==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5075 - remoting2/branches/2.x/src/main/org/jboss/remoting. Date: Tue, 21 Apr 2009 01:29:34 -0400 Message-ID: --===============8667401594829597330== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-21 01:29:34 -0400 (Tue, 21 Apr 2009) New Revision: 5075 Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/Remoting.java Log: JBREM-1121: Added USE_ALL_SOCKET_FACTORY_PARAMS constant. Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/Remoting.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/Remoting.java 2009-0= 4-21 05:28:50 UTC (rev 5074) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/Remoting.java 2009-0= 4-21 05:29:34 UTC (rev 5075) @@ -106,4 +106,10 @@ * values in configuration map. */ public static final String CONFIG_OVERRIDES_LOCATOR =3D "configOverride= sLocator"; + = + /** + * A flag indicating that RemoteClientInvoker should use parameters in = the InvokerLocator as + * well as the configuration map when creating a SocketFactory. + */ + public static final String USE_ALL_SOCKET_FACTORY_PARAMS =3D "useAllSoc= ketFactoryParams"; } --===============8667401594829597330==-- From jboss-remoting-commits at lists.jboss.org Tue Apr 21 01:34:17 2009 Content-Type: multipart/mixed; boundary="===============0595381505409152057==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5076 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/socketfactory. Date: Tue, 21 Apr 2009 01:34:17 -0400 Message-ID: --===============0595381505409152057== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-21 01:34:17 -0400 (Tue, 21 Apr 2009) New Revision: 5076 Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/socketfactory/S= ocketFactoryClassNameTestRoot.java Log: JBREM-1121: Added variation of existing test methods with "useAllSocketFact= oryParams=3Dtrue" in InvokerLocator. Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/socketfa= ctory/SocketFactoryClassNameTestRoot.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/socketfactory/= SocketFactoryClassNameTestRoot.java 2009-04-21 05:29:34 UTC (rev 5075) +++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/socketfactory/= SocketFactoryClassNameTestRoot.java 2009-04-21 05:34:17 UTC (rev 5076) @@ -1,3 +1,24 @@ +/* +* JBoss, Home of Professional Open Source +* Copyright 2008, 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.socketfactory; = import java.io.IOException; @@ -16,7 +37,6 @@ import org.apache.log4j.Level; import org.apache.log4j.Logger; import org.apache.log4j.PatternLayout; -import org.jboss.logging.XLevel; import org.jboss.remoting.AbstractInvoker; import org.jboss.remoting.Client; import org.jboss.remoting.InvocationRequest; @@ -57,7 +77,7 @@ if (firstTime) { firstTime =3D false; - Logger.getLogger("org.jboss.remoting").setLevel(XLevel.INFO); + Logger.getLogger("org.jboss.remoting").setLevel(Level.INFO); Logger.getLogger("org.jboss.test.remoting").setLevel(Level.INFO); String pattern =3D "[%d{ABSOLUTE}] [%t] %5p (%F:%L) - %m%n"; PatternLayout layout =3D new PatternLayout(pattern); @@ -77,11 +97,11 @@ log.info("entering " + getName()); = // Start server. - setupServer(); + setupServer(false); = // Create client. String clientLocatorURI =3D locatorURI; - clientLocatorURI +=3D "/?" + Remoting.SOCKET_FACTORY_CLASS_NAME + "= =3D" + getSocketFactoryClass().getName(); + clientLocatorURI +=3D "&" + Remoting.SOCKET_FACTORY_CLASS_NAME + "= =3D" + getSocketFactoryClass().getName(); InvokerLocator clientLocator =3D new InvokerLocator(clientLocatorURI= ); HashMap clientConfig =3D new HashMap(); clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); @@ -111,7 +131,7 @@ log.info("entering " + getName()); = // Start server. - setupServer(); + setupServer(false); = // Create client. InvokerLocator clientLocator =3D new InvokerLocator(locatorURI); @@ -139,6 +159,73 @@ } = = + public void testSocketFactoryClassNameInLocatorWithUseAllParams() throw= s Throwable + { + log.info("entering " + getName()); + = + // Start server. + setupServer(true); + = + // Create client. + String clientLocatorURI =3D locatorURI; + clientLocatorURI +=3D "&" + Remoting.SOCKET_FACTORY_CLASS_NAME + "= =3D" + getSocketFactoryClass().getName(); + InvokerLocator clientLocator =3D new InvokerLocator(clientLocatorURI= ); + HashMap clientConfig =3D new HashMap(); + clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); + addExtraClientConfig(clientConfig); + Client client =3D new Client(clientLocator, clientConfig); + client.connect(); + log.info("client is connected to " + clientLocatorURI); + = + // Test connections. + assertEquals("abc", client.invoke("abc")); + log.info("connection is good"); + = + // Verify client invoker is using configured SocketFactory. + AbstractInvoker invoker =3D (AbstractInvoker) client.getInvoker(); + SocketFactory socketFactory =3D invoker.getSocketFactory(); + log.info("SocketFactory: " + socketFactory); + assertTrue(getSocketFactoryClass().isInstance(socketFactory)); + + client.disconnect(); + shutdownServer(); + log.info(getName() + " PASSES"); + } + = + = + public void testSocketFactoryClassNameInConfigMapWithUseAllParams() thr= ows Throwable + { + log.info("entering " + getName()); + = + // Start server. + setupServer(true); + = + // Create client. + InvokerLocator clientLocator =3D new InvokerLocator(locatorURI); + HashMap clientConfig =3D new HashMap(); + clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); + clientConfig.put(Remoting.SOCKET_FACTORY_CLASS_NAME, getSocketFactor= yClass().getName()); + addExtraClientConfig(clientConfig); + Client client =3D new Client(clientLocator, clientConfig); + client.connect(); + log.info("client is connected"); + = + // Test connections. + assertEquals("abc", client.invoke("abc")); + log.info("connection is good"); + = + // Verify client invoker is using configured SocketFactory. + AbstractInvoker invoker =3D (AbstractInvoker) client.getInvoker(); + SocketFactory socketFactory =3D invoker.getSocketFactory(); + log.info("SocketFactory: " + socketFactory); + assertTrue(getSocketFactoryClass().isInstance(socketFactory)); + = + client.disconnect(); + shutdownServer(); + log.info(getName() + " PASSES"); + } + = + = protected abstract String getTransport(); = = @@ -152,11 +239,20 @@ protected void addExtraServerConfig(Map config) {} = = - protected void setupServer() throws Exception + protected void setupServer(boolean useAllParams) throws Exception { host =3D InetAddress.getLocalHost().getHostAddress(); port =3D PortUtil.findFreePort(host); - locatorURI =3D getTransport() + "://" + host + ":" + port; = + locatorURI =3D getTransport() + "://" + host + ":" + port + "/?x=3Dx= "; + String metadata =3D System.getProperty("remoting.metadata"); + if (metadata !=3D null) + { + locatorURI +=3D "&" + metadata; + } + if (useAllParams) + { + locatorURI +=3D "&" + Remoting.USE_ALL_SOCKET_FACTORY_PARAMS + "= =3Dtrue"; + } serverLocator =3D new InvokerLocator(locatorURI); log.info("Starting remoting server with locator uri of: " + locatorU= RI); HashMap config =3D new HashMap(); --===============0595381505409152057==-- From jboss-remoting-commits at lists.jboss.org Tue Apr 21 01:42:21 2009 Content-Type: multipart/mixed; boundary="===============5000199552999863464==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5077 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/socketfactory. Date: Tue, 21 Apr 2009 01:42:20 -0400 Message-ID: --===============5000199552999863464== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-21 01:42:20 -0400 (Tue, 21 Apr 2009) New Revision: 5077 Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/socketfactory/U= seAllSocketFactoryParamsTestCase.java Log: JBREM-1121: New unit tests. Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/socketfacto= ry/UseAllSocketFactoryParamsTestCase.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/socketfactory/= UseAllSocketFactoryParamsTestCase.java (rev 0) +++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/socketfactory/= UseAllSocketFactoryParamsTestCase.java 2009-04-21 05:42:20 UTC (rev 5077) @@ -0,0 +1,320 @@ +/* +* JBoss, Home of Professional Open Source +* Copyright 2009, 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.socketfactory; + +import java.io.IOException; +import java.net.InetAddress; +import java.net.Socket; +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.remoting.Client; +import org.jboss.remoting.InvocationRequest; +import org.jboss.remoting.InvokerLocator; +import org.jboss.remoting.Remoting; +import org.jboss.remoting.ServerInvocationHandler; +import org.jboss.remoting.ServerInvoker; +import org.jboss.remoting.callback.InvokerCallbackHandler; +import org.jboss.remoting.socketfactory.SocketCreationListener; +import org.jboss.remoting.transport.Connector; +import org.jboss.remoting.transport.PortUtil; + + +/** + * Unit tests for JBREM-1121. + * = + * @author Ron Sigal + * @version $Rev$ + *

+ * Copyright Apr 21, 2009 + *

+ */ +public class UseAllSocketFactoryParamsTestCase extends TestCase +{ + private static Logger log =3D Logger.getLogger(UseAllSocketFactoryParam= sTestCase.class); + = + private static boolean firstTime =3D 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 =3D false; + Logger.getLogger("org.jboss.remoting").setLevel(Level.INFO); + Logger.getLogger("org.jboss.test.remoting").setLevel(Level.INFO); + String pattern =3D "[%d{ABSOLUTE}] [%t] %5p (%F:%L) - %m%n"; + PatternLayout layout =3D new PatternLayout(pattern); + ConsoleAppender consoleAppender =3D new ConsoleAppender(layout); + Logger.getRootLogger().addAppender(consoleAppender); = + } + = + TestSocketCreationListener.called =3D false; + } + + = + public void tearDown() + { + } + = + = + public void testDefault() throws Throwable + { + log.info("entering " + getName()); + = + // Start server. + setupServer(false, null); + = + // Create client. + InvokerLocator clientLocator =3D new InvokerLocator(locatorURI); + HashMap clientConfig =3D new HashMap(); + clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); + addExtraClientConfig(clientConfig); + log.info("clientConfig: " + clientConfig); + Client client =3D new Client(clientLocator, clientConfig); + client.connect(); + log.info("client is connected"); + = + // Test connections. + assertEquals("abc", client.invoke("abc")); + log.info("connection is good"); + = + // Verify that TestSocketCreationListener was called. + assertFalse(TestSocketCreationListener.called); + = + client.disconnect(); + shutdownServer(); + log.info(getName() + " PASSES"); + } + = + = + public void testUseAllSocketFactoryParamsFalseInLocator() throws Throwa= ble + { + log.info("entering " + getName()); + = + // Start server. + setupServer(true, "false"); + = + // Create client. + InvokerLocator clientLocator =3D new InvokerLocator(locatorURI); + HashMap clientConfig =3D new HashMap(); + clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); + addExtraClientConfig(clientConfig); + log.info("clientConfig: " + clientConfig); + Client client =3D new Client(clientLocator, clientConfig); + client.connect(); + log.info("client is connected"); + = + // Test connections. + assertEquals("abc", client.invoke("abc")); + log.info("connection is good"); + = + // Verify that TestSocketCreationListener was called. + assertFalse(TestSocketCreationListener.called); + = + client.disconnect(); + shutdownServer(); + log.info(getName() + " PASSES"); + } + = + = + public void testUseAllSocketFactoryParamsFalseInConfig() throws Throwab= le + { + log.info("entering " + getName()); + = + // Start server. + setupServer(false, null); + = + // Create client. + InvokerLocator clientLocator =3D new InvokerLocator(locatorURI); + HashMap clientConfig =3D new HashMap(); + clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); + clientConfig.put(Remoting.USE_ALL_SOCKET_FACTORY_PARAMS, "false"); + addExtraClientConfig(clientConfig); + log.info("clientConfig: " + clientConfig); + Client client =3D new Client(clientLocator, clientConfig); + client.connect(); + log.info("client is connected"); + = + // Test connections. + assertEquals("abc", client.invoke("abc")); + log.info("connection is good"); + = + // Verify that TestSocketCreationListener was called. + assertFalse(TestSocketCreationListener.called); + = + client.disconnect(); + shutdownServer(); + log.info(getName() + " PASSES"); + } + = + = + public void testUseAllSocketFactoryParamsTrueInLocator() throws Throwab= le + { + log.info("entering " + getName()); + = + // Start server. + setupServer(true, "true"); + = + // Create client. + InvokerLocator clientLocator =3D new InvokerLocator(locatorURI); + HashMap clientConfig =3D new HashMap(); + clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); + addExtraClientConfig(clientConfig); + log.info("clientConfig: " + clientConfig); + Client client =3D new Client(clientLocator, clientConfig); + client.connect(); + log.info("client is connected"); + = + // Test connections. + assertEquals("abc", client.invoke("abc")); + log.info("connection is good"); + = + // Verify that TestSocketCreationListener was called. + assertTrue(TestSocketCreationListener.called); + = + client.disconnect(); + shutdownServer(); + log.info(getName() + " PASSES"); + } + = + = + public void testUseAllSocketFactoryParamsTrueInConfig() throws Throwable + { + log.info("entering " + getName()); + = + // Start server. + setupServer(false, null); + = + // Create client. + InvokerLocator clientLocator =3D new InvokerLocator(locatorURI); + HashMap clientConfig =3D new HashMap(); + clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); + clientConfig.put(Remoting.USE_ALL_SOCKET_FACTORY_PARAMS, "true"); + addExtraClientConfig(clientConfig); + log.info("clientConfig: " + clientConfig); + Client client =3D new Client(clientLocator, clientConfig); + client.connect(); + log.info("client is connected"); + = + // Test connections. + assertEquals("abc", client.invoke("abc")); + log.info("connection is good"); + = + // Verify that TestSocketCreationListener was called. + assertTrue(TestSocketCreationListener.called); + = + 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(boolean setUseAllParams, String useAllParams= ) throws Exception + { + host =3D InetAddress.getLocalHost().getHostAddress(); + port =3D PortUtil.findFreePort(host); + locatorURI =3D getTransport() + "://" + host + ":" + port; + locatorURI +=3D "/?" + Remoting.SOCKET_CREATION_CLIENT_LISTENER + "= =3D" + TestSocketCreationListener.class.getName(); + String metadata =3D System.getProperty("remoting.metadata"); + if (metadata !=3D null) + { + locatorURI +=3D "&" + metadata; + } + if (setUseAllParams) + { + locatorURI +=3D "&" + Remoting.USE_ALL_SOCKET_FACTORY_PARAMS + "= =3D" + useAllParams; + } + serverLocator =3D new InvokerLocator(locatorURI); + log.info("Starting remoting server with locator uri of: " + locatorU= RI); + HashMap config =3D new HashMap(); + config.put(InvokerLocator.FORCE_REMOTE, "true"); + addExtraServerConfig(config); + connector =3D new Connector(serverLocator, config); + connector.create(); + invocationHandler =3D new TestInvocationHandler(); + connector.addInvocationHandler("test", invocationHandler); + connector.start(); + } + = + = + protected void shutdownServer() throws Exception + { + if (connector !=3D null) + connector.stop(); + } + = + = + static class TestInvocationHandler implements ServerInvocationHandler + { + public void addListener(InvokerCallbackHandler callbackHandler) {} + public Object invoke(final InvocationRequest invocation) throws Thro= wable + { + return invocation.getParameter(); + } + public void removeListener(InvokerCallbackHandler callbackHandler) {} + public void setMBeanServer(MBeanServer server) {} + public void setInvoker(ServerInvoker invoker) {} + } + = + = + public static class TestSocketCreationListener implements SocketCreatio= nListener + { + static public boolean called; + = + public TestSocketCreationListener() + { + log.info("TestSocketCreationListener created"); + } + = + public void socketCreated(Socket socket, Object source) throws IOExc= eption + { + called =3D true; + log.info("TestSocketCreationListener called"); + } = + } +} \ No newline at end of file --===============5000199552999863464==-- From jboss-remoting-commits at lists.jboss.org Tue Apr 21 22:55:13 2009 Content-Type: multipart/mixed; boundary="===============0274410751620835225==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5078 - remoting2/branches/2.x/docs/guide/en. Date: Tue, 21 Apr 2009 22:55:13 -0400 Message-ID: --===============0274410751620835225== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-21 22:55:12 -0400 (Tue, 21 Apr 2009) New Revision: 5078 Modified: remoting2/branches/2.x/docs/guide/en/chap5.xml Log: JBREM-1123: Added discussion of SocketServerInvoker's immediateShutdown par= ameter. Modified: remoting2/branches/2.x/docs/guide/en/chap5.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/docs/guide/en/chap5.xml 2009-04-21 05:42:20 UTC = (rev 5077) +++ remoting2/branches/2.x/docs/guide/en/chap5.xml 2009-04-22 02:55:12 UTC = (rev 5078) @@ -1474,6 +1474,24 @@ = + Note. When a + ServerThread receives an invocation, it ent= ers a + synchronized method to prevent itself from being interrupted while= it is + processing the invocation. When SocketServerInvoker.s= top() + is called, it calls the synchronized method ServerThre= ad.shutdown() + for each ServerThread, which insures that t= he server + does not shut down until all currently invocations are complete. + + = + However, if it happens that an invocation gets hung up for s= ome reason, the + server would be prevented from shutting down. For example, the = + ServerInvocationHandler could have a bug, o= r an attempt + to write to a disconnected network could get hung up. As of Relea= se 2.5.2, there + is an option to shut down a SocketServerInvoker immediately + without waiting for current invocations to complete. This option = can be enabled + by setting the property "immediateShutdown" to "true". + + Client = When the socket client invoker makes its first invocation, i= t will @@ -1513,9 +1531,9 @@
Configuration = - The following configuration properties can be set at any tim= e, but - will not take effect until the socket invoker, on the server side,= is - stopped and restarted. + The following configuration properties can be set at any tim= e. If + the SocketServerInvoker has already started= , they + will not take effect until it is stopped and restarted. = timeout - The socket time= out value passed to the Socket.setSoTimeout() method. The default on t= he @@ -1567,6 +1585,12 @@ continue to wait for an invocation; otherwise, it will return itse= lf to the thread pool. = + immediateShutdown - indic= ates, when + set to "true", that, when Connector.stop() is + called and it calls SocketServerInvoker.stop(), + all ServerThreads are shut down immediately, + even if they are processing an invocation. + = Configurations affecting the Socket invoker client = @@ -6592,6 +6616,13 @@ value is 'serverSocketClass') - specifies the fully qualified class na= me for the custom SocketWrapper implementation to use on the server. = + Bean properties (meaning have getter/set= ter): + + ImmediateShutdown - a flag fo= r indicating + that SocketServerInvoker should shut down all o= f its + ServerThreads immediately instead of waiting fo= r any + current invocations to finish. + =
=
--===============0274410751620835225==-- From jboss-remoting-commits at lists.jboss.org Wed Apr 22 19:55:42 2009 Content-Type: multipart/mixed; boundary="===============0429063405777105008==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5079 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket. Date: Wed, 22 Apr 2009 19:55:42 -0400 Message-ID: --===============0429063405777105008== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-22 19:55:41 -0400 (Wed, 22 Apr 2009) New Revision: 5079 Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/Clie= ntSocketWrapper.java Log: JBREM-1120: Added writeTimeout variable. Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/sock= et/ClientSocketWrapper.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/Cli= entSocketWrapper.java 2009-04-22 02:55:12 UTC (rev 5078) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/Cli= entSocketWrapper.java 2009-04-22 23:55:41 UTC (rev 5079) @@ -51,6 +51,7 @@ = private InputStream in; private OutputStream out; + private int writeTimeout =3D -1; = // Constructors -------------------------------------------------------= -------------------------- = @@ -78,6 +79,16 @@ return in; } = + public int getWriteTimeout() + { + return writeTimeout; + } + + public void setWriteTimeout(int writeTimeout) + { + this.writeTimeout =3D writeTimeout; + } + public void checkConnection() throws IOException { // Test to see if socket is alive by send ACK message @@ -156,6 +167,15 @@ log.trace("set temp timeout to: " + tempTimeout); } } + o =3D metadata.get(WRITE_TIMEOUT); + if (o instanceof Integer) + { + writeTimeout =3D ((Integer) o).intValue(); + if (writeTimeout !=3D -1) + { + log.trace("set writeTimeout to: " + writeTimeout); + } + } } = out =3D createOutputStream(serializationType, socket, marshaller); @@ -192,6 +212,11 @@ log.warn("got null marshaller"); = OutputStream os =3D socket.getOutputStream(); + if (writeTimeout > 0) + { + os =3D new TimedOutputStream(os, writeTimeout); + } + = if (marshaller instanceof PreferredStreamMarshaller) { PreferredStreamMarshaller psm =3D (PreferredStreamMarshaller) mar= shaller; --===============0429063405777105008==-- From jboss-remoting-commits at lists.jboss.org Wed Apr 22 19:56:19 2009 Content-Type: multipart/mixed; boundary="===============8747564981771488526==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5080 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket. Date: Wed, 22 Apr 2009 19:56:19 -0400 Message-ID: --===============8747564981771488526== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-22 19:56:19 -0400 (Wed, 22 Apr 2009) New Revision: 5080 Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/Micr= oSocketClientInvoker.java Log: JBREM-1120: Added writeTimeout facility. Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/sock= et/MicroSocketClientInvoker.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/Mic= roSocketClientInvoker.java 2009-04-22 23:55:41 UTC (rev 5079) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/Mic= roSocketClientInvoker.java 2009-04-22 23:56:19 UTC (rev 5080) @@ -91,6 +91,9 @@ /** Key for setting time to wait to get permission to get a connection = */ public static final String CONNECTION_WAIT =3D "connectionWait"; = + /** Key for setting socket write timeout */ + public static final String WRITE_TIMEOUT =3D "writeTimeout"; + = /** * Default value for enable TCP nodelay. Value is false. */ @@ -247,6 +250,8 @@ protected boolean soLingerSet; protected int soLingerDuration =3D -1; protected int trafficClass =3D -1; + = + protected int writeTimeout =3D -1; = // Constructors -------------------------------------------------------= -------------------------- = @@ -384,6 +389,16 @@ this.trafficClass =3D trafficClass; } = + public int getWriteTimeout() + { + return writeTimeout; + } + + public void setWriteTimeout(int writeTimeout) + { + this.writeTimeout =3D writeTimeout; + } + public synchronized void disconnect() { log.debug(this + " disconnecting ..."); @@ -612,6 +627,22 @@ val + " to a boolean value"); } } + = + // look for writeTimeout param + val =3D params.get(WRITE_TIMEOUT); + if (val !=3D null) + { + try + { + writeTimeout =3D Integer.valueOf((String)val).intValue(); + log.debug(this + " setting writeTimeout to " + writeTimeout); + } + catch (Exception e) + { + log.warn(this + " could not convert " + WRITE_TIMEOUT + " valu= e of " + + val + " to an int value"); + } + } } = protected ServerAddress createServerAddress(InetAddress addr, int port) @@ -1102,7 +1133,10 @@ } metadata.put(SocketWrapper.MARSHALLER, marshaller); metadata.put(SocketWrapper.UNMARSHALLER, unmarshaller); - + if (writeTimeout > 0) + { + metadata.put(SocketWrapper.WRITE_TIMEOUT, new Integer(writeTim= eout)); + } if (timeAllowed > 0) { timeRemaining =3D (int) (timeAllowed - (System.currentTimeMill= is() - start)); --===============8747564981771488526==-- From jboss-remoting-commits at lists.jboss.org Wed Apr 22 19:57:05 2009 Content-Type: multipart/mixed; boundary="===============5051799275369069695==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5081 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket. Date: Wed, 22 Apr 2009 19:57:05 -0400 Message-ID: --===============5051799275369069695== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-22 19:57:04 -0400 (Wed, 22 Apr 2009) New Revision: 5081 Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/Serv= erThread.java Log: JBREM-1120: Added writeTimeout facility. Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/sock= et/ServerThread.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/Ser= verThread.java 2009-04-22 23:56:19 UTC (rev 5080) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/Ser= verThread.java 2009-04-22 23:57:04 UTC (rev 5081) @@ -120,6 +120,7 @@ = private Socket socket; private int timeout; + private int writeTimeout; protected SocketServerInvoker invoker; private Constructor serverSocketConstructor; protected SocketWrapper socketWrapper; @@ -156,7 +157,7 @@ // Constructors -------------------------------------------------------= -------------------------- = public ServerThread(Socket socket, SocketServerInvoker invoker, LRUPool= clientpool, - LinkedList threadpool, int timeout, String serverSo= cketClassName) + LinkedList threadpool, int timeout, int writeTimeou= t, String serverSocketClassName) throws Exception { super(); @@ -166,6 +167,7 @@ = this.socket =3D socket; this.timeout =3D timeout; + this.writeTimeout =3D writeTimeout; this.serverSocketClassName =3D serverSocketClassName; this.invoker =3D invoker; this.clientpool =3D clientpool; @@ -686,7 +688,7 @@ = protected void processInvocation(SocketWrapper socketWrapper, InputStre= am inputStream, OutputStream outputStream) throws Exception { - if(trace) { log.trace("preparing to process next invocation invocati= on"); } + if(trace) { log.trace("preparing to process next invocation"); } = // Ok, now read invocation and invoke = @@ -927,7 +929,11 @@ } localMetadata.put(SocketWrapper.MARSHALLER, marshaller); localMetadata.put(SocketWrapper.UNMARSHALLER, unmarshaller); - + if (writeTimeout > 0) + { + localMetadata.put(SocketWrapper.WRITE_TIMEOUT, new Integer(wri= teTimeout)); + } + = serverSocketWrapper =3D (SocketWrapper)serverSocketConstructor. newInstance(new Object[]{socket, localMetadata, new Integer(ti= meout)}); } --===============5051799275369069695==-- From jboss-remoting-commits at lists.jboss.org Wed Apr 22 19:58:00 2009 Content-Type: multipart/mixed; boundary="===============5434048692892352998==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5082 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket. Date: Wed, 22 Apr 2009 19:58:00 -0400 Message-ID: --===============5434048692892352998== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-22 19:58:00 -0400 (Wed, 22 Apr 2009) New Revision: 5082 Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/Sock= etServerInvoker.java Log: JBREM-1120: Added writeTimeout facility; also, corrected some javadoc. Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/sock= et/SocketServerInvoker.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/Soc= ketServerInvoker.java 2009-04-22 23:57:04 UTC (rev 5081) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/Soc= ketServerInvoker.java 2009-04-22 23:58:00 UTC (rev 5082) @@ -125,6 +125,8 @@ // defaults to -1 as to not have idle timeouts protected int idleTimeout =3D -1; protected IdleTimerTask idleTimerTask =3D null; + = + protected int writeTimeout =3D -1; = public SocketServerInvoker(InvokerLocator locator) { @@ -591,7 +593,7 @@ } = /** - * @return Value of property serverBindPort. + * @return Number of idle ServerThreads * @jmx:managed-attribute */ public int getCurrentThreadPoolSize() @@ -600,7 +602,7 @@ } = /** - * @return Value of property serverBindPort. + * @return Number of ServerThreads current executing or waiting on an i= nvocation * @jmx:managed-attribute */ public int getCurrentClientPoolSize() @@ -724,6 +726,16 @@ this.immediateShutdown =3D immediateShutdown; } = + public int getWriteTimeout() + { + return writeTimeout; + } + + public void setWriteTimeout(int writeTimeout) + { + this.writeTimeout =3D writeTimeout; + } + protected void configureSocket(Socket s) throws SocketException { s.setReuseAddress(getReuseAddress()); @@ -769,7 +781,7 @@ { if(trace) { log.trace(this + " creating new worker threa= d"); } worker =3D new ServerThread(socket, this, clientpool, th= readpool, - getTimeout(), serverSocketClas= s); + getTimeout(), writeTimeout, se= rverSocketClass); if(trace) { log.trace(this + " created " + worker); } newThread =3D true; } --===============5434048692892352998==-- From jboss-remoting-commits at lists.jboss.org Wed Apr 22 19:58:56 2009 Content-Type: multipart/mixed; boundary="===============0909730221442809736==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5083 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket. Date: Wed, 22 Apr 2009 19:58:56 -0400 Message-ID: --===============0909730221442809736== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-22 19:58:56 -0400 (Wed, 22 Apr 2009) New Revision: 5083 Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/Sock= etWrapper.java Log: JBREM-1120: Added WRITE_TIMEOUT constant; also, removed some old commented = code. Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/sock= et/SocketWrapper.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/Soc= ketWrapper.java 2009-04-22 23:58:00 UTC (rev 5082) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/Soc= ketWrapper.java 2009-04-22 23:58:56 UTC (rev 5083) @@ -42,6 +42,7 @@ public static final String MARSHALLER =3D "marshaller"; public static final String UNMARSHALLER =3D "unmarshaller"; public static final String TEMP_TIMEOUT =3D "temptimeout"; + public static final String WRITE_TIMEOUT =3D "writeTimeout"; = protected static final int CLOSING =3D 254; = @@ -93,35 +94,6 @@ = public void close() throws IOException { = -// InputStream in =3D getInputStream(); -// if (in !=3D null) -// { -// try -// { -// log.trace(this + " closing input stream"); -// in.close(); -// log.trace(this + " closed input stream"); -// } -// catch (IOException e) -// { -// log.debug(this + " unable to close input stream"); -// } -// } -// OutputStream out =3D getOutputStream(); -// if (out !=3D null) -// { -// try -// { -// log.trace(this + " closing output stream"); -// out.close(); -// log.trace(this + " closed input stream"); -// } -// catch (IOException e) -// { -// log.debug(this + " unable to close output stream"); -// } -// } - if(socket !=3D null) { log.trace(this + " closing socket"); --===============0909730221442809736==-- From jboss-remoting-commits at lists.jboss.org Wed Apr 22 19:59:35 2009 Content-Type: multipart/mixed; boundary="===============8042681796899099449==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5084 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket. Date: Wed, 22 Apr 2009 19:59:35 -0400 Message-ID: --===============8042681796899099449== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-22 19:59:35 -0400 (Wed, 22 Apr 2009) New Revision: 5084 Added: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/Time= dOutputStream.java Log: JBREM-1120: New OutputStream for output timeout facility. Added: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/= TimedOutputStream.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/Tim= edOutputStream.java (rev 0) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/Tim= edOutputStream.java 2009-04-22 23:59:35 UTC (rev 5084) @@ -0,0 +1,127 @@ +package org.jboss.remoting.transport.socket; + +import java.io.IOException; +import java.io.OutputStream; +import java.util.Timer; +import java.util.TimerTask; + +import org.apache.log4j.Logger; + +public class TimedOutputStream extends OutputStream +{ + static private Timer timer =3D new Timer("TimedOutputStreamTimer", true= ); + static private Logger log =3D Logger.getLogger(TimedOutputStream.class); + = + private OutputStream os; + private int outputTimeout; + private OutputTimerTask timerTask; + private Object lock =3D new Object(); + = + public TimedOutputStream(OutputStream os, int outputTimeout) + { + this.os =3D os; + this.outputTimeout =3D outputTimeout; + } + = + public void close() throws IOException + { + os.close(); + } + = + public void write(int b) throws IOException + { + synchronized (lock) + { + if (timerTask =3D=3D null) + { + try + { + timerTask =3D new OutputTimerTask(this); + timer.schedule(timerTask, outputTimeout); + } + catch (IllegalStateException e) + { + timer =3D new Timer("TimedOutputStreamTimer", true); + timer.schedule(new OutputTimerTask(this), outputTimeout); + log.info("scheduled OutputTimerTask: " + outputTimeout); + } + } + } + = + try + { + os.write(b); + } + finally + { + synchronized (lock) + { + timerTask.cancel(); + timerTask =3D null; + } + } + } + = + public void write(byte b[], int off, int len) throws IOException + { + synchronized (lock) + { + if (timerTask =3D=3D null) + { + try + { + timerTask =3D new OutputTimerTask(this); + timer.schedule(timerTask, outputTimeout); + } + catch (IllegalStateException e) + { + timer =3D new Timer("TimedOutputStreamTimer", true); + timer.schedule(new OutputTimerTask(this), outputTimeout); = + } + } + } + = + try + { + os.write(b, off, len); + } + finally + { + synchronized (lock) + { + timerTask.cancel(); + timerTask =3D null; + } + } + } + = + static class OutputTimerTask extends TimerTask + { + private TimedOutputStream tos; + = + public OutputTimerTask(TimedOutputStream tos) + { + this.tos =3D tos; + } + = + public void run() + { + try + { + log.info("closing: " + tos); + tos.close(); + tos =3D null; + } + catch (IOException e) + { + log.debug("unable to close " + tos); + } + } + = + public boolean cancel() + { + tos =3D null; + return super.cancel(); + } + } +} --===============8042681796899099449==-- From jboss-remoting-commits at lists.jboss.org Wed Apr 22 23:40:20 2009 Content-Type: multipart/mixed; boundary="===============7088653367627334963==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5085 - in remoting2/branches/2.x/src/main/org/jboss/remoting/transport: sslbisocket and 1 other directory. Date: Wed, 22 Apr 2009 23:36:19 -0400 Message-ID: --===============7088653367627334963== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-22 23:36:18 -0400 (Wed, 22 Apr 2009) New Revision: 5085 Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/bisocket/Bi= socketServerInvoker.java remoting2/branches/2.x/src/main/org/jboss/remoting/transport/sslbisocket= /SSLBisocketServerInvoker.java Log: JBREM-1120: Moved SocketFactory creation from SSLBisocketServerInvoker to B= isocketServerInvoker. Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/biso= cket/BisocketServerInvoker.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/bisocket/B= isocketServerInvoker.java 2009-04-22 23:59:35 UTC (rev 5084) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/bisocket/B= isocketServerInvoker.java 2009-04-23 03:36:18 UTC (rev 5085) @@ -726,6 +726,11 @@ { secondaryConnectPorts =3D new ArrayList(secondaryBindPorts); } + = + if (isCallbackServer) + { + socketFactory =3D createSocketFactory(configuration); + } } = = Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/sslb= isocket/SSLBisocketServerInvoker.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/sslbisocke= t/SSLBisocketServerInvoker.java 2009-04-22 23:59:35 UTC (rev 5084) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/sslbisocke= t/SSLBisocketServerInvoker.java 2009-04-23 03:36:18 UTC (rev 5085) @@ -122,11 +122,6 @@ o =3D configuration.get("enabledProtocols"); if (o instanceof String[]) setEnabledProtocols((String[]) o); - = - if (isCallbackServer) - { - socketFactory =3D createSocketFactory(configuration); - } } = protected SocketFactory createSocketFactory(Map configuration) --===============7088653367627334963==-- From jboss-remoting-commits at lists.jboss.org Wed Apr 22 23:41:33 2009 Content-Type: multipart/mixed; boundary="===============4440614484737049530==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5086 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket. Date: Wed, 22 Apr 2009 23:37:32 -0400 Message-ID: --===============4440614484737049530== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-22 23:37:32 -0400 (Wed, 22 Apr 2009) New Revision: 5086 Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/Time= dOutputStream.java Log: JBREM-1120: Added some logging. Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/sock= et/TimedOutputStream.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/Tim= edOutputStream.java 2009-04-23 03:36:18 UTC (rev 5085) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/Tim= edOutputStream.java 2009-04-23 03:37:32 UTC (rev 5086) @@ -38,12 +38,13 @@ { timerTask =3D new OutputTimerTask(this); timer.schedule(timerTask, outputTimeout); + if (log.isTraceEnabled()) log.trace("scheduled OutputTimerT= ask: " + outputTimeout); } catch (IllegalStateException e) { timer =3D new Timer("TimedOutputStreamTimer", true); timer.schedule(new OutputTimerTask(this), outputTimeout); - log.info("scheduled OutputTimerTask: " + outputTimeout); + if (log.isTraceEnabled()) log.trace("scheduled OutputTimerT= ask: " + outputTimeout); } } } @@ -72,11 +73,13 @@ { timerTask =3D new OutputTimerTask(this); timer.schedule(timerTask, outputTimeout); + if (log.isTraceEnabled()) log.trace("scheduled OutputTimerT= ask: " + outputTimeout); } catch (IllegalStateException e) { timer =3D new Timer("TimedOutputStreamTimer", true); - timer.schedule(new OutputTimerTask(this), outputTimeout); = + timer.schedule(new OutputTimerTask(this), outputTimeout); + if (log.isTraceEnabled()) log.trace("scheduled OutputTimerT= ask: " + outputTimeout); } } } --===============4440614484737049530==-- From jboss-remoting-commits at lists.jboss.org Wed Apr 22 23:42:31 2009 Content-Type: multipart/mixed; boundary="===============1490948850091890241==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5087 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/bisocket/timeout. Date: Wed, 22 Apr 2009 23:38:30 -0400 Message-ID: --===============1490948850091890241== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-22 23:38:30 -0400 (Wed, 22 Apr 2009) New Revision: 5087 Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/bisoc= ket/timeout/BisocketWriteTimeoutTestCase.java Log: JBREM-1120: New unit tests. Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/b= isocket/timeout/BisocketWriteTimeoutTestCase.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/biso= cket/timeout/BisocketWriteTimeoutTestCase.java (rev= 0) +++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/biso= cket/timeout/BisocketWriteTimeoutTestCase.java 2009-04-23 03:38:30 UTC (rev= 5087) @@ -0,0 +1,41 @@ +/* +* JBoss, Home of Professional Open Source +* Copyright 2009, JBoss Inc., and individual contributors as indicated +* by the @authors tag. See the copyright.txt in the distribution for a +* full listing of individual contributors. +* +* This is free software; you can redistribute it and/or modify it +* under the terms of the GNU Lesser General Public License as +* published by the Free Software Foundation; either version 2.1 of +* the License, or (at your option) any later version. +* +* This software is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this software; if not, write to the Free +* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA +* 02110-1301 USA, or see the FSF site: http://www.fsf.org. +*/ +package org.jboss.test.remoting.transport.bisocket.timeout; + +import org.jboss.test.remoting.transport.socket.timeout.WriteTimeoutTestPa= rent; + +/** + * Unit tests for JBREM-1120. + * = + * @author Ron Sigal + * @version $Rev$ + *

+ * Copyright Apr 22, 2009 + *

+ */ +public class BisocketWriteTimeoutTestCase extends WriteTimeoutTestParent +{ + protected String getTransport() + { + return "bisocket"; + } +} --===============1490948850091890241==-- From jboss-remoting-commits at lists.jboss.org Wed Apr 22 23:43:15 2009 Content-Type: multipart/mixed; boundary="===============3675476731785156538==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5088 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/socket/timeout. Date: Wed, 22 Apr 2009 23:39:14 -0400 Message-ID: --===============3675476731785156538== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-22 23:39:13 -0400 (Wed, 22 Apr 2009) New Revision: 5088 Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/socke= t/timeout/SocketWriteTimeoutTestCase.java remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/socke= t/timeout/WriteTimeoutTestParent.java Log: JBREM-1120: New unit tests. Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/s= ocket/timeout/SocketWriteTimeoutTestCase.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/sock= et/timeout/SocketWriteTimeoutTestCase.java (rev 0) +++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/sock= et/timeout/SocketWriteTimeoutTestCase.java 2009-04-23 03:39:13 UTC (rev 508= 8) @@ -0,0 +1,39 @@ +/* +* JBoss, Home of Professional Open Source +* Copyright 2009, JBoss Inc., and individual contributors as indicated +* by the @authors tag. See the copyright.txt in the distribution for a +* full listing of individual contributors. +* +* This is free software; you can redistribute it and/or modify it +* under the terms of the GNU Lesser General Public License as +* published by the Free Software Foundation; either version 2.1 of +* the License, or (at your option) any later version. +* +* This software is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this software; if not, write to the Free +* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA +* 02110-1301 USA, or see the FSF site: http://www.fsf.org. +*/ +package org.jboss.test.remoting.transport.socket.timeout; + +/** + * Unit tests for JBREM-1120. + * = + * @author Ron Sigal + * @version $Rev$ + *

+ * Copyright Apr 22, 2009 + *

+ */ +public class SocketWriteTimeoutTestCase extends WriteTimeoutTestParent +{ + protected String getTransport() + { + return "socket"; + } +} Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/s= ocket/timeout/WriteTimeoutTestParent.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/sock= et/timeout/WriteTimeoutTestParent.java (rev 0) +++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/sock= et/timeout/WriteTimeoutTestParent.java 2009-04-23 03:39:13 UTC (rev 5088) @@ -0,0 +1,652 @@ +/* +* JBoss, Home of Professional Open Source +* Copyright 2009, JBoss Inc., and individual contributors as indicated +* by the @authors tag. See the copyright.txt in the distribution for a +* full listing of individual contributors. +* +* This is free software; you can redistribute it and/or modify it +* under the terms of the GNU Lesser General Public License as +* published by the Free Software Foundation; either version 2.1 of +* the License, or (at your option) any later version. +* +* This software is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this software; if not, write to the Free +* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA +* 02110-1301 USA, or see the FSF site: http://www.fsf.org. +*/ +package org.jboss.test.remoting.transport.socket.timeout; + +import java.io.EOFException; +import java.io.IOException; +import java.io.OutputStream; +import java.net.InetAddress; +import java.net.ServerSocket; +import java.net.Socket; +import java.net.UnknownHostException; +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + +import javax.management.MBeanServer; +import javax.net.ServerSocketFactory; +import javax.net.SocketFactory; + +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.InvocationFailureException; +import org.jboss.remoting.InvocationRequest; +import org.jboss.remoting.InvokerLocator; +import org.jboss.remoting.Remoting; +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.Connector; +import org.jboss.remoting.transport.PortUtil; +import org.jboss.remoting.transport.bisocket.Bisocket; +import org.jboss.remoting.transport.socket.SocketServerInvoker; +import org.jboss.remoting.transport.socket.SocketWrapper; + + +/** + * Unit tests for JBREM-1120. + * = + * @author Ron Sigal + * @version $Rev$ + *

+ * Copyright Apr 22, 2009 + *

+ */ +public abstract class WriteTimeoutTestParent extends TestCase +{ + private static Logger log =3D Logger.getLogger(WriteTimeoutTestParent.c= lass); + = + private static boolean firstTime =3D true; + = + protected static int SECONDARY_SERVER_SOCKET_PORT =3D 8765; + protected static String SECONDARY_SERVER_SOCKET_PORT_STRING =3D "8765"; + protected static boolean callbackTest; + = + 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 =3D false; + Logger.getLogger("org.jboss.remoting").setLevel(Level.TRACE); + Logger.getLogger("org.jboss.test.remoting").setLevel(Level.INFO); + String pattern =3D "[%d{ABSOLUTE}] [%t] %5p (%F:%L) - %m%n"; + PatternLayout layout =3D new PatternLayout(pattern); + ConsoleAppender consoleAppender =3D new ConsoleAppender(layout); + Logger.getRootLogger().addAppender(consoleAppender); = + } + } + + = + public void tearDown() + { + } + = + = + public void testClientWriteTimeout() throws Throwable + { + log.info("entering " + getName()); + = + // Start server. + setupServer(false, false, "", -1); + = + // Create client. + InvokerLocator clientLocator =3D new InvokerLocator(locatorURI); + HashMap clientConfig =3D new HashMap(); + clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); + clientConfig.put(SocketWrapper.WRITE_TIMEOUT, "1000"); + clientConfig.put(Remoting.CUSTOM_SOCKET_FACTORY, new TestSocketFacto= ry(5000)); + addExtraClientConfig(clientConfig); + Client client =3D new Client(clientLocator, clientConfig); + client.connect(); + log.info("client is connected"); + = + log.info("**************************************"); + log.info("*** WorkerThread error is expected ***"); + log.info("**************************************"); + = + // Test client side write timeout. + try + { + client.invoke("abc"); + } + catch (InvocationFailureException e) + { + log.info(e.getMessage()); + assertNotNull(e.getMessage()); + assertTrue(e.getMessage().startsWith("Unable to perform invocatio= n")); + assertTrue(e.getCause() instanceof IOException); + IOException ioe =3D (IOException) e.getCause(); + assertEquals("closed", ioe.getMessage()); + log.info("got expected Exception"); + } + catch (Throwable t) + { + log.error("got unexpected Exception", t); + fail("got unexpected Exception"); + } + = + client.disconnect(); + shutdownServer(); + log.info(getName() + " PASSES"); + } + = + = + public void testServerWriteTimeout() throws Throwable + { + log.info("entering " + getName()); + = + // Start server. + setupServer(true, false, "1000", 5000); + = + // Create client. + InvokerLocator clientLocator =3D new InvokerLocator(locatorURI); + HashMap clientConfig =3D new HashMap(); + clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); + clientConfig.put("numberOfCallRetries", "1"); + addExtraClientConfig(clientConfig); + Client client =3D new Client(clientLocator, clientConfig); + client.connect(); + log.info("client is connected"); + = + log.info("**************************************"); + log.info("*** WorkerThread error is expected ***"); + log.info("**************************************"); + = + // Test server side write timeout. + try + { + client.invoke("abc"); + } + catch (InvocationFailureException e) + { + log.info(e.getMessage()); + assertNotNull(e.getMessage()); + assertTrue(e.getMessage().startsWith("Unable to perform invocatio= n")); + assertTrue(e.getCause() instanceof EOFException); + log.info("got expected Exception"); + } + catch (Throwable t) + { + log.error("got unexpected Exception", t); + fail("got unexpected Exception"); + } + = + // Test server invoker state. + Thread.sleep(4000); + SocketServerInvoker serverInvoker =3D (SocketServerInvoker) connecto= r.getServerInvoker(); + assertEquals(0, serverInvoker.getCurrentClientPoolSize()); + assertEquals(1, serverInvoker.getCurrentThreadPoolSize()); + log.info("used ServerThread has returned to threadPool"); + = + client.disconnect(); + shutdownServer(); + log.info(getName() + " PASSES"); + } + = + = + public void testClientCallbackWriteTimeout() throws Throwable + { + log.info("entering " + getName()); + = + // Start server. + setupServer(false, false, "", -1); + = + // Create client. + InvokerLocator clientLocator =3D new InvokerLocator(locatorURI); + HashMap clientConfig =3D new HashMap(); + clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); + addExtraClientConfig(clientConfig); + Client client =3D new Client(clientLocator, clientConfig); + client.connect(); + log.info("client is connected"); + = + // Test connection + client.invoke("abc"); + log.info("connection is good"); + = + // Test client callback write timeout. + log.info("registering callback handler"); + log.info("**************************************"); + log.info("*** WorkerThread error is expected ***"); + log.info("**************************************"); + TestCallbackHandler callbackHandler =3D new TestCallbackHandler(); + HashMap metadata =3D new HashMap(); + if (isBisocket(getTransport())) + { + metadata.put(SocketWrapper.WRITE_TIMEOUT, "1000"); + metadata.put(Remoting.SOCKET_FACTORY_NAME, TestSocketFactory.clas= s.getName()); + metadata.put("numberOfCallRetries", "1"); + metadata.put(Bisocket.IS_CALLBACK_SERVER, "true"); + metadata.put(Bisocket.PING_FREQUENCY, "11111111"); = + } + else + { + metadata.put(SocketWrapper.WRITE_TIMEOUT, "1000"); + metadata.put(ServerInvoker.SERVER_SOCKET_FACTORY, TestServerSocke= tFactory.class.getName()); + metadata.put("numberOfCallRetries", "1"); + } + client.addListener(callbackHandler, metadata, null, true); + = + // Test server invoker state. + Thread.sleep(4000); + Set callbackConnectors =3D client.getCallbackConnectors(callbackHand= ler); + assertEquals(1, callbackConnectors.size()); + Connector callbackConnector =3D (Connector) callbackConnectors.itera= tor().next(); + SocketServerInvoker serverInvoker =3D (SocketServerInvoker) callback= Connector.getServerInvoker(); + assertEquals(0, serverInvoker.getCurrentClientPoolSize()); + assertEquals(1, serverInvoker.getCurrentThreadPoolSize()); + log.info("used ServerThread has returned to threadPool"); + + client.disconnect(); + shutdownServer(); + log.info(getName() + " PASSES"); + } + = + = + public void testServerCallbackWriteTimeout() throws Throwable + { + log.info("entering " + getName()); + = + // Start server. + if (isBisocket(getTransport())) + { + callbackTest =3D true; + setupServer(true, false, "1000", 5000); + } + else + { + setupServer(false, true, "1000", 5000); + } + = + // Create client. + InvokerLocator clientLocator =3D new InvokerLocator(locatorURI); + HashMap clientConfig =3D new HashMap(); + clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); + clientConfig.put("numberOfCallRetries", "1"); + addExtraClientConfig(clientConfig); + Client client =3D new Client(clientLocator, clientConfig); + client.connect(); + log.info("client is connected"); + = + // Test connection + client.invoke("abc"); + log.info("connection is good"); + = + // Test server callback write timeout. + log.info("registering callback handler"); + log.info("**************************************"); + log.info("*** WorkerThread error is expected ***"); + log.info("**************************************"); + HashMap metadata =3D new HashMap(); + if (isBisocket(getTransport())) + { + metadata.put(Bisocket.IS_CALLBACK_SERVER, "true"); + } + TestCallbackHandler callbackHandler =3D new TestCallbackHandler(); + client.addListener(callbackHandler, null, null, true); + = + // Test server invoker state. + Thread.sleep(4000); + Throwable t =3D invocationHandler.t; + assertTrue(t instanceof HandleCallbackException); + assertTrue(t.getCause() instanceof InvocationFailureException); + InvocationFailureException e =3D (InvocationFailureException) t.getC= ause(); + assertNotNull(e.getMessage()); + assertTrue(e.getMessage().startsWith("Unable to perform invocation")= ); + assertTrue(e.getCause() instanceof IOException); + IOException ioe =3D (IOException) e.getCause(); + assertEquals("closed", ioe.getMessage()); + log.info("got expected Exception"); + = + client.disconnect(); + shutdownServer(); + log.info(getName() + " PASSES"); + } + = + = + protected abstract String getTransport(); + = + protected boolean isBisocket(String transport) + { + return transport.indexOf("bisocket") >=3D 0; + } + = + protected void addExtraClientConfig(Map config) {} + protected void addExtraServerConfig(Map config) {} + = + + protected void setupServer(boolean setWriteTimeout, boolean setCallback= WriteTimeout, + String writeTimeout, int blockingTime) throw= s Exception + { + host =3D InetAddress.getLocalHost().getHostAddress(); + port =3D PortUtil.findFreePort(host); + locatorURI =3D getTransport() + "://" + host + ":" + port; + String metadata =3D System.getProperty("remoting.metadata"); + if (metadata !=3D null) + { + locatorURI +=3D "/?" + metadata; + } + serverLocator =3D new InvokerLocator(locatorURI); + log.info("Starting remoting server with locator uri of: " + locatorU= RI); + HashMap config =3D new HashMap(); + config.put(InvokerLocator.FORCE_REMOTE, "true"); + if (isBisocket(getTransport())) + { + config.put(Bisocket.SECONDARY_BIND_PORT, SECONDARY_SERVER_SOCKET_= PORT_STRING); + config.put(Bisocket.PING_FREQUENCY, "11111111"); = + } + if (setWriteTimeout) + { + config.put(SocketWrapper.WRITE_TIMEOUT, writeTimeout); + config.put(Remoting.CUSTOM_SERVER_SOCKET_FACTORY, new TestServerS= ocketFactory(blockingTime)); + } + if (setCallbackWriteTimeout) + { + config.put(SocketWrapper.WRITE_TIMEOUT, writeTimeout); + config.put(Remoting.CUSTOM_SOCKET_FACTORY, new TestSocketFactory(= blockingTime)); + } + if (callbackTest) + { + config.put("numberOfCallRetries", "1"); + } + addExtraServerConfig(config); + connector =3D new Connector(serverLocator, config); + connector.create(); + invocationHandler =3D new TestInvocationHandler(); + connector.addInvocationHandler("test", invocationHandler); + connector.start(); + } + = + = + protected void shutdownServer() throws Exception + { + if (connector !=3D null) + connector.stop(); + } + = + = + static class TestInvocationHandler implements ServerInvocationHandler + { + Throwable t; + = + public void addListener(InvokerCallbackHandler callbackHandler) + { + try + { + callbackHandler.handleCallback(new Callback("callback")); + } + catch (Throwable t) + { + this.t =3D t; + } + } + public Object invoke(final InvocationRequest invocation) throws Thro= wable + { + 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 HandleCallbackE= xception + { + log.info("received callback"); + } = + } + = + = + static public class TestServerSocketFactory extends ServerSocketFactory + { + int timeout; + public TestServerSocketFactory() + { + this.timeout =3D 5000; + } = + public TestServerSocketFactory(int timeout) + { + this.timeout =3D timeout; + } + public ServerSocket createServerSocket() throws IOException + { + ServerSocket ss =3D null; + if (callbackTest) + { + ss =3D ServerSocketFactory.getDefault().createServerSocket(); + } + else + { + ss =3D new TestServerSocket(timeout); + } + log.info("returning: " + ss); + return ss; + } + public ServerSocket createServerSocket(int port) throws IOException + { + ServerSocket ss =3D null; + if (callbackTest && port !=3D SECONDARY_SERVER_SOCKET_PORT) + { + ss =3D ServerSocketFactory.getDefault().createServerSocket(por= t); + } + else + { + ss =3D new TestServerSocket(port, timeout); + } + log.info("returning: " + ss); + return ss; + } + + public ServerSocket createServerSocket(int port, int backlog) throws= IOException + { + ServerSocket ss =3D null; + if (callbackTest && port !=3D SECONDARY_SERVER_SOCKET_PORT) + { + ss =3D ServerSocketFactory.getDefault().createServerSocket(por= t, backlog); + } + else + { + ss =3D new TestServerSocket(port, backlog, timeout); + } + log.info("returning: " + ss); + return ss; + } + + public ServerSocket createServerSocket(int port, int backlog, InetAd= dress ifAddress) throws IOException + { + ServerSocket ss =3D null; + if (callbackTest && port !=3D SECONDARY_SERVER_SOCKET_PORT) + { + ss =3D ServerSocketFactory.getDefault().createServerSocket(por= t, backlog, ifAddress); + } + else + { + ss =3D new TestServerSocket(port, backlog, ifAddress, timeout); + } + log.info("returning: " + ss); + return ss; + } + } + = + = + static class TestServerSocket extends ServerSocket + { + int timeout; + + public TestServerSocket(int timeout) throws IOException + { + super(); + this.timeout =3D timeout; + } + public TestServerSocket(int port, int timeout) throws IOException + { + super(port); + this.timeout =3D timeout; + } + public TestServerSocket(int port, int backlog, int timeout) throws I= OException + { + super(port, backlog); + this.timeout =3D timeout; + } + public TestServerSocket(int port, int backlog, InetAddress bindAddr,= int timeout) throws IOException + { + super(port, backlog, bindAddr); + this.timeout =3D timeout; + } + public Socket accept() throws IOException + { + Socket s =3D new TestSocket(timeout); + implAccept(s); + return s; + } + public String toString() + { + return "TestServerSocket[" + getLocalPort() + "]"; + } + } + = + = + public static class TestSocketFactory extends SocketFactory + { + int timeout; + = + public TestSocketFactory() + { + timeout =3D 5000; + } + public TestSocketFactory(int timeout) + { + this.timeout =3D timeout; + } + public Socket createSocket() + { + return new TestSocket(timeout); + } + public Socket createSocket(String arg0, int arg1) throws IOException= , UnknownHostException + { + return new TestSocket(arg0, arg1, timeout); + } + + public Socket createSocket(InetAddress arg0, int arg1) throws IOExce= ption + { + return new TestSocket(arg0, arg1, timeout); + } + + public Socket createSocket(String arg0, int arg1, InetAddress arg2, = int arg3) throws IOException, UnknownHostException + { + return new TestSocket(arg0, arg1, arg2, arg3, timeout); + } + + public Socket createSocket(InetAddress arg0, int arg1, InetAddress a= rg2, int arg3) throws IOException + { + return new TestSocket(arg0, arg1, arg2, arg3, timeout); + } + } + = + static class TestSocket extends Socket + { + int timeout; + = + public TestSocket(int timeout) + { + this.timeout =3D timeout; + } + public TestSocket(String host, int port, int timeout) throws Unknown= HostException, IOException + { + super(host, port); + this.timeout =3D timeout; + } + public TestSocket(InetAddress address, int port, int timeout) throws= IOException + { + super(address, port); + this.timeout =3D timeout; + } + public TestSocket(String host, int port, InetAddress localAddr, int = localPort, int timeout) throws IOException + { + super(host, port, localAddr, localPort); + this.timeout =3D timeout; + } + public TestSocket(InetAddress address, int port, InetAddress localAd= dr, int localPort, int timeout) throws IOException + { + super(address, port, localAddr, localPort); + this.timeout =3D timeout; + } + public OutputStream getOutputStream() throws IOException + { + return new TestOutputStream(super.getOutputStream(), timeout); + } + } + = + static class TestOutputStream extends OutputStream + { + OutputStream os; + int timeout; + boolean closed; + = + public TestOutputStream(OutputStream os, int timeout) + { + this.os =3D os; + this.timeout =3D timeout; + } + public void close()throws IOException + { + closed =3D true; + super.close(); + log.info("closed"); + } + public void write(int b) throws IOException + { + if (closed) + { + log.info("TestOutputStream closed, cannot write"); + throw new IOException("closed"); + } + os.write(b); + } + public void write(byte b[], int off, int len) throws IOException + { + if (closed) + { + log.info("TestOutputStream closed, cannot write"); + throw new IOException("closed"); + } + try + { + log.info("TestOutputStream.write() sleeping: " + timeout); + Thread.sleep(timeout); + } + catch (InterruptedException e) + { + e.printStackTrace(); + } + log.info("TestOutputStream writing"); + os.write(b, off, len); + } + } +} \ No newline at end of file --===============3675476731785156538==-- From jboss-remoting-commits at lists.jboss.org Wed Apr 22 23:47:15 2009 Content-Type: multipart/mixed; boundary="===============0647812786595681933==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5089 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/socket/timeout. Date: Wed, 22 Apr 2009 23:43:14 -0400 Message-ID: --===============0647812786595681933== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-22 23:43:14 -0400 (Wed, 22 Apr 2009) New Revision: 5089 Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/socke= t/timeout/WriteTimeoutTestParent.java Log: JBREM-1120: Reduced log level. Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transpor= t/socket/timeout/WriteTimeoutTestParent.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/sock= et/timeout/WriteTimeoutTestParent.java 2009-04-23 03:39:13 UTC (rev 5088) +++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/sock= et/timeout/WriteTimeoutTestParent.java 2009-04-23 03:43:14 UTC (rev 5089) @@ -91,7 +91,7 @@ if (firstTime) { firstTime =3D false; - Logger.getLogger("org.jboss.remoting").setLevel(Level.TRACE); + Logger.getLogger("org.jboss.remoting").setLevel(Level.INFO); Logger.getLogger("org.jboss.test.remoting").setLevel(Level.INFO); String pattern =3D "[%d{ABSOLUTE}] [%t] %5p (%F:%L) - %m%n"; PatternLayout layout =3D new PatternLayout(pattern); --===============0647812786595681933==-- From jboss-remoting-commits at lists.jboss.org Thu Apr 23 02:31:48 2009 Content-Type: multipart/mixed; boundary="===============1656433409808829856==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5090 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/socket/timeout. Date: Thu, 23 Apr 2009 02:27:43 -0400 Message-ID: --===============1656433409808829856== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-23 02:27:42 -0400 (Thu, 23 Apr 2009) New Revision: 5090 Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/socke= t/timeout/SSLWriteTimeoutTestParent.java Log: JBREM-1120: New unit tests. Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/s= ocket/timeout/SSLWriteTimeoutTestParent.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/sock= et/timeout/SSLWriteTimeoutTestParent.java (rev 0) +++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/sock= et/timeout/SSLWriteTimeoutTestParent.java 2009-04-23 06:27:42 UTC (rev 5090) @@ -0,0 +1,480 @@ +/* +* JBoss, Home of Professional Open Source +* Copyright 2009, JBoss Inc., and individual contributors as indicated +* by the @authors tag. See the copyright.txt in the distribution for a +* full listing of individual contributors. +* +* This is free software; you can redistribute it and/or modify it +* under the terms of the GNU Lesser General Public License as +* published by the Free Software Foundation; either version 2.1 of +* the License, or (at your option) any later version. +* +* This software is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this software; if not, write to the Free +* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA +* 02110-1301 USA, or see the FSF site: http://www.fsf.org. +*/ +package org.jboss.test.remoting.transport.socket.timeout; + +import java.io.EOFException; +import java.io.IOException; +import java.io.OutputStream; +import java.lang.reflect.Constructor; +import java.net.InetAddress; +import java.net.ServerSocket; +import java.net.Socket; +import java.net.UnknownHostException; +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + +import javax.management.MBeanServer; +import javax.net.ServerSocketFactory; +import javax.net.SocketFactory; +import javax.net.ssl.HandshakeCompletedListener; +import javax.net.ssl.SSLServerSocket; +import javax.net.ssl.SSLServerSocketFactory; +import javax.net.ssl.SSLSession; +import javax.net.ssl.SSLSocket; + +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.InvocationFailureException; +import org.jboss.remoting.InvocationRequest; +import org.jboss.remoting.InvokerLocator; +import org.jboss.remoting.Remoting; +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.security.SSLSocketBuilder; +import org.jboss.remoting.transport.Connector; +import org.jboss.remoting.transport.PortUtil; +import org.jboss.remoting.transport.bisocket.Bisocket; +import org.jboss.remoting.transport.socket.SocketServerInvoker; +import org.jboss.remoting.transport.socket.SocketWrapper; +import org.jboss.test.remoting.transport.socket.timeout.WriteTimeoutTestPa= rent.TestServerSocketFactory; +import org.jboss.test.remoting.transport.socket.timeout.WriteTimeoutTestPa= rent.TestSocketFactory; + + +/** + * Unit tests for JBREM-1120. + * = + * @author Ron Sigal + * @version $Rev$ + *

+ * Copyright Apr 22, 2009 + *

+ */ +public abstract class SSLWriteTimeoutTestParent extends WriteTimeoutTestPa= rent +{ + private static Logger log =3D Logger.getLogger(SSLWriteTimeoutTestParen= t.class); + = + private static boolean firstTime =3D true; + = + protected static int SECONDARY_SERVER_SOCKET_PORT =3D 8765; + protected static String SECONDARY_SERVER_SOCKET_PORT_STRING =3D "8765"; + protected static boolean callbackTest; + = + protected String host; + protected int port; + protected String locatorURI; + protected InvokerLocator serverLocator; + protected Connector connector; + protected TestInvocationHandler invocationHandler; + = + protected void addExtraClientConfig(Map config) {} + protected void addExtraServerConfig(Map config) {} + = + = + public void setUp() throws Exception + { + if (firstTime) + { + String keyStoreFilePath =3D getClass().getResource("../.keystore"= ).getFile(); + System.setProperty("javax.net.ssl.keyStore", keyStoreFilePath); + System.setProperty("javax.net.ssl.keyStorePassword", "unit-tests-= server"); + String trustStoreFilePath =3D getClass().getResource("../.trustst= ore").getFile(); + System.setProperty("javax.net.ssl.trustStore", trustStoreFilePath= ); + System.setProperty("javax.net.ssl.trustStorePassword", "unit-test= s-client"); + } + super.setUp(); + } + = + = + protected String getServerSocketFactoryClassName() + { + return SSLTestServerSocketFactory.class.getName(); + } + = + protected Constructor getServerSocketFactoryConstructor() throws NoSuch= MethodException + { + return SSLTestServerSocketFactory.class.getConstructor(new Class[]{i= nt.class}); + } + = + protected String getSocketFactoryClassName() + { + return SSLTestSocketFactory.class.getName(); + } + = + protected Constructor getSocketFactoryConstructor() throws NoSuchMethod= Exception + { + return SSLTestSocketFactory.class.getConstructor(new Class[]{int.cla= ss}); + } + = + static public class SSLTestServerSocketFactory extends ServerSocketFact= ory + { + int timeout; + ServerSocketFactory factory; + = + public SSLTestServerSocketFactory() throws IOException + { + this.timeout =3D 5000; + setupFactory(); + } = + public SSLTestServerSocketFactory(int timeout) throws IOException + { + this.timeout =3D timeout; + setupFactory(); + } + public ServerSocket createServerSocket() throws IOException + { + ServerSocket ss =3D null; + if (callbackTest) + { + ss =3D SSLServerSocketFactory.getDefault().createServerSocket(= ); + } + else + { + ss =3D new SSLTestServerSocket(timeout, ((SSLServerSocket) fac= tory.createServerSocket())); + } + log.info("returning: " + ss); + return ss; + } + public ServerSocket createServerSocket(int port) throws IOException + { + ServerSocket ss =3D null; + if (callbackTest && port !=3D SECONDARY_SERVER_SOCKET_PORT) + { + ss =3D SSLServerSocketFactory.getDefault().createServerSocket(= port); + } + else + { + ss =3D new SSLTestServerSocket(port, timeout, ((SSLServerSocke= t) factory.createServerSocket())); + } + log.info("returning: " + ss); + return ss; + } + + public ServerSocket createServerSocket(int port, int backlog) throws= IOException + { + ServerSocket ss =3D null; + if (callbackTest && port !=3D SECONDARY_SERVER_SOCKET_PORT) + { + ss =3D SSLServerSocketFactory.getDefault().createServerSocket(= port, backlog); + } + else + { + ss =3D new SSLTestServerSocket(port, backlog, timeout, ((SSLSe= rverSocket) factory.createServerSocket())); + } + log.info("returning: " + ss); + return ss; + } + + public ServerSocket createServerSocket(int port, int backlog, InetAd= dress ifAddress) throws IOException + { + ServerSocket ss =3D null; + if (callbackTest && port !=3D SECONDARY_SERVER_SOCKET_PORT) + { + ss =3D SSLServerSocketFactory.getDefault().createServerSocket(= port, backlog, ifAddress); + } + else + { + ss =3D new SSLTestServerSocket(port, backlog, ifAddress, timeo= ut, ((SSLServerSocket) factory.createServerSocket())); + } + log.info("returning: " + ss); + return ss; + } + = + protected void setupFactory() throws IOException + { + SSLSocketBuilder sslSocketBuilder =3D new SSLSocketBuilder(); + sslSocketBuilder.setUseSSLServerSocketFactory(false); + factory =3D sslSocketBuilder.createSSLServerSocketFactory(); + } + } + = + = + static class SSLTestServerSocket extends SSLServerSocket + { + int timeout; + SSLServerSocket serverSocket; + + public SSLTestServerSocket(int timeout, SSLServerSocket serverSocket= ) throws IOException + { + super(); + this.timeout =3D timeout; + this.serverSocket =3D serverSocket; + } + public SSLTestServerSocket(int port, int timeout, SSLServerSocket se= rverSocket) throws IOException + { + super(port); + this.timeout =3D timeout; + this.serverSocket =3D serverSocket; + } + public SSLTestServerSocket(int port, int backlog, int timeout, SSLSe= rverSocket serverSocket) throws IOException + { + super(port, backlog); + this.timeout =3D timeout; + this.serverSocket =3D serverSocket; + } + public SSLTestServerSocket(int port, int backlog, InetAddress bindAd= dr, int timeout, SSLServerSocket serverSocket) throws IOException + { + super(port, backlog, bindAddr); + this.timeout =3D timeout; + this.serverSocket =3D serverSocket; + } + public Socket accept() throws IOException + { + SSLSocket s1 =3D (SSLSocket) serverSocket.accept(); + Socket s2 =3D new SSLTestSocket(timeout, s1); + implAccept(s2); + return s2; + } + public String toString() + { + return "SSLTestServerSocket[" + serverSocket.toString() + "]"; + } + public boolean getEnableSessionCreation() + { + return serverSocket.getEnableSessionCreation(); + } + public String[] getEnabledCipherSuites() + { + return serverSocket.getEnabledCipherSuites(); + } + public String[] getEnabledProtocols() + { + return serverSocket.getEnabledProtocols(); + } + public boolean getNeedClientAuth() + { + return serverSocket.getNeedClientAuth(); + } + public String[] getSupportedCipherSuites() + { + return serverSocket.getSupportedCipherSuites(); + } + public String[] getSupportedProtocols() + { + return serverSocket.getSupportedProtocols(); + } + public boolean getUseClientMode() + { + return serverSocket.getUseClientMode(); + } + public boolean getWantClientAuth() + { + return serverSocket.getWantClientAuth(); + } + public void setEnableSessionCreation(boolean arg0) + { + serverSocket.setEnableSessionCreation(arg0); + } + public void setEnabledCipherSuites(String[] arg0) + { + serverSocket.setEnabledCipherSuites(arg0); + } + public void setEnabledProtocols(String[] arg0) + { + serverSocket.setEnabledProtocols(arg0); + } + public void setNeedClientAuth(boolean arg0) + { + serverSocket.setNeedClientAuth(arg0); + } + public void setUseClientMode(boolean arg0) + { + serverSocket.setUseClientMode(arg0); + } + public void setWantClientAuth(boolean arg0) + { + serverSocket.setWantClientAuth(arg0); + } + } + = + = + public static class SSLTestSocketFactory extends SocketFactory + { + int timeout; + SocketFactory factory; + = + public SSLTestSocketFactory() throws IOException + { + timeout =3D 5000; + setupFactory(); + } + public SSLTestSocketFactory(int timeout) throws IOException + { + this.timeout =3D timeout; + setupFactory(); + } + public Socket createSocket() throws IOException + { + return new SSLTestSocket(timeout, ((SSLSocket) factory.createSock= et())); + } + public Socket createSocket(String arg0, int arg1) throws IOException= , UnknownHostException + { + return new SSLTestSocket(arg0, arg1, timeout, ((SSLSocket) factor= y.createSocket())); + } + + public Socket createSocket(InetAddress arg0, int arg1) throws IOExce= ption + { + return new SSLTestSocket(arg0, arg1, timeout, ((SSLSocket) factor= y.createSocket())); + } + + public Socket createSocket(String arg0, int arg1, InetAddress arg2, = int arg3) throws IOException, UnknownHostException + { + return new SSLTestSocket(arg0, arg1, arg2, arg3, timeout, ((SSLSo= cket) factory.createSocket())); + } + + public Socket createSocket(InetAddress arg0, int arg1, InetAddress a= rg2, int arg3) throws IOException + { + return new SSLTestSocket(arg0, arg1, arg2, arg3, timeout, ((SSLSo= cket) factory.createSocket())); + } + = + protected void setupFactory() throws IOException + { + SSLSocketBuilder sslSocketBuilder =3D new SSLSocketBuilder(); + sslSocketBuilder.setUseSSLServerSocketFactory(false); + factory =3D sslSocketBuilder.createSSLSocketFactory(); + } + } + = + static class SSLTestSocket extends SSLSocket + { + int timeout; + SSLSocket socket; + = + public SSLTestSocket(int timeout, SSLSocket socket) + { + this.timeout =3D timeout; + this.socket =3D socket; + } + public SSLTestSocket(String host, int port, int timeout, SSLSocket s= ocket) throws UnknownHostException, IOException + { + super(host, port); + this.timeout =3D timeout; + this.socket =3D socket; + } + public SSLTestSocket(InetAddress address, int port, int timeout, SSL= Socket socket) throws IOException + { + super(address, port); + this.timeout =3D timeout; + this.socket =3D socket; + } + public SSLTestSocket(String host, int port, InetAddress localAddr, i= nt localPort, int timeout, SSLSocket socket) throws IOException + { + super(host, port, localAddr, localPort); + this.timeout =3D timeout; + this.socket =3D socket; + } + public SSLTestSocket(InetAddress address, int port, InetAddress loca= lAddr, int localPort, int timeout, SSLSocket socket) throws IOException + { + super(address, port, localAddr, localPort); + this.timeout =3D timeout; + this.socket =3D socket; + } + public String toString() + { + return "SSLTestSocket[" + socket.toString() + "]"; + } + public OutputStream getOutputStream() throws IOException + { + return new TestOutputStream(socket.getOutputStream(), timeout); + } + public void addHandshakeCompletedListener(HandshakeCompletedListener= listener) + { + socket.addHandshakeCompletedListener(listener); + } + public boolean getEnableSessionCreation() + { + return socket.getEnableSessionCreation(); + } + public String[] getEnabledCipherSuites() + { + return socket.getEnabledCipherSuites(); + } + public String[] getEnabledProtocols() + { + return socket.getEnabledProtocols(); + } + public boolean getNeedClientAuth() + { + return socket.getNeedClientAuth(); + } + public SSLSession getSession() + { + return socket.getSession(); + } + public String[] getSupportedCipherSuites() + { + return socket.getSupportedCipherSuites(); + } + public String[] getSupportedProtocols() + { + return socket.getSupportedProtocols(); + } + public boolean getUseClientMode() + { + return socket.getUseClientMode(); + } + public boolean getWantClientAuth() + { + return socket.getWantClientAuth(); + } + public void removeHandshakeCompletedListener(HandshakeCompletedListe= ner listener) + { + socket.removeHandshakeCompletedListener(listener); + } + public void setEnableSessionCreation(boolean flag) + { + socket.setEnableSessionCreation(flag); + } + public void setEnabledCipherSuites(String[] suites) + { + socket.setEnabledCipherSuites(suites); + } + public void setEnabledProtocols(String[] protocols) + { + socket.setEnabledProtocols(protocols); + } + public void setNeedClientAuth(boolean need) + { + socket.setNeedClientAuth(need); + } + public void setUseClientMode(boolean mode) + { + socket.setUseClientMode(mode); + } + public void setWantClientAuth(boolean want) + { + socket.setWantClientAuth(want); + } + public void startHandshake() throws IOException + { + socket.startHandshake(); + } + } +} \ No newline at end of file --===============1656433409808829856==-- From jboss-remoting-commits at lists.jboss.org Thu Apr 23 02:32:25 2009 Content-Type: multipart/mixed; boundary="===============6120184588046525446==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5091 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/socket/ssl/timeout. Date: Thu, 23 Apr 2009 02:28:22 -0400 Message-ID: --===============6120184588046525446== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-23 02:28:22 -0400 (Thu, 23 Apr 2009) New Revision: 5091 Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/socke= t/ssl/timeout/SSLSocketWriteTimeoutTestCase.java Log: JBREM-1120: New unit tests. Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/s= ocket/ssl/timeout/SSLSocketWriteTimeoutTestCase.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/sock= et/ssl/timeout/SSLSocketWriteTimeoutTestCase.java (= rev 0) +++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/sock= et/ssl/timeout/SSLSocketWriteTimeoutTestCase.java 2009-04-23 06:28:22 UTC (= rev 5091) @@ -0,0 +1,41 @@ +/* +* JBoss, Home of Professional Open Source +* Copyright 2009, JBoss Inc., and individual contributors as indicated +* by the @authors tag. See the copyright.txt in the distribution for a +* full listing of individual contributors. +* +* This is free software; you can redistribute it and/or modify it +* under the terms of the GNU Lesser General Public License as +* published by the Free Software Foundation; either version 2.1 of +* the License, or (at your option) any later version. +* +* This software is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this software; if not, write to the Free +* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA +* 02110-1301 USA, or see the FSF site: http://www.fsf.org. +*/ +package org.jboss.test.remoting.transport.socket.ssl.timeout; + +import org.jboss.test.remoting.transport.socket.timeout.SSLWriteTimeoutTes= tParent; + +/** + * Unit tests for JBREM-1120. + * = + * @author Ron Sigal + * @version $Rev$ + *

+ * Copyright Apr 22, 2009 + *

+ */ +public class SSLSocketWriteTimeoutTestCase extends SSLWriteTimeoutTestPare= nt +{ + protected String getTransport() + { + return "sslsocket"; + } +} --===============6120184588046525446==-- From jboss-remoting-commits at lists.jboss.org Mon Apr 27 21:16:41 2009 Content-Type: multipart/mixed; boundary="===============4498922485768621533==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5092 - in remoting3/trunk: taglet and 7 other directories. Date: Mon, 27 Apr 2009 21:13:55 -0400 Message-ID: --===============4498922485768621533== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: david.lloyd(a)jboss.com Date: 2009-04-27 21:13:55 -0400 (Mon, 27 Apr 2009) New Revision: 5092 Added: remoting3/trunk/taglet/ remoting3/trunk/taglet/pom.xml remoting3/trunk/taglet/src/ remoting3/trunk/taglet/src/main/ remoting3/trunk/taglet/src/main/java/ remoting3/trunk/taglet/src/main/java/org/ remoting3/trunk/taglet/src/main/java/org/jboss/ remoting3/trunk/taglet/src/main/java/org/jboss/remoting3/ remoting3/trunk/taglet/src/main/java/org/jboss/remoting3/taglet/ remoting3/trunk/taglet/src/main/java/org/jboss/remoting3/taglet/Remoting= ConsumeTaglet.java remoting3/trunk/taglet/src/main/java/org/jboss/remoting3/taglet/Remoting= ImplementTaglet.java remoting3/trunk/taglet/src/main/java/org/jboss/remoting3/taglet/Remoting= InternalTaglet.java remoting3/trunk/taglet/src/main/java/org/jboss/remoting3/taglet/Remoting= TypeTaglet.java Log: Add remoting API description taglet Added: remoting3/trunk/taglet/pom.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/taglet/pom.xml (rev 0) +++ remoting3/trunk/taglet/pom.xml 2009-04-28 01:13:55 UTC (rev 5092) @@ -0,0 +1,56 @@ + + + + + 4.0.0 + + org.jboss.remoting + jboss-remoting-taglet + jar + 1.1.0.CR1 + + + + com.sun + tools + 1.5.0 + system + ${java.home}/../lib/tools.jar + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.0.2 + + 1.5 + 1.5 + + + + + \ No newline at end of file Added: remoting3/trunk/taglet/src/main/java/org/jboss/remoting3/taglet/Remo= tingConsumeTaglet.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/taglet/src/main/java/org/jboss/remoting3/taglet/Remotin= gConsumeTaglet.java (rev 0) +++ remoting3/trunk/taglet/src/main/java/org/jboss/remoting3/taglet/Remotin= gConsumeTaglet.java 2009-04-28 01:13:55 UTC (rev 5092) @@ -0,0 +1,39 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2009, 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.remoting3.taglet; + +import com.sun.javadoc.Tag; + +public final class RemotingConsumeTaglet extends RemotingTypeTaglet { + + public String getName() { + return "remoting.consume"; + } + + public String toString(final Tag tag) { + String t =3D tag.holder().isInterface() ? "interface" : tag.holder= ().isClass() ? "class" : "type"; + return "

This " + t + " is part of the Remoting 3 public API. W= hile instances of this type may " + + "be used publicly, users are not encouraged to implement o= r extend this type as members may be " + + "added without notice.\n"; + } +} Added: remoting3/trunk/taglet/src/main/java/org/jboss/remoting3/taglet/Remo= tingImplementTaglet.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/taglet/src/main/java/org/jboss/remoting3/taglet/Remotin= gImplementTaglet.java (rev 0) +++ remoting3/trunk/taglet/src/main/java/org/jboss/remoting3/taglet/Remotin= gImplementTaglet.java 2009-04-28 01:13:55 UTC (rev 5092) @@ -0,0 +1,41 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2009, 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.remoting3.taglet; + +import com.sun.javadoc.Tag; + +public final class RemotingImplementTaglet extends RemotingTypeTaglet { + + public String getName() { + return "remoting.implement"; + } + + public String toString(final Tag tag) { + final boolean isinterface =3D tag.holder().isInterface(); + String t =3D isinterface ? "interface" : tag.holder().isClass() ? = "class" : "type"; + String e =3D isinterface ? "implemented" : "extended"; + return "

This " + t + " is part of the Remoting 3 public API, an= d is intended to be " + e + " by " + + "users of this API. Abstract members will generally not b= e added to such types so as to avoid " + + "backwards compatibility problems.\n"; + } +} Added: remoting3/trunk/taglet/src/main/java/org/jboss/remoting3/taglet/Remo= tingInternalTaglet.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/taglet/src/main/java/org/jboss/remoting3/taglet/Remotin= gInternalTaglet.java (rev 0) +++ remoting3/trunk/taglet/src/main/java/org/jboss/remoting3/taglet/Remotin= gInternalTaglet.java 2009-04-28 01:13:55 UTC (rev 5092) @@ -0,0 +1,39 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2009, 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.remoting3.taglet; + +import com.sun.javadoc.Tag; + +public final class RemotingInternalTaglet extends RemotingTypeTaglet { + + public String getName() { + return "remoting.internal"; + } + + public String toString(final Tag tag) { + String t =3D tag.holder().isInterface() ? "interface" : tag.holder= ().isClass() ? "class" : "type"; + return "

Internal Class - this " + t + " is part of the i= nternal Remoting 3 implementation and is " + + "not intended to be used or consumed publicly. Mem= bers of this class may be added, removed, " + + "and/or changed without notice.\n"; + } +} Added: remoting3/trunk/taglet/src/main/java/org/jboss/remoting3/taglet/Remo= tingTypeTaglet.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/taglet/src/main/java/org/jboss/remoting3/taglet/Remotin= gTypeTaglet.java (rev 0) +++ remoting3/trunk/taglet/src/main/java/org/jboss/remoting3/taglet/Remotin= gTypeTaglet.java 2009-04-28 01:13:55 UTC (rev 5092) @@ -0,0 +1,73 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2009, 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.remoting3.taglet; + +import java.util.Map; + +import com.sun.javadoc.Tag; +import com.sun.tools.doclets.Taglet; + +public abstract class RemotingTypeTaglet implements Taglet { + + public boolean inField() { + return false; + } + + public boolean inConstructor() { + return false; + } + + public boolean inMethod() { + return false; + } + + public boolean inOverview() { + return false; + } + + public boolean inPackage() { + return false; + } + + public boolean inType() { + return true; + } + + public boolean isInlineTag() { + return false; + } + + public String toString(final Tag[] tags) { + return tags.length > 0 ? toString(tags[0]) : ""; + } + + private static void add(Map tagletMap, Taglet taglet) { + tagletMap.put(taglet.getName(), taglet); + } + + public static void register(Map tagletMap) { + add(tagletMap, new RemotingConsumeTaglet()); + add(tagletMap, new RemotingImplementTaglet()); + add(tagletMap, new RemotingInternalTaglet()); + } +} --===============4498922485768621533==-- From jboss-remoting-commits at lists.jboss.org Thu Apr 30 01:33:30 2009 Content-Type: multipart/mixed; boundary="===============6170718546389822845==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5093 - remoting2/branches/2.2.2-SP11_JBREM-1112/src/tests/org/jboss/test/remoting/connection. Date: Thu, 30 Apr 2009 01:27:56 -0400 Message-ID: --===============6170718546389822845== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-30 01:27:56 -0400 (Thu, 30 Apr 2009) New Revision: 5093 Modified: remoting2/branches/2.2.2-SP11_JBREM-1112/src/tests/org/jboss/test/remoti= ng/connection/ConnectionValidatorDisconnectTimeoutTestCase.java Log: JBREM-1112: Removed test methods that depend on (non-existent) Client.USE_A= LL_PARAMS. Modified: remoting2/branches/2.2.2-SP11_JBREM-1112/src/tests/org/jboss/test= /remoting/connection/ConnectionValidatorDisconnectTimeoutTestCase.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.2.2-SP11_JBREM-1112/src/tests/org/jboss/test/remot= ing/connection/ConnectionValidatorDisconnectTimeoutTestCase.java 2009-04-28= 01:13:55 UTC (rev 5092) +++ remoting2/branches/2.2.2-SP11_JBREM-1112/src/tests/org/jboss/test/remot= ing/connection/ConnectionValidatorDisconnectTimeoutTestCase.java 2009-04-30= 05:27:56 UTC (rev 5093) @@ -216,89 +216,89 @@ } = = - public void testZeroInvokerLocator() throws Throwable - { - log.info("entering " + getName()); - = - // Start server. - setupServer(); - = - // Create client. - String clientLocatorURI =3D locatorURI; - clientLocatorURI +=3D "/?" + Client.USE_ALL_PARAMS + "=3Dtrue"; - clientLocatorURI +=3D "&" + ConnectionValidator.FAILURE_DISCONNECT_T= IMEOUT + "=3D0"; - InvokerLocator clientLocator =3D new InvokerLocator(clientLocatorURI= ); - HashMap clientConfig =3D new HashMap(); - clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); - clientConfig.put(Client.ENABLE_LEASE, "true"); - addExtraClientConfig(clientConfig); - Client client =3D new Client(clientLocator, clientConfig); - client.connect(); - log.info("client is connected"); - = - // Test connections. - assertEquals("abc", client.invoke("abc")); - log.info("connection is good"); - = - // Install ConnectionListener. - TestConnectionListener clientConnectionListener =3D new TestConnecti= onListener("CLIENT"); - client.addConnectionListener(clientConnectionListener, new HashMap()= ); - = - // Wait for broken connection and test. - Thread.sleep(8000); - assertTrue(serverConnectionListener.notified); - assertNull(serverConnectionListener.throwable); - assertTrue(clientConnectionListener.notified); - assertTrue(clientConnectionListener.throwable instanceof Exception); - assertEquals("Could not connect to server!", ((Exception)clientConne= ctionListener.throwable).getMessage()); - = - client.removeConnectionListener(clientConnectionListener); - client.disconnect(); - shutdownServer(); - log.info(getName() + " PASSES"); - } +// public void testZeroInvokerLocator() throws Throwable +// { +// log.info("entering " + getName()); +// = +// // Start server. +// setupServer(); +// = +// // Create client. +// String clientLocatorURI =3D locatorURI; +// clientLocatorURI +=3D "/?" + Client.USE_ALL_PARAMS + "=3Dtrue"; +// clientLocatorURI +=3D "&" + ConnectionValidator.FAILURE_DISCONNECT= _TIMEOUT + "=3D0"; +// InvokerLocator clientLocator =3D new InvokerLocator(clientLocatorU= RI); +// HashMap clientConfig =3D new HashMap(); +// clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); +// clientConfig.put(Client.ENABLE_LEASE, "true"); +// addExtraClientConfig(clientConfig); +// Client client =3D new Client(clientLocator, clientConfig); +// client.connect(); +// log.info("client is connected"); +// = +// // Test connections. +// assertEquals("abc", client.invoke("abc")); +// log.info("connection is good"); +// = +// // Install ConnectionListener. +// TestConnectionListener clientConnectionListener =3D new TestConnec= tionListener("CLIENT"); +// client.addConnectionListener(clientConnectionListener, new HashMap= ()); +// = +// // Wait for broken connection and test. +// Thread.sleep(8000); +// assertTrue(serverConnectionListener.notified); +// assertNull(serverConnectionListener.throwable); +// assertTrue(clientConnectionListener.notified); +// assertTrue(clientConnectionListener.throwable instanceof Exception= ); +// assertEquals("Could not connect to server!", ((Exception)clientCon= nectionListener.throwable).getMessage()); +// = +// client.removeConnectionListener(clientConnectionListener); +// client.disconnect(); +// shutdownServer(); +// log.info(getName() + " PASSES"); +// } = = - public void testNonZeroInvokerLocator() throws Throwable - { - log.info("entering " + getName()); - = - // Start server. - setupServer(); - = - // Create client. - String clientLocatorURI =3D locatorURI; - clientLocatorURI +=3D "/?" + Client.USE_ALL_PARAMS + "=3Dtrue"; - clientLocatorURI +=3D "&" + ConnectionValidator.FAILURE_DISCONNECT_T= IMEOUT + "=3D10000"; - InvokerLocator clientLocator =3D new InvokerLocator(clientLocatorURI= ); - HashMap clientConfig =3D new HashMap(); - clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); - clientConfig.put(Client.ENABLE_LEASE, "true"); - addExtraClientConfig(clientConfig); - Client client =3D new Client(clientLocator, clientConfig); - client.connect(); - log.info("client is connected"); - = - // Test connections. - assertEquals("abc", client.invoke("abc")); - log.info("connection is good"); - = - // Install ConnectionListener. - TestConnectionListener clientConnectionListener =3D new TestConnecti= onListener("CLIENT"); - client.addConnectionListener(clientConnectionListener, new HashMap()= ); - = - // Wait for broken connection and test. - Thread.sleep(4000); - assertTrue(serverConnectionListener.notified); - assertTrue(serverConnectionListener.throwable instanceof ClientDisco= nnectedException); - assertTrue(clientConnectionListener.notified); - assertTrue(clientConnectionListener.throwable instanceof Exception); - assertEquals("Could not connect to server!", ((Exception)clientConne= ctionListener.throwable).getMessage()); - = - client.disconnect(); - shutdownServer(); - log.info(getName() + " PASSES"); - } +// public void testNonZeroInvokerLocator() throws Throwable +// { +// log.info("entering " + getName()); +// = +// // Start server. +// setupServer(); +// = +// // Create client. +// String clientLocatorURI =3D locatorURI; +// clientLocatorURI +=3D "/?" + Client.USE_ALL_PARAMS + "=3Dtrue"; +// clientLocatorURI +=3D "&" + ConnectionValidator.FAILURE_DISCONNECT= _TIMEOUT + "=3D10000"; +// InvokerLocator clientLocator =3D new InvokerLocator(clientLocatorU= RI); +// HashMap clientConfig =3D new HashMap(); +// clientConfig.put(InvokerLocator.FORCE_REMOTE, "true"); +// clientConfig.put(Client.ENABLE_LEASE, "true"); +// addExtraClientConfig(clientConfig); +// Client client =3D new Client(clientLocator, clientConfig); +// client.connect(); +// log.info("client is connected"); +// = +// // Test connections. +// assertEquals("abc", client.invoke("abc")); +// log.info("connection is good"); +// = +// // Install ConnectionListener. +// TestConnectionListener clientConnectionListener =3D new TestConnec= tionListener("CLIENT"); +// client.addConnectionListener(clientConnectionListener, new HashMap= ()); +// = +// // Wait for broken connection and test. +// Thread.sleep(4000); +// assertTrue(serverConnectionListener.notified); +// assertTrue(serverConnectionListener.throwable instanceof ClientDis= connectedException); +// assertTrue(clientConnectionListener.notified); +// assertTrue(clientConnectionListener.throwable instanceof Exception= ); +// assertEquals("Could not connect to server!", ((Exception)clientCon= nectionListener.throwable).getMessage()); +// = +// client.disconnect(); +// shutdownServer(); +// log.info(getName() + " PASSES"); +// } = = public void testZeroConfig() throws Throwable --===============6170718546389822845==-- From jboss-remoting-commits at lists.jboss.org Thu Apr 30 17:34:08 2009 Content-Type: multipart/mixed; boundary="===============4550360753872557670==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5094 - remoting2/branches/2.2.2-SP11_JBREM-1112/src/main/org/jboss/remoting. Date: Thu, 30 Apr 2009 17:32:26 -0400 Message-ID: --===============4550360753872557670== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-30 17:32:26 -0400 (Thu, 30 Apr 2009) New Revision: 5094 Modified: remoting2/branches/2.2.2-SP11_JBREM-1112/src/main/org/jboss/remoting/Cli= ent.java remoting2/branches/2.2.2-SP11_JBREM-1112/src/main/org/jboss/remoting/Con= nectionNotifier.java remoting2/branches/2.2.2-SP11_JBREM-1112/src/main/org/jboss/remoting/Con= nectionValidator.java remoting2/branches/2.2.2-SP11_JBREM-1112/src/main/org/jboss/remoting/Lea= se.java remoting2/branches/2.2.2-SP11_JBREM-1112/src/main/org/jboss/remoting/Lea= sePinger.java remoting2/branches/2.2.2-SP11_JBREM-1112/src/main/org/jboss/remoting/Mic= roRemoteClientInvoker.java remoting2/branches/2.2.2-SP11_JBREM-1112/src/main/org/jboss/remoting/Rem= oting.java remoting2/branches/2.2.2-SP11_JBREM-1112/src/main/org/jboss/remoting/Ser= verInvoker.java remoting2/branches/2.2.2-SP11_JBREM-1112/src/main/org/jboss/remoting/Ver= sion.java Log: JBREM-1112 (and others to be named): LeasePingerID, single ConnectionValida= tor per client invoker. Modified: remoting2/branches/2.2.2-SP11_JBREM-1112/src/main/org/jboss/remot= ing/Client.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.2.2-SP11_JBREM-1112/src/main/org/jboss/remoting/Cl= ient.java 2009-04-30 05:27:56 UTC (rev 5093) +++ remoting2/branches/2.2.2-SP11_JBREM-1112/src/main/org/jboss/remoting/Cl= ient.java 2009-04-30 21:32:26 UTC (rev 5094) @@ -49,6 +49,7 @@ import java.io.ObjectInput; import java.io.ObjectOutput; import java.io.StreamCorruptedException; +import java.lang.ref.WeakReference; import java.net.InetAddress; import java.net.SocketTimeoutException; import java.rmi.MarshalException; @@ -152,6 +153,9 @@ public static final int DEFAULT_DISCONNECT_TIMEOUT =3D -1; = public static final String THROW_CALLBACK_EXCEPTION =3D "throwCallbackE= xception"; + = + private static Map connectionValidators =3D new HashMap(); + private static Object connectionValidatorLock =3D new Object(); = private static final Logger log =3D Logger.getLogger(Client.class); = @@ -175,6 +179,7 @@ private InvokerLocator locator; = private ConnectionValidator connectionValidator =3D null; + private ConnectionValidatorKey connectionValidatorKey; private Map configuration =3D new HashMap(); = private Map callbackConnectors =3D new HashMap(); @@ -187,6 +192,8 @@ private int disconnectTimeout =3D DEFAULT_DISCONNECT_TIMEOUT; = private boolean connected =3D false; + = + private Set connectionListeners =3D new HashSet(); = // Constructors -------------------------------------------------------= -------------------------- = @@ -384,11 +391,54 @@ } } = - if (connectionValidator =3D=3D null) + synchronized (connectionValidatorLock) { - connectionValidator =3D new ConnectionValidator(this, metadata); + if (connectionValidator =3D=3D null) + { + Map map =3D new HashMap(configuration); + map.putAll(metadata); + connectionValidatorKey =3D new ConnectionValidatorKey(invoker,= map); + WeakReference ref =3D (WeakReference) connectionValidators.get= (connectionValidatorKey); + if (ref =3D=3D null) + { + connectionValidator =3D new ConnectionValidator(this, metad= ata); + connectionValidators.put(connectionValidatorKey, new WeakRe= ference(connectionValidator)); + connectionValidator.addConnectionListener(this, listener); + log.debug(this + ": created " + connectionValidator); + } + else + { + connectionValidator =3D (ConnectionValidator) ref.get(); + if (connectionValidator.addConnectionListener(this, listene= r)) + { + log.debug(this + ": reusing from static table: " + conn= ectionValidator); = + } + else + { + connectionValidator =3D new ConnectionValidator(this, me= tadata); + connectionValidators.put(connectionValidatorKey, new Wea= kReference(connectionValidator)); + connectionValidator.addConnectionListener(this, listener= ); + log.debug(this + ": current ConnectionValidator is stopp= ed: created " + connectionValidator); + } + } + } + else + { + if (connectionValidator.addConnectionListener(this, listener)) + { + log.debug(this + ": reusing from local reference: " + conne= ctionValidator); = + } + else + { + connectionValidator =3D new ConnectionValidator(this, metad= ata); + connectionValidators.put(connectionValidatorKey, new WeakRe= ference(connectionValidator)); + connectionValidator.addConnectionListener(this, listener); + log.debug(this + ": current ConnectionValidator is stopped:= created " + connectionValidator); + } + } + = + connectionListeners.add(listener); } - connectionValidator.addConnectionListener(listener); } = /** @@ -397,11 +447,29 @@ */ public boolean removeConnectionListener(ConnectionListener listener) { - if (connectionValidator =3D=3D null) + boolean isRemoved =3D false; + synchronized (connectionValidatorLock) { - return false; + if (connectionValidator =3D=3D null) + { + return false; + } + isRemoved =3D connectionValidator.removeConnectionListener(this, = listener); + if (connectionValidator.isStopped()) + { + connectionValidators.remove(connectionValidatorKey); + log.debug(this + " removed from static map: " + connectionVali= dator); + connectionValidator =3D null; + connectionValidatorKey =3D null; + } + connectionListeners.remove(listener); + if (connectionListeners.isEmpty()) + { + connectionValidator =3D null; + connectionValidatorKey =3D null; + } } - return connectionValidator.removeConnectionListener(listener); + return isRemoved; } = /** @@ -483,10 +551,25 @@ // this is a noop if no lease is active invoker.terminateLease(sessionId, disconnectTimeout); = - if (connectionValidator !=3D null) + synchronized (connectionValidatorLock) { - connectionValidator.stop(); + if (connectionValidator !=3D null) + { + Iterator it =3D connectionListeners.iterator(); + while (it.hasNext()) + { + ConnectionListener listener =3D (ConnectionListener) it.= next(); + connectionValidator.removeConnectionListener(this, liste= ner); + } + if (connectionValidator.isStopped()) + { + connectionValidators.remove(connectionValidatorKey); + log.debug(this + " removed from static map: " + connecti= onValidator); + } + } + // connectionValidator.stop(); connectionValidator =3D null; + connectionValidatorKey =3D null; } = // Need to remove myself from registry so will not keep reference= to me since I am of no @@ -1537,6 +1620,7 @@ e.initCause(throwable); throw e; } + log.debug(this + " connected to " + locator); } else { @@ -1726,4 +1810,32 @@ = = // Inner classes ------------------------------------------------------= -------------------------- + = + static class ConnectionValidatorKey + { + private ClientInvoker invoker; + private Map metadata; + = + ConnectionValidatorKey(ClientInvoker invoker, Map metadata) + { + this.invoker =3D invoker; + this.metadata =3D metadata; + } + = + public boolean equals(Object o) + { + if (o =3D=3D null) + return false; + if (! (o instanceof ConnectionValidatorKey)) + return false; + ConnectionValidatorKey holder =3D (ConnectionValidatorKey) o; + boolean metadataEquals =3D (metadata =3D=3D null && holder.metada= ta =3D=3D null) || metadata.equals(holder.metadata); = + return invoker =3D=3D holder.invoker && metadataEquals; + } + = + public int hashCode() + { + return invoker.hashCode() * metadata.hashCode(); + } + } } Modified: remoting2/branches/2.2.2-SP11_JBREM-1112/src/main/org/jboss/remot= ing/ConnectionNotifier.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.2.2-SP11_JBREM-1112/src/main/org/jboss/remoting/Co= nnectionNotifier.java 2009-04-30 05:27:56 UTC (rev 5093) +++ remoting2/branches/2.2.2-SP11_JBREM-1112/src/main/org/jboss/remoting/Co= nnectionNotifier.java 2009-04-30 21:32:26 UTC (rev 5094) @@ -43,7 +43,7 @@ { try { - log.debug("Server connection lost to client (session id =3D " + c= lientSessionId); + log.debug(this + " Server connection lost to client (session id = =3D " + clientSessionId); Client client =3D new Client(new InvokerLocator(locatorurl), requ= estPayload); client.setSessionId(clientSessionId); = @@ -52,7 +52,9 @@ Iterator it =3D listeners.iterator(); while (it.hasNext()) { - ((ConnectionListener) it.next()).handleConnectionException(= null, client); + ConnectionListener listener =3D (ConnectionListener) it.nex= t(); + listener.handleConnectionException(null, client); + log.debug("notified " + listener + " of connection lost to:= " + clientSessionId); } } } @@ -66,9 +68,9 @@ { try { - if(log.isTraceEnabled()) +// if(log.isTraceEnabled()) { - log.trace("Client disconnected (session id =3D " + clientSessi= onId); + log.debug(this + " Client disconnected (session id =3D " + cli= entSessionId); } Client client =3D new Client(new InvokerLocator(locatorURL), requ= estPayload); client.setSessionId(clientSessionId); Modified: remoting2/branches/2.2.2-SP11_JBREM-1112/src/main/org/jboss/remot= ing/ConnectionValidator.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.2.2-SP11_JBREM-1112/src/main/org/jboss/remoting/Co= nnectionValidator.java 2009-04-30 05:27:56 UTC (rev 5093) +++ remoting2/branches/2.2.2-SP11_JBREM-1112/src/main/org/jboss/remoting/Co= nnectionValidator.java 2009-04-30 21:32:26 UTC (rev 5094) @@ -22,11 +22,11 @@ = package org.jboss.remoting; = -import java.util.ArrayList; import java.util.HashMap; -import java.util.List; -import java.util.ListIterator; +import java.util.HashSet; +import java.util.Iterator; import java.util.Map; +import java.util.Set; import java.util.Timer; import java.util.TimerTask; = @@ -230,7 +230,7 @@ private Map metadata; private InvokerLocator locator; private Map configMap; - private List listeners; + private Map listeners; private ClientInvoker clientInvoker; private Object lock =3D new Object(); private Object notificationLock =3D new Object(); @@ -243,6 +243,8 @@ private int failureDisconnectTimeout =3D -1; private boolean isValid; private Timer timer; + private MicroRemoteClientInvoker sharedInvoker; + private LeasePinger leasePinger; = // Constructors -------------------------------------------------------= -------------------------- = @@ -254,8 +256,9 @@ public ConnectionValidator(Client client, long pingPeriod) { this.client =3D client; + this.locator =3D client.getInvoker().getLocator(); this.pingPeriod =3D pingPeriod; - listeners =3D new ArrayList(); + listeners =3D new HashMap(); stopped =3D false; getParameters(client, new HashMap()); log.debug(this + " created"); @@ -264,8 +267,9 @@ public ConnectionValidator(Client client, Map metadata) { this.client =3D client; + this.locator =3D client.getInvoker().getLocator(); pingPeriod =3D DEFAULT_PING_PERIOD; - listeners =3D new ArrayList(); + listeners =3D new HashMap(); stopped =3D false; this.metadata =3D new HashMap(metadata); getParameters(client, metadata); @@ -367,36 +371,79 @@ = // Public -------------------------------------------------------------= -------------------------- = - public void addConnectionListener(ConnectionListener listener) + public boolean addConnectionListener(Client client, ConnectionListener = listener) { + boolean doStart =3D false; if (listener !=3D null) { synchronized (lock) { + if (stopped) + { + log.debug(this + " is stopped. Cannot add ConnectionListene= r: " + listener + " for " + client); + return false; + } if (listeners.size() =3D=3D 0) { - start(); + doStart =3D true; } - listeners.add(listener); + Set s =3D (Set) listeners.get(listener); + if (s =3D=3D null) + { + s =3D new HashSet(); + } + s.add(client); + listeners.put(listener, s); + log.debug(this + " added ConnectionListener: " + listener + " = for " + client); } + if (doStart) + { + start(); + } } + = + return true; } = - public boolean removeConnectionListener(ConnectionListener listener) + public boolean removeConnectionListener(Client client, ConnectionListen= er listener) { - boolean isRemoved =3D false; - if (listener !=3D null) + if (listener =3D=3D null) { - synchronized (lock) + log.debug(this + " ConnectionListener is null"); + return false; + } + synchronized (lock) + { + if (stopped) { - isRemoved =3D listeners.remove(listener); - if (listeners.size() =3D=3D 0) - { - stop(); - } + log.debug(this + " is stopped. It's too late to remove " + lis= tener); + return false; } + Set s =3D (Set) listeners.get(listener); + if (s =3D=3D null) + { + log.debug(this + ": " + listener + " is not registered"); + return false; + } + if (s.remove(client)) + { + log.debug(this + " removed ConnectionListener: " + listener + = " for " + client); + } + else + { + log.debug(this + ": " + listener + " is not registered for " += client); + return false; + } + if (s.size() =3D=3D 0) + { + listeners.remove(listener); + } + if (listeners.size() =3D=3D 0) + { + stop(); + } } - return isRemoved; + return true; } = public long getPingPeriod() @@ -413,6 +460,11 @@ { return "ConnectionValidator[" + Integer.toHexString(System.identityH= ashCode(this)) + ":" + clientInvoker + ", pingPeriod=3D" + pingPeriod + " m= s]"; } + = + public boolean isStopped() + { + return stopped; + } = // Package protected --------------------------------------------------= -------------------------- = @@ -434,6 +486,14 @@ { throw new RuntimeException("creating a ConnectionValidator on a l= ocal connection"); } + if (stopLeaseOnFailure) + { + sharedInvoker =3D (MicroRemoteClientInvoker) client.getInvoker(); + if (sharedInvoker !=3D null) + { + leasePinger =3D sharedInvoker.getLeasePinger(); + } + } } = private void getParametersFromMap(Map config) @@ -505,8 +565,17 @@ " to a boolean: must be a String"); } } - = + ClientInvoker invoker =3D client.getInvoker(); + if (invoker =3D=3D null) + { + log.debug(this + " client invoker =3D=3D null"); + } + else + { + log.debug(this + " InvokerLocator: " + invoker.getLocator()); + } o =3D config.get(FAILURE_DISCONNECT_TIMEOUT); + log.debug(this + " \"failureDisconnectTimeout\" set to " + o); if (o !=3D null) { if (o instanceof String) @@ -514,6 +583,7 @@ try { failureDisconnectTimeout =3D Integer.valueOf(((String) o= )).intValue(); + log.debug(this + " setting failureDisconnectTimeout to "= + failureDisconnectTimeout); } catch (Exception e) { @@ -537,7 +607,6 @@ log.debug(this + " timeout: " + pingTimeout); log.debug(this + " ping retries: " + configMap.get("NumberOfCallRetr= ies")); log.debug(this + " connection retries: " + configMap.get("NumberOfRe= tries")); - locator =3D client.getInvoker().getLocator(); = try { @@ -555,7 +624,14 @@ clientInvoker.connect(); } = + try + { TimerUtil.schedule(this, pingPeriod); + } + catch (Exception e) + { + log.error(this + " unable to schedule on TimerUtil", e); + } started =3D true; timer =3D new Timer(true); log.debug(this + " started"); @@ -623,6 +699,7 @@ = private boolean doStop() { + log.debug("entering doStop()"); synchronized(lock) { if (stopped) @@ -659,22 +736,33 @@ { return; } - ListIterator itr =3D listeners.listIterator(); + stopped =3D true; + log.debug(this + " is stopped. No more listeners will be accepte= d."); + = + Iterator itr =3D listeners.keySet().iterator(); while (itr.hasNext()) { final ConnectionListener listener =3D (ConnectionListener) itr= .next(); - new Thread() + Set clients =3D (Set) listeners.get(listener); + Iterator itr2 =3D clients.iterator(); + while (itr2.hasNext()) { - public void run() + final Client client =3D (Client) itr2.next(); + new Thread() { - log.debug(this + " calling " + listener + ".handleConnec= tionException()"); - listener.handleConnectionException(t, client); - } - }.start(); + public void run() + { + log.debug(this + " calling " + listener + ".handleCon= nectionException() for " + client); + listener.handleConnectionException(t, client); + } + }.start(); + } } + = + listeners.clear(); } + = stop(); - listeners.clear(); } = // Inner classes ------------------------------------------------------= -------------------------- @@ -715,19 +803,23 @@ = if (stopLeaseOnFailure) { - log.debug(this + " detected connection failure: stopping Le= asePinger"); - MicroRemoteClientInvoker invoker =3D (MicroRemoteClientInvo= ker) client.getInvoker(); - = - if (invoker !=3D null) + log.debug(ConnectionValidator.this + " detected connection = failure: stopping LeasePinger"); +// MicroRemoteClientInvoker invoker =3D (MicroRemoteClientIn= voker) client.getInvoker(); +// = +// if (invoker !=3D null) +// { + if (leasePinger =3D=3D null) { + leasePinger =3D sharedInvoker.getLeasePinger(); + } + log.debug(ConnectionValidator.this + " shutting down lease = pinger: " + leasePinger); int disconnectTimeout =3D (failureDisconnectTimeout =3D= =3D -1) ? client.getDisconnectTimeout() : failureDisconnectTimeout; - invoker.terminateLease(null, disconnectTimeout); - log.debug(ConnectionValidator.this + " shut down lease p= inger"); - } - else - { - log.debug(ConnectionValidator.this + " unable to shut do= wn lease pinger: client must have shut down"); - } + sharedInvoker.terminateLease(null, disconnectTimeout); +// } +// else +// { +// log.debug(ConnectionValidator.this + " unable to shut = down lease pinger: " + leasePinger + ". Client must have shut down"); +// } = cancel(); } Modified: remoting2/branches/2.2.2-SP11_JBREM-1112/src/main/org/jboss/remot= ing/Lease.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.2.2-SP11_JBREM-1112/src/main/org/jboss/remoting/Le= ase.java 2009-04-30 05:27:56 UTC (rev 5093) +++ remoting2/branches/2.2.2-SP11_JBREM-1112/src/main/org/jboss/remoting/Le= ase.java 2009-04-30 21:32:26 UTC (rev 5094) @@ -25,6 +25,7 @@ import org.jboss.remoting.util.TimerUtil; = import java.util.Collection; +import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.TimerTask; @@ -48,6 +49,9 @@ private long leaseWindow =3D -1; private long pingStart =3D -1; private Map clientLeases =3D null; + private Object lock =3D new Object(); + private String leasePingerId; + private boolean stopped; = private boolean leaseUpdated =3D false; = @@ -64,7 +68,9 @@ if(requestPayload !=3D null) { this.requestPayload =3D (Map)requestPayload.get(ClientHolder.CLIE= NT_HOLDER_KEY); + this.leasePingerId =3D (String) requestPayload.get(LeasePinger.LE= ASE_PINGER_ID); } + log.debug("leasePingerId: " + leasePingerId); this.leaseWindow =3D leasePeriod * 2; this.clientLeases =3D clientLeases; } @@ -72,9 +78,9 @@ = public void startLease() { - if(isTraceEnabled) + if(true) { - log.trace("Starting lease for client invoker (session id =3D " + = clientSessionId + ") with lease window time of " + leaseWindow); + log.debug("Starting lease for client invoker (session id =3D " + = clientSessionId + ") with lease window time of " + leaseWindow); } leaseTimerTask =3D new LeaseTimerTask(); TimerUtil.schedule(leaseTimerTask, leaseWindow); @@ -84,8 +90,28 @@ { if(requestMap !=3D null) { - this.requestPayload =3D (Map)requestMap.get(ClientHolder.CLIENT_H= OLDER_KEY); + synchronized (lock) + { + this.requestPayload =3D (Map)requestMap.get(ClientHolder.CLIEN= T_HOLDER_KEY); + + log.debug(this + " updating: new Client list:"); + Collection clientHoldersCol =3D requestPayload.values(); + Iterator itr =3D clientHoldersCol.iterator(); + while (itr.hasNext()) + { + Object val =3D itr.next(); + if (val !=3D null && val instanceof ClientHolder) + { + ClientHolder clientHolder =3D (ClientHolder) val; + log.debug(this + " " + clientHolder.getSessionId()); + } + } + } } + else + { + log.debug(this + " requestPayload =3D=3D null"); + } updateLease(leasePeriod); } = @@ -124,13 +150,14 @@ = public void terminateLease(String sessionId) { - if(isTraceEnabled) - { - log.trace("Terminating lease for session id " + sessionId); - } // is this terminate for all clients if (clientSessionId.equals(sessionId)) { + if(true) + { + log.debug(this + " Terminating lease group for session id " + = sessionId); + } + = stopLease(); // should be ok to call this will null as all the client should h= ave // already been disconnected and there been a notification for ea= ch @@ -140,33 +167,101 @@ } else { + if(true) + { + log.debug(this + " Terminating individual lease for session id= " + sessionId); + } notifyClientTermination(sessionId); } } - + = + public void terminateLeaseUponFailure(String sessionId) + { + // is this terminate for all clients + if (clientSessionId.equals(sessionId)) + { + if(true) + { + log.debug(this + " Terminating lease group for session id " + = sessionId); + } + = + stopLease(); + // should be ok to call this will null as all the client should h= ave + // already been disconnected and there been a notification for ea= ch + // of these client disconnections (which would remove the client = from + // the lease, thus leaving the collection empty + notifyClientLost(); + } + else + { + if(true) + { + log.warn(this + " Expected invoker session id: " + sessionId); + } + notifyClientLost(); + } + } + = + public String toString() + { + String hash =3D Integer.toHexString(System.identityHashCode(this)); + return "Lease[" + hash + ":" + clientSessionId + ":" + leasePingerId= + "]"; + } + = private void notifyClientTermination(String sessionId) { - // is for a particular client, so need to inspect request payload fo= r client - if (requestPayload !=3D null) + Map localRequestPayload =3D null; + synchronized (lock) { + if (requestPayload !=3D null) + { = + localRequestPayload =3D new HashMap(requestPayload); + if (sessionId !=3D null) + { + requestPayload.remove(sessionId); + } + } + } + = + if (localRequestPayload !=3D null) + { = // should notify for one client or all? if (sessionId !=3D null) { - Object clientHolderObj =3D requestPayload.remove(sessionId); + synchronized (lock) + { + if (stopped) + { + log.debug(this + " already stopped"); + return; + } + } + = + Object clientHolderObj =3D localRequestPayload.get(sessionId); if (clientHolderObj !=3D null && clientHolderObj instanceof Cl= ientHolder) { ClientHolder clientHolder =3D (ClientHolder) clientHolderOb= j; notifier.connectionTerminated(locatorURL, clientHolder.getS= essionId(), clientHolder.getConfig()); - if(isTraceEnabled) + if(true) { - log.trace("Notified connection listener of lease termina= tion due to disconnect from client (client session id =3D " + clientHolder.= getSessionId()); + log.debug(this + " Notified connection listener of lease= termination due to disconnect from client (client session id =3D " + clien= tHolder.getSessionId()); } } } else { + synchronized (lock) + { + if (stopped) + { + log.debug(this + " already stopped"); + return; + } + stopped =3D true; + } + = // loop through and notify for all clients - Collection clientHoldersCol =3D requestPayload.values(); + Collection clientHoldersCol =3D localRequestPayload.values(); if (clientHoldersCol !=3D null && clientHoldersCol.size() > 0) { Iterator itr =3D clientHoldersCol.iterator(); @@ -177,9 +272,9 @@ { ClientHolder clientHolder =3D (ClientHolder) val; notifier.connectionTerminated(locatorURL, clientHolde= r.getSessionId(), clientHolder.getConfig()); - if(isTraceEnabled) + if(true) { - log.trace("Notified connection listener of lease t= ermination due to disconnect from client (client session id =3D " + clientH= older.getSessionId()); + log.debug(this + " Notified connection listener of= lease termination due to disconnect from client (client session id =3D " += clientHolder.getSessionId()); } } } @@ -188,17 +283,32 @@ } else { - log.warn("Tried to terminate lease for session id " + sessionId += ", but no collection of clients have been set."); + log.warn(this + " Tried to terminate lease for session id " + ses= sionId + ", but no collection of clients have been set."); } } = private void notifyClientLost() { - // is not for a particular client (but all clients associated with c= lient invoker), so need to inspect request payload for client - if (requestPayload !=3D null) + Map localRequestPayload =3D null; + synchronized (lock) { + if (stopped) + { + log.debug(this + " already stopped"); + return; + } + stopped =3D true; + if (requestPayload !=3D null) + { = + localRequestPayload =3D new HashMap(requestPayload); + } + } + = + if (localRequestPayload !=3D null) + { // loop through and notify for all clients - Collection clientHoldersCol =3D requestPayload.values(); + Collection clientHoldersCol =3D localRequestPayload.values(); + log.debug(this + " notifying listeners about " + clientHoldersCol= .size() + " expired client(s)"); if (clientHoldersCol !=3D null && clientHoldersCol.size() > 0) { Iterator itr =3D clientHoldersCol.iterator(); @@ -209,9 +319,9 @@ { ClientHolder clientHolder =3D (ClientHolder) val; notifier.connectionLost(locatorURL, clientHolder.getSess= ionId(), clientHolder.getConfig()); - if(isTraceEnabled) + if(true) { - log.trace("Notified connection listener of lease expi= red due to lost connection from client (client session id =3D " + clientHol= der.getSessionId()); + log.debug(this + " Notified connection listener of le= ase expired due to lost connection from client (client session id =3D " + c= lientHolder.getSessionId()); } } } @@ -219,11 +329,16 @@ } else { - log.debug("requestPayload =3D=3D null, calling ConnectionNotifier= .connectionTerminated()"); - notifier.connectionTerminated(locatorURL, clientSessionId, null); + log.debug(this + " requestPayload =3D=3D null, calling Connection= Notifier.connectionLost()"); + notifier.connectionLost(locatorURL, clientSessionId, null); } } = + protected String getLeasePingerId() + { + return leasePingerId; + } + private void stopLease() { leaseTimerTask.cancel(); @@ -245,14 +360,14 @@ { try { - if (log.isTraceEnabled()) log.trace("did not receive ping: = " + clientSessionId); + if (true) log.debug(Lease.this + " did not receive ping: " = + clientSessionId); stopLease(); notifyClientLost(); if (clientLeases !=3D null) { clientLeases.remove(clientSessionId); } - if (log.isTraceEnabled()) log.trace("removed lease:" + clie= ntSessionId); + if (true) log.debug(Lease.this + " removed lease:" + client= SessionId); } catch (Throwable thr) { Modified: remoting2/branches/2.2.2-SP11_JBREM-1112/src/main/org/jboss/remot= ing/LeasePinger.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.2.2-SP11_JBREM-1112/src/main/org/jboss/remoting/Le= asePinger.java 2009-04-30 05:27:56 UTC (rev 5093) +++ remoting2/branches/2.2.2-SP11_JBREM-1112/src/main/org/jboss/remoting/Le= asePinger.java 2009-04-30 21:32:26 UTC (rev 5094) @@ -2,6 +2,7 @@ = import org.jboss.logging.Logger; import org.jboss.remoting.transport.ClientInvoker; +import org.jboss.util.id.GUID; = import java.util.HashMap; import java.util.Iterator; @@ -25,6 +26,7 @@ = public static final long DEFAULT_LEASE_PERIOD =3D 5000; public static final int DEFAULT_DISCONNECT_TIMEOUT =3D -1; + public static final String LEASE_PINGER_ID =3D "leasePingerId"; = // Static -------------------------------------------------------------= -------------------------- = @@ -44,6 +46,8 @@ = private long pingPeriod =3D -1; private int disconnectTimeout =3D DEFAULT_DISCONNECT_TIMEOUT; + = + private String leasePingerId; = // Constructors -------------------------------------------------------= -------------------------- = @@ -100,6 +104,24 @@ e.initCause(throwable); throw e; } + = +// if (trace) = + { + log.debug(this + " shut down"); + if (!clients.isEmpty()) + { + log.debug(this + " " + clients.size() + " remaining clients= :"); + Iterator it =3D clients.keySet().iterator(); + while (it.hasNext()) + { + log.debug(this + ": " + it.next()); + } + } + else + { + log.debug(this + " No remaining clients"); + } + } } } = @@ -138,7 +160,9 @@ = if(trace) { log.trace(this + " removing client with session ID " + s= essionID); } = - ClientHolder holder =3D (ClientHolder)clients.remove(sessionID); + // Don't remove holder until after client has been removed from serv= er side Lease, to + // avoid a race with LeaseTimerTask sending a PING without the Clien= t being removed. + ClientHolder holder =3D (ClientHolder)clients.get(sessionID); = if (holder !=3D null) { @@ -166,11 +190,13 @@ log.warn(this + " failed sending disconnect for client lease f= or " + "client with session ID " + sessionID); } + = + clients.remove(sessionID); } else { - log.warn(this + " tried to remove lease for client with session I= D " + sessionID + - ", but no such lease was found"); + log.debug(this + " tried to remove lease for client with session = ID " + sessionID + + ", but no such lease was found: probably it was registe= red with an older LeasePinger"); } = if (clients.isEmpty()) @@ -233,7 +259,7 @@ = public String toString() { - return "LeasePinger[" + invoker + "(" + invokerSessionID + ")]"; + return "LeasePinger[" + leasePingerId + ":" + invoker + "(" + invoke= rSessionID + ")]"; } = // Package protected --------------------------------------------------= -------------------------- @@ -252,6 +278,16 @@ log.debug(this + " setting disconnect timeout to: " + disconnectTime= out); } = + protected String getLeasePingerId() + { + return leasePingerId; + } + + protected void setLeasePingerId(String leasePingerId) + { + this.leasePingerId =3D leasePingerId; + } + = // Private ------------------------------------------------------------= -------------------------- = private void sendClientPing() @@ -277,10 +313,9 @@ Map clientsClone =3D new ConcurrentHashMap(clients); Map requestClients =3D new ConcurrentHashMap(); requestClients.put(ClientHolder.CLIENT_HOLDER_KEY, clientsClone); - - InvocationRequest ir =3D - new InvocationRequest(invokerSessionID, null, "$PING$", reques= tClients, null, null); - + requestClients.put(LeasePinger.LEASE_PINGER_ID, leasePingerId); + = + InvocationRequest ir =3D new InvocationRequest(invokerSessionID, = null, "$PING$", requestClients, null, null); invoker.invoke(ir); = if(trace) { log.trace(this + " successfully pinged the server"); } Modified: remoting2/branches/2.2.2-SP11_JBREM-1112/src/main/org/jboss/remot= ing/MicroRemoteClientInvoker.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.2.2-SP11_JBREM-1112/src/main/org/jboss/remoting/Mi= croRemoteClientInvoker.java 2009-04-30 05:27:56 UTC (rev 5093) +++ remoting2/branches/2.2.2-SP11_JBREM-1112/src/main/org/jboss/remoting/Mi= croRemoteClientInvoker.java 2009-04-30 21:32:26 UTC (rev 5094) @@ -345,6 +345,7 @@ = if (sessionId =3D=3D null) { + log.debug(this + " shutting down LeasePinger: " + leasePing= er); // Independent of any particular Client - force LeasePinger= shutdown. // Should be called only if there is a reasonable belief th= at the lease // has already stopped on the server side. @@ -361,9 +362,11 @@ else { // Remove a particular Client. + log.debug(this + " removing client " + sessionId + " from L= easePinger: " + leasePinger); boolean isLastClientLease =3D leasePinger.removeClient(sess= ionId); if(isLastClientLease) { + log.debug(this + " shutting down LeasePinger, " + sessio= nId + " was last client lease: " + leasePinger); try { leasePinger.stopPing(); @@ -376,6 +379,10 @@ } } } + else + { + log.debug(this + " leasePinger is null: must have been shut do= wn already"); + } } } = @@ -413,8 +420,11 @@ // configuration should NOT be passed as want ping to be speci= fic to client invoker // and NOT to the client. = - InvocationRequest ir =3D - new InvocationRequest(invokerSessionID, null, "$PING$", nul= l, new HashMap(), null); + String leasePingerId =3D new GUID().toString(); + Map requestMap =3D new HashMap(); + requestMap.put(LeasePinger.LEASE_PINGER_ID, leasePingerId); + log.info(this + " initiating lease for leasePingerId " + lease= PingerId); + InvocationRequest ir =3D new InvocationRequest(invokerSessionI= D, null, "$PING$", requestMap, new HashMap(), null); = Object ret =3D invoke(ir); = @@ -441,6 +451,7 @@ if(trace) { log.trace("server does have leasing enabled = (with default lease period of " + defaultLeasePeriod + ") and will start a = new lease pinger."); } = leasePinger =3D new LeasePinger(this, invokerSessionID, = defaultLeasePeriod); + leasePinger.setLeasePingerId(leasePingerId); leasePinger.addClient(clientSessionID, configuration, le= asePeriod); leasePinger.startPing(); } @@ -579,4 +590,11 @@ super.finalize(); } = + protected LeasePinger getLeasePinger() + { + synchronized(clientLeaseLock) + { + return leasePinger; + } + } } Modified: remoting2/branches/2.2.2-SP11_JBREM-1112/src/main/org/jboss/remot= ing/Remoting.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.2.2-SP11_JBREM-1112/src/main/org/jboss/remoting/Re= moting.java 2009-04-30 05:27:56 UTC (rev 5093) +++ remoting2/branches/2.2.2-SP11_JBREM-1112/src/main/org/jboss/remoting/Re= moting.java 2009-04-30 21:32:26 UTC (rev 5094) @@ -76,4 +76,12 @@ * org.jboss.remoting.ServerInvoker.InvalidStateException to an org.jbo= ss.remoting.CannotConnectException. */ public static final String CHANGE_INVALID_STATE_TO_CANNOT_CONNECT =3D "= changeInvalidStateToCannotConnect"; + = + /** + * Flags indicating that connection monitoring should treat a connectio= n as being defined + * by one or two of its endpoints. I.e., if a client invoker or server= invoker stops and restarts, then + * all connections it participated in are now gone. + */ + public static final String USE_CLIENT_CONNECTION_IDENTITY =3D "useClien= tConnectionIdentity"; + public static final String USE_SERVER_CONNECTION_IDENTITY =3D "useServe= rConnectionIdentity"; } Modified: remoting2/branches/2.2.2-SP11_JBREM-1112/src/main/org/jboss/remot= ing/ServerInvoker.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.2.2-SP11_JBREM-1112/src/main/org/jboss/remoting/Se= rverInvoker.java 2009-04-30 05:27:56 UTC (rev 5093) +++ remoting2/branches/2.2.2-SP11_JBREM-1112/src/main/org/jboss/remoting/Se= rverInvoker.java 2009-04-30 21:32:26 UTC (rev 5094) @@ -262,6 +262,8 @@ protected ServerSocketFactory serverSocketFactory =3D null; = protected boolean registerCallbackListeners =3D true; + = + protected boolean useClientConnectionIdentity; = // Constructors -------------------------------------------------------= -------------------------- = @@ -702,6 +704,16 @@ return (ServerInvocationHandler) handlers.get(subsystem.toUpperCase(= )); } = + protected boolean isUseClientConnectionIdentity() + { + return useClientConnectionIdentity; + } + + protected void setUseClientConnectionIdentity(boolean useClientConnecti= onIdentity) + { + this.useClientConnectionIdentity =3D useClientConnectionIdentity; + } + public Object invoke(Object invoke) throws IOException { InvocationRequest request =3D null; @@ -798,6 +810,7 @@ = if ("$DISCONNECT$".equals(param)) { + log.debug(this + " got $DISCONNECT$"); if (leaseManagement) { terminateLease(invocation); @@ -1177,6 +1190,13 @@ } } = + // config for useClientConnectionIdentity + String useClientConnectionIdentityString =3D (String)config.get(Remo= ting.USE_CLIENT_CONNECTION_IDENTITY); + if(useClientConnectionIdentityString !=3D null) + { + useClientConnectionIdentity =3D Boolean.parseBoolean(useClientCon= nectionIdentityString); + } + = // Inject ConnectionListener String connectionListener =3D (String)config.get(CONNECTION_LISTENER= ); if (connectionListener !=3D null) @@ -1694,6 +1714,7 @@ { if (invocation !=3D null) { + // clientSessionId =3D=3D MicroRemoteClientInvoker.invokerSession= ID. String clientSessionId =3D invocation.getSessionId(); Lease clientLease =3D (Lease)clientLeases.get(clientSessionId); = @@ -1711,9 +1732,9 @@ { // just a client that disconnected, so only need to term= inate lease for // that particular client (by client session id). - if (trace) log.trace("terminating client lease: " + clientS= essionId); ClientHolder holder =3D (ClientHolder) holderObj; clientLease.terminateLease(holder.getSessionId()); + if (true) log.debug("terminating client lease: " + clien= tSessionId + ":" + holder.getSessionId()); clientOnlyTerminated =3D true; } } @@ -1721,7 +1742,7 @@ // now see if client invoker needs to be terminated if (!clientOnlyTerminated) { - if (trace) log.trace("terminating invoker lease: " + client= SessionId); + if (true) log.debug("terminating invoker lease: " + clientL= ease); clientLease.terminateLease(clientSessionId); clientLeases.remove(clientSessionId); } @@ -1729,7 +1750,7 @@ else { String type =3D "invoker"; - Map reqMap =3D invocation.getRequestPayload(); + Map reqMap =3D invocation.getRequestPayload(); if (reqMap !=3D null) { Object holderObj =3D reqMap.get(ClientHolder.CLIENT_HOLDER= _KEY); @@ -1738,8 +1759,9 @@ type =3D "client"; } } - log.warn("Asked to terminate " + type + " lease for client se= ssion id " + clientSessionId + - ", but lease for this id could not be found." + ": = " + clientLeases); + log.debug("Asked to terminate " + type + " lease for invoker = session id " + + clientSessionId + ", but lease for this id could = not be found." +"" + + "Probably has been removed due to connection failur= e."); } } } @@ -1751,7 +1773,7 @@ String clientSessionId =3D invocation.getSessionId(); if(clientSessionId !=3D null) { - if(trace) { log.trace("Getting lease for client session id: " = + clientSessionId); } + if(trace) { log.trace("Getting lease for invoker session id: "= + clientSessionId); } = Lease clientLease =3D (Lease)clientLeases.get(clientSessionId); if(clientLease =3D=3D null) @@ -1764,15 +1786,48 @@ = clientLeases.put(clientSessionId, newClientLease); newClientLease.startLease(); - - if(trace) { log.trace("No lease established for client sess= ion id (" + clientSessionId + "), so starting a new one."); } + = + if(true) { log.debug("No lease established for invoker sess= ion id (" + clientSessionId + = + "), so starting a new one:" + newClien= tLease); } } else { - // including request payload from invocation as may contain= updated list of clients. - clientLease.updateLease(leasePeriod, invocation.getRequestP= ayload()); + if (useClientConnectionIdentity) + { + String leasePingerId =3D (String) invocation.getRequestP= ayload().get(LeasePinger.LEASE_PINGER_ID);; + if (leasePingerId.equals(clientLease.getLeasePingerId())) + { + // including request payload from invocation as may c= ontain updated list of clients. + log.debug(clientLease + " matches: leasePingerId: " += leasePingerId); + clientLease.updateLease(leasePeriod, invocation.getRe= questPayload()); + if(trace) { log.trace("Updated lease for invoker sess= ion id (" + clientSessionId + ")"); } + } + else + { + log.debug(clientLease + " does not match: leasePinger= Id: " + leasePingerId); + if (true) log.debug("terminating invoker lease: " + c= lientLease); + clientLease.terminateLeaseUponFailure(clientSessionId= ); + clientLeases.remove(clientSessionId); = - if(trace) { log.trace("Updated lease for client session id = (" + clientSessionId + ")"); } + Lease newClientLease =3D new Lease(clientSessionId, l= easePeriod, + locator.getLocatorURI(), + invocation.getRequestPayload(), + connectionNotifier, + clientLeases); + + clientLeases.put(clientSessionId, newClientLease); + newClientLease.startLease(); + + if(true) { log.debug("starting a new lease:" + newCli= entLease); } + } + } + else + { + // including request payload from invocation as may cont= ain updated list of clients. + clientLease.updateLease(leasePeriod, invocation.getReque= stPayload()); + + if(trace) { log.trace("Updated lease for client session = id (" + clientSessionId + ")"); } + } } } } @@ -1782,7 +1837,7 @@ { if(leaseManagement && invokerSessionId !=3D null) { - if(trace) { log.trace("Checking lease for client session id: " + = invokerSessionId); } + if(trace) { log.trace("Checking lease for invoker session id: " += invokerSessionId); } = Lease clientLease =3D (Lease)clientLeases.get(invokerSessionId); if(clientLease =3D=3D null) Modified: remoting2/branches/2.2.2-SP11_JBREM-1112/src/main/org/jboss/remot= ing/Version.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.2.2-SP11_JBREM-1112/src/main/org/jboss/remoting/Ve= rsion.java 2009-04-30 05:27:56 UTC (rev 5093) +++ remoting2/branches/2.2.2-SP11_JBREM-1112/src/main/org/jboss/remoting/Ve= rsion.java 2009-04-30 21:32:26 UTC (rev 5094) @@ -32,7 +32,7 @@ public static final byte VERSION_2 =3D 2; public static final byte VERSION_2_2 =3D 22; = - public static final String VERSION =3D "2.2.2.SP11"; + public static final String VERSION =3D "2.2.2.SP11_JBREM-1112:042409"; private static final byte byteVersion =3D VERSION_2_2; private static byte defaultByteVersion =3D byteVersion; private static boolean performVersioning =3D true; --===============4550360753872557670==-- From jboss-remoting-commits at lists.jboss.org Thu Apr 30 17:34:34 2009 Content-Type: multipart/mixed; boundary="===============1720938435102216607==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5095 - remoting2/branches/2.2.2-SP11_JBREM-1112/src/main/org/jboss/remoting/transport/bisocket. Date: Thu, 30 Apr 2009 17:32:52 -0400 Message-ID: --===============1720938435102216607== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-30 17:32:52 -0400 (Thu, 30 Apr 2009) New Revision: 5095 Modified: remoting2/branches/2.2.2-SP11_JBREM-1112/src/main/org/jboss/remoting/tra= nsport/bisocket/BisocketServerInvoker.java Log: JBREM-1112 (and others to be named): LeasePingerID, single ConnectionValida= tor per client invoker. Modified: remoting2/branches/2.2.2-SP11_JBREM-1112/src/main/org/jboss/remot= ing/transport/bisocket/BisocketServerInvoker.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.2.2-SP11_JBREM-1112/src/main/org/jboss/remoting/tr= ansport/bisocket/BisocketServerInvoker.java 2009-04-30 21:32:26 UTC (rev 50= 94) +++ remoting2/branches/2.2.2-SP11_JBREM-1112/src/main/org/jboss/remoting/tr= ansport/bisocket/BisocketServerInvoker.java 2009-04-30 21:32:52 UTC (rev 50= 95) @@ -515,11 +515,8 @@ = protected void cleanup() { - super.cleanup(); +// super.cleanup(); = - if (controlMonitorTimerTask !=3D null) - controlMonitorTimerTask.shutdown(); - synchronized (controlConnectionThreadMap) { Iterator it =3D controlConnectionThreadMap.values().iterator(); @@ -531,6 +528,11 @@ } } = + super.cleanup(); + = + if (controlMonitorTimerTask !=3D null) + controlMonitorTimerTask.shutdown(); + = if (secondaryServerSocketThread !=3D null) secondaryServerSocketThread.shutdown(); = @@ -834,14 +836,18 @@ return; } = - + if (!running) + { + return; + } + = try { processInvocation(socket); } catch (Exception e) { - log.error("Unable to create new ServerThread: " + e.getMess= age(), e); + log.error(BisocketServerInvoker.this + " Unable to create n= ew ServerThread: " + e.getMessage(), e); } } } --===============1720938435102216607==-- From jboss-remoting-commits at lists.jboss.org Thu Apr 30 17:34:49 2009 Content-Type: multipart/mixed; boundary="===============6390111590545550254==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5096 - remoting2/branches/2.2.2-SP11_JBREM-1112/src/main/org/jboss/remoting/util. Date: Thu, 30 Apr 2009 17:33:07 -0400 Message-ID: --===============6390111590545550254== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-04-30 17:33:06 -0400 (Thu, 30 Apr 2009) New Revision: 5096 Modified: remoting2/branches/2.2.2-SP11_JBREM-1112/src/main/org/jboss/remoting/uti= l/TimerUtil.java Log: JBREM-1112 (and others to be named): LeasePingerID, single ConnectionValida= tor per client invoker. Modified: remoting2/branches/2.2.2-SP11_JBREM-1112/src/main/org/jboss/remot= ing/util/TimerUtil.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.2.2-SP11_JBREM-1112/src/main/org/jboss/remoting/ut= il/TimerUtil.java 2009-04-30 21:32:52 UTC (rev 5095) +++ remoting2/branches/2.2.2-SP11_JBREM-1112/src/main/org/jboss/remoting/ut= il/TimerUtil.java 2009-04-30 21:33:06 UTC (rev 5096) @@ -35,7 +35,16 @@ } = //schedule at fixed delay (not rate) - TimerUtil.timer.schedule(task, period, period); + try + { + TimerUtil.timer.schedule(task, period, period); + } + catch (IllegalStateException e) + { + log.debug("Unable to schedule TimerTask on existing Timer", e); + timer =3D new Timer(true); + timer.schedule(task, period, period); + } } = public static synchronized void unschedule(TimerTask task) --===============6390111590545550254==-- From jboss-remoting-commits at lists.jboss.org Thu Apr 30 18:54:39 2009 Content-Type: multipart/mixed; boundary="===============4359535247658995606==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5097 - remoting3/trunk. Date: Thu, 30 Apr 2009 18:48:56 -0400 Message-ID: --===============4359535247658995606== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: david.lloyd(a)jboss.com Date: 2009-04-30 18:48:56 -0400 (Thu, 30 Apr 2009) New Revision: 5097 Modified: remoting3/trunk/pom.xml Log: Copyright; add taglet module Modified: remoting3/trunk/pom.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/pom.xml 2009-04-30 21:33:06 UTC (rev 5096) +++ remoting3/trunk/pom.xml 2009-04-30 22:48:56 UTC (rev 5097) @@ -1,3 +1,25 @@ + + @@ -10,5 +32,6 @@ 3.1.0.CR1 jboss-remoting + taglet --===============4359535247658995606==-- From jboss-remoting-commits at lists.jboss.org Thu Apr 30 18:55:29 2009 Content-Type: multipart/mixed; boundary="===============2905998375845203691==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5098 - remoting3/trunk/jboss-remoting. Date: Thu, 30 Apr 2009 18:49:46 -0400 Message-ID: --===============2905998375845203691== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: david.lloyd(a)jboss.com Date: 2009-04-30 18:49:46 -0400 (Thu, 30 Apr 2009) New Revision: 5098 Modified: remoting3/trunk/jboss-remoting/pom.xml Log: Copyright, plugin configs for apiviz, javadoc, source distro, and distribut= ion mgmt Modified: remoting3/trunk/jboss-remoting/pom.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/pom.xml 2009-04-30 22:48:56 UTC (rev 509= 7) +++ remoting3/trunk/jboss-remoting/pom.xml 2009-04-30 22:49:46 UTC (rev 509= 8) @@ -1,3 +1,25 @@ + + @@ -4,13 +26,6 @@ = 4.0.0 = - - org.jboss.remoting - jboss-remoting-all - 3.1.0.CR1 - ../pom.xml - - org.jboss.remoting jboss-remoting jar @@ -46,6 +61,55 @@ 1.5 + + maven-source-plugin + + + attach-sources + verify + + jar + + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.5 + + org.jboss.remoting3.taglet.RemotingTypeTaglet<= /taglet> + + org.jboss.remoting + jboss-remoting-taglet + ${version} + + net.gleamynode.apiviz.APIviz + + org.jboss.apiviz + apiviz + 1.2.5.GA + + ${version} +

${version}
+
${version}
+ Copyright © 2009 JBoss, a div= ision of Red Hat, Inc.
]]> + + http://java.sun.com/j2se/1.5.0/docs/api/ + + + + + + + + repository.jboss.org + JBoss Maven2 Repository + ${repository.url} + + --===============2905998375845203691==-- From jboss-remoting-commits at lists.jboss.org Thu Apr 30 18:56:08 2009 Content-Type: multipart/mixed; boundary="===============4636074511258383274==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5099 - in remoting3/trunk/jboss-remoting/src: main/java/org/jboss/remoting3/spi and 3 other directories. Date: Thu, 30 Apr 2009 18:50:25 -0400 Message-ID: --===============4636074511258383274== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: david.lloyd(a)jboss.com Date: 2009-04-30 18:50:24 -0400 (Thu, 30 Apr 2009) New Revision: 5099 Added: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/ClientC= onnector.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/ClientC= onnectorImpl.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/ClientL= istener.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Connect= ion.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/FutureR= esult.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/NotOpen= Exception.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Unknown= URISchemeException.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Abs= tractConnectionProviderContext.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Con= nectionHandler.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Con= nectionHandlerFactory.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Con= nectionProviderContext.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Con= nectionProviderFactory.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Req= uestHandlerConnector.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Res= ult.java Removed: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Abstrac= tContextImpl.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Abstrac= tRequestListener.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/ClientE= xternalizer.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/ClientS= ource.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/ClientS= ourceExternalizer.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/ClientS= ourceImpl.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/LocalRe= questHandlerSource.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Resourc= eType.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Service= Context.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Service= ContextImpl.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Abs= tractEndpointConnectionAcceptor.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/End= pointConnection.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/End= pointConnectionAcceptor.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Req= uestHandlerSource.java Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Client.= java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/ClientC= ontext.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/ClientC= ontextImpl.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/ClientI= mpl.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Endpoin= t.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Endpoin= tImpl.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Indeter= minateOutcomeException.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/LocalRe= questHandler.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/LocalSe= rviceConfiguration.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/RemoteE= xecutionException.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Remotin= g.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Request= Listener.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Service= NotFoundException.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Service= Registration.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Service= RegistrationListener.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/package= -info.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Abs= tractAutoCloseable.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Abs= tractHandleableCloseable.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Con= nectionProvider.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Req= uestHandler.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/stream/= InputStreamHandlerFactory.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/stream/= OutputStreamHandlerFactory.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/stream/= StreamHandler.java remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/Endpoin= tTestCase.java remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/spi/Clo= seableTestCase.java Log: Finish migration to connection-oriented model Deleted: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/A= bstractContextImpl.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Abstra= ctContextImpl.java 2009-04-30 22:49:46 UTC (rev 5098) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Abstra= ctContextImpl.java 2009-04-30 22:50:24 UTC (rev 5099) @@ -1,56 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2008, 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.remoting3; - -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; -import java.util.concurrent.Executor; -import org.jboss.remoting3.spi.AbstractHandleableCloseable; - -/** - * - */ -abstract class AbstractContextImpl extends AbstractHandleableCloseable<= T> { - - private final ConcurrentMap attributes =3D new Concurr= entHashMap(); - - AbstractContextImpl(final Executor executor) { - super(executor); - } - - public ConcurrentMap getAttributes() { - return attributes; - } - - protected Executor getExecutor() { - return super.getExecutor(); - } - - protected boolean isOpen() { - return super.isOpen(); - } - - public String toString() { - return "generic context instance <" + Integer.toHexString(hashCode= ()) + ">"; - } -} Deleted: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/A= bstractRequestListener.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Abstra= ctRequestListener.java 2009-04-30 22:49:46 UTC (rev 5098) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Abstra= ctRequestListener.java 2009-04-30 22:50:24 UTC (rev 5099) @@ -1,56 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2009, 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.remoting3; - -/** - * A simple request listener implementation that implements all methods wi= th no-operation implementations. - * - * @param the request type - * @param the reply type - */ -public abstract class AbstractRequestListener implements RequestList= ener { - - /** - * {@inheritDoc} This implementation performs no operation. - */ - public void handleClientOpen(final ClientContext context) { - } - - /** - * {@inheritDoc} This implementation performs no operation. - */ - public void handleServiceOpen(final ServiceContext context) { - } - - /** - * {@inheritDoc} This implementation performs no operation. - */ - public void handleServiceClose(final ServiceContext context) { - } - - /** - * {@inheritDoc} This implementation performs no operation. - */ - public void handleClientClose(final ClientContext context) { - } -} Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/= Client.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Client= .java 2009-04-30 22:49:46 UTC (rev 5098) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Client= .java 2009-04-30 22:50:24 UTC (rev 5099) @@ -25,11 +25,14 @@ import java.io.IOException; import java.io.ObjectStreamException; import java.util.concurrent.CancellationException; -import java.util.concurrent.ConcurrentMap; import org.jboss.xnio.IoFuture; = /** * A communications client. The client may be associated with state maint= ained by the local and/or remote side. + *

+ * This interface is part of the Remoting public API. It is intended to b= e consumed by Remoting applications; it is + * not intended to be implemented by them. Methods may be added to this i= nterface in future minor releases without + * advance notice. * * @param the request type * @param the reply type @@ -107,11 +110,4 @@ * @throws IOException if the request could not be sent */ IoFuture send(I request) throws IOException; - - /** - * Get the attribute map. This map holds metadata about the current c= linet. - * - * @return the attribute map - */ - ConcurrentMap getAttributes(); } Added: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Cli= entConnector.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Client= Connector.java (rev 0) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Client= Connector.java 2009-04-30 22:50:24 UTC (rev 5099) @@ -0,0 +1,51 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2009, 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.remoting3; + +import org.jboss.xnio.IoFuture; + +/** + * A client connector. Such a connector can usually be sent across a link= to a specific peer. Attempting to access + * the client from the wrong peer, or attempting to send the connector to = a peer for whom it is not intended, will + * result in an exception. + */ +public interface ClientConnector { + + /** + * Get the future client associated with this connector. This method = may only be called after this connector + * has passed over its associated connection. + * + * @return the future client + * @throws SecurityException if this client is being accessed from the= wrong peer + */ + IoFuture> getFutureClient() throws SecurityExce= ption; + + /** + * Get the client context associated with this connector. This method= may only be called from the originating + * side of the connection. + * + * @return the client context + * @throws SecurityException if the client context is accessed on the = remote side of the connection + */ + ClientContext getClientContext() throws SecurityException; +} Added: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Cli= entConnectorImpl.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Client= ConnectorImpl.java (rev 0) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Client= ConnectorImpl.java 2009-04-30 22:50:24 UTC (rev 5099) @@ -0,0 +1,77 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2009, 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.remoting3; + +import org.jboss.xnio.IoFuture; +import org.jboss.remoting3.spi.RequestHandlerConnector; +import org.jboss.remoting3.spi.RequestHandler; +import org.jboss.remoting3.spi.Cancellable; +import java.io.Serializable; +import java.io.IOException; + +final class ClientConnectorImpl implements ClientConnector, Se= rializable { + + private static final long serialVersionUID =3D -263585821458635701L; + + private transient final ClientContext clientContext; + + private final RequestHandlerConnector requestHandlerConnector; + private final Endpoint endpoint; + private final Class requestClass; + private final Class replyClass; + + ClientConnectorImpl(final RequestHandlerConnector requestHandlerConnec= tor, final Endpoint endpoint, final Class requestClass, final Class r= eplyClass, final ClientContext clientContext) { + this.requestHandlerConnector =3D requestHandlerConnector; + this.endpoint =3D endpoint; + this.requestClass =3D requestClass; + this.replyClass =3D replyClass; + this.clientContext =3D clientContext; + } + + public IoFuture> getFutureClient() throws Secur= ityException { + if (clientContext !=3D null) { + throw new SecurityException("Connector has not been sent"); + } + return new FutureResult, RequestHandler>() { + private final Cancellable cancellable =3D requestHandlerConnec= tor.createRequestHandler(getResult()); + + protected Client translate(final RequestHandler result) = throws IOException { + return endpoint.createClient(result, requestClass, replyCl= ass); + } + + public IoFuture> cancel() { + cancellable.cancel(); + return super.cancel(); + } + }; + } + + public ClientContext getClientContext() { + if (clientContext =3D=3D null) { + throw new SecurityException("Connector has already been sent"); + } + return clientContext; + } + + +} Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/= ClientContext.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Client= Context.java 2009-04-30 22:49:46 UTC (rev 5098) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Client= Context.java 2009-04-30 22:50:24 UTC (rev 5099) @@ -22,7 +22,7 @@ = package org.jboss.remoting3; = -import java.util.concurrent.ConcurrentMap; +import java.io.IOException; = /** * The server context for a single remote client instance. @@ -30,18 +30,18 @@ * @apiviz.exclude */ public interface ClientContext extends HandleableCloseable { + /** - * Get the attributes for this end of the channel as a map. + * Get the connection associated with this client context. * - * @return the attribute map + * @return the connection */ - ConcurrentMap getAttributes(); + Connection getConnection(); = /** - * Get the service that this context is associated with, or {@code nul= l} if there is no - * service. + * Close the client from the server side. * - * @return the service, or {@code null} if there is none + * @throws IOException if an I/O error occurs */ - ServiceContext getServiceContext(); + void close() throws IOException; } Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/= ClientContextImpl.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Client= ContextImpl.java 2009-04-30 22:49:46 UTC (rev 5098) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Client= ContextImpl.java 2009-04-30 22:50:24 UTC (rev 5099) @@ -23,29 +23,30 @@ package org.jboss.remoting3; = import java.util.concurrent.Executor; +import org.jboss.remoting3.spi.AbstractHandleableCloseable; import org.jboss.xnio.log.Logger; = /** * */ -final class ClientContextImpl extends AbstractContextImpl i= mplements ClientContext { +final class ClientContextImpl extends AbstractHandleableCloseable implements ClientContext { = + @SuppressWarnings({ "UnusedDeclaration" }) private static final Logger log =3D Logger.getLogger("org.jboss.remoti= ng.client-context"); = - private final ServiceContextImpl serviceContext; + private final Connection connection; = - ClientContextImpl(final Executor executor) { + ClientContextImpl(final Executor executor, final Connection connection= ) { super(executor); - serviceContext =3D null; + this.connection =3D connection; } = - ClientContextImpl(final ServiceContextImpl serviceContext) { - super(serviceContext.getExecutor()); - this.serviceContext =3D serviceContext; + protected Executor getExecutor() { + return super.getExecutor(); } = - public ServiceContext getServiceContext() { - return serviceContext; + public Connection getConnection() { + return connection; } = public String toString() { Deleted: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/C= lientExternalizer.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Client= Externalizer.java 2009-04-30 22:49:46 UTC (rev 5098) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Client= Externalizer.java 2009-04-30 22:50:24 UTC (rev 5099) @@ -1,69 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2008, 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.remoting3; - -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import org.jboss.marshalling.Creator; -import org.jboss.marshalling.Externalizer; -import org.jboss.remoting3.spi.RequestHandler; - -/** - * - */ -final class ClientExternalizer implements Externalizer { - - private static final long serialVersionUID =3D 814228455390899997L; - - private final EndpointImpl endpoint; - - ClientExternalizer(final EndpointImpl endpoint) { - this.endpoint =3D endpoint; - } - - private static void doWriteExternal(final ClientImpl clie= nt, final ObjectOutput output) throws IOException { - output.writeObject(client.getRequestClass()); - output.writeObject(client.getReplyClass()); - output.writeObject(client.getRequestHandlerHandle().getResource()); - } - - public void writeExternal(final Object o, final ObjectOutput output) t= hrows IOException { - doWriteExternal((ClientImpl) o, output); - } - - private ClientImpl doCreateExternal(Class requestClass= , Class replyClass, RequestHandler handler) throws IOException { - return ClientImpl.create(handler.getHandle(), endpoint.getExecutor= (), requestClass, replyClass); - } - - public Object createExternal(final Class aClass, final ObjectInput = input, final Creator creator) throws IOException, ClassNotFoundException { - final Class requestClass =3D (Class) input.readObject(); - final Class replyClass =3D (Class) input.readObject(); - final RequestHandler handler =3D (RequestHandler) input.readObject= (); - return doCreateExternal(requestClass, replyClass, handler); - } - - public void readExternal(final Object o, final ObjectInput input) thro= ws IOException, ClassNotFoundException { - // no op - } -} Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/= ClientImpl.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Client= Impl.java 2009-04-30 22:49:46 UTC (rev 5098) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Client= Impl.java 2009-04-30 22:50:24 UTC (rev 5099) @@ -24,10 +24,10 @@ = import java.io.IOException; import java.util.concurrent.Executor; -import org.jboss.remoting3.spi.Handle; import org.jboss.remoting3.spi.RemoteRequestContext; import org.jboss.remoting3.spi.ReplyHandler; import org.jboss.remoting3.spi.RequestHandler; +import org.jboss.remoting3.spi.AbstractHandleableCloseable; import org.jboss.xnio.IoFuture; import org.jboss.xnio.IoUtils; import org.jboss.xnio.log.Logger; @@ -35,25 +35,25 @@ /** * */ -final class ClientImpl extends AbstractContextImpl> imp= lements Client { +final class ClientImpl extends AbstractHandleableCloseable> implements Client { = private static final Logger log =3D Logger.getLogger("org.jboss.remoti= ng.client"); = - private final Handle handle; + private final RequestHandler handler; private final Class requestClass; private final Class replyClass; = - private ClientImpl(final Handle handle, final Executor= executor, final Class requestClass, final Class replyClass) { + private ClientImpl(final RequestHandler handler, final Executor execut= or, final Class requestClass, final Class replyClass) { super(executor); - this.handle =3D handle; + this.handler =3D handler; this.requestClass =3D requestClass; this.replyClass =3D replyClass; } = - static ClientImpl create(final Handle han= dle, final Executor executor, final Class requestClass, final Class r= eplyClass) { - final ClientImpl ci =3D new ClientImpl(handle, executo= r, requestClass, replyClass); - handle.addCloseHandler(new CloseHandler>() { - public void handleClose(final Handle closed) { + static ClientImpl create(final RequestHandler handler, fi= nal Executor executor, final Class requestClass, final Class replyCla= ss) { + final ClientImpl ci =3D new ClientImpl(handler, execut= or, requestClass, replyClass); + handler.addCloseHandler(new CloseHandler() { + public void handleClose(final RequestHandler closed) { IoUtils.safeClose(ci); } }); @@ -61,7 +61,7 @@ } = protected void closeAction() throws IOException { - handle.close(); + handler.close(); } = public O invoke(final I request) throws IOException { @@ -73,9 +73,9 @@ final QueueExecutor executor =3D new QueueExecutor(); final FutureReplyImpl futureReply =3D new FutureReplyImpl(ex= ecutor, replyClass); final ReplyHandler replyHandler =3D futureReply.getReplyHandler(); - final RemoteRequestContext requestContext =3D handle.getResource()= .receiveRequest(actualRequest, replyHandler); + final RemoteRequestContext requestContext =3D handler.receiveReque= st(actualRequest, replyHandler); futureReply.setRemoteRequestContext(requestContext); - futureReply.addNotifier(IoUtils.attachmentClosingNotifier(), ex= ecutor); + futureReply.addNotifier(IoUtils.attachmentClosingNotifier(), execu= tor); executor.runQueue(); try { final O reply =3D futureReply.getInterruptibly(); @@ -97,9 +97,9 @@ } log.trace("Client.send() sending request \"%s\"", request); final I actualRequest =3D castRequest(request); - final FutureReplyImpl futureReply =3D new FutureReplyImpl(ex= ecutor, replyClass); + final FutureReplyImpl futureReply =3D new FutureReplyImpl(ge= tExecutor(), replyClass); final ReplyHandler replyHandler =3D futureReply.getReplyHandler(); - final RemoteRequestContext requestContext =3D handle.getResource()= .receiveRequest(actualRequest, replyHandler); + final RemoteRequestContext requestContext =3D handler.receiveReque= st(actualRequest, replyHandler); futureReply.setRemoteRequestContext(requestContext); return futureReply; } @@ -122,8 +122,8 @@ return "client instance <" + Integer.toHexString(hashCode()) + ">"; } = - Handle getRequestHandlerHandle() { - return handle; + RequestHandler getRequestHandler() { + return handler; } = Class getRequestClass() { Added: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Cli= entListener.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Client= Listener.java (rev 0) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Client= Listener.java 2009-04-30 22:50:24 UTC (rev 5099) @@ -0,0 +1,46 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2009, 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.remoting3; + +/** + * A client listener associated with a service. When a client is opened f= or this service, a new request listener + * is created and returned. + * + * @param the request type + * @param the reply type + * + * @apiviz.landmark + */ +public interface ClientListener { + + /** + * Handle a client open by returning a new request listener. The supp= lied client context may be used to register + * a notifier for when the client is closed. + *

+ * If {@code null} is returned, the client is closed with an error. + * + * @param clientContext the client context + * @return the request listener + */ + RequestListener handleClientOpen(ClientContext clientContext); +} Deleted: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/C= lientSource.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Client= Source.java 2009-04-30 22:49:46 UTC (rev 5098) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Client= Source.java 2009-04-30 22:50:24 UTC (rev 5099) @@ -1,38 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2009, 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.remoting3; - -/** - * A source for new Remoting clients. - * - * @param the request type - * @param the reply type - */ -public interface ClientSource extends HandleableCloseable> { - /** - * Create a new client instance. - * - * @return the client - */ - Client createClient(); -} Deleted: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/C= lientSourceExternalizer.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Client= SourceExternalizer.java 2009-04-30 22:49:46 UTC (rev 5098) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Client= SourceExternalizer.java 2009-04-30 22:50:24 UTC (rev 5099) @@ -1,69 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2008, 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.remoting3; - -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import org.jboss.marshalling.Creator; -import org.jboss.marshalling.Externalizer; -import org.jboss.remoting3.spi.RequestHandlerSource; - -/** - * - */ -final class ClientSourceExternalizer implements Externalizer { - - private static final long serialVersionUID =3D 814228455390899997L; - - private final EndpointImpl endpoint; - - ClientSourceExternalizer(final EndpointImpl endpoint) { - this.endpoint =3D endpoint; - } - - private static void doWriteExternal(final ClientSourceImpl clientSource, final ObjectOutput output) throws IOException { - output.writeObject(clientSource.getRequestClass()); - output.writeObject(clientSource.getReplyClass()); - output.writeObject(clientSource.getRequestHandlerSourceHandle().ge= tResource()); - } - - public void writeExternal(final Object o, final ObjectOutput output) t= hrows IOException { - doWriteExternal((ClientSourceImpl) o, output); - } - - private ClientSourceImpl doCreateExternal(Class reques= tClass, Class replyClass, RequestHandlerSource handlerSource) throws IOE= xception { - return ClientSourceImpl.create(handlerSource.getHandle(), endpoint= , requestClass, replyClass); - } - - public Object createExternal(final Class aClass, final ObjectInput = input, final Creator creator) throws IOException, ClassNotFoundException { - final Class requestClass =3D (Class) input.readObject(); - final Class replyClass =3D (Class) input.readObject(); - final RequestHandlerSource handlerSource =3D (RequestHandlerSource= ) input.readObject(); - return doCreateExternal(requestClass, replyClass, handlerSource); - } - - public void readExternal(final Object o, final ObjectInput input) thro= ws IOException, ClassNotFoundException { - // no op - } -} \ No newline at end of file Deleted: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/C= lientSourceImpl.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Client= SourceImpl.java 2009-04-30 22:49:46 UTC (rev 5098) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Client= SourceImpl.java 2009-04-30 22:50:24 UTC (rev 5099) @@ -1,94 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2008, 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.remoting3; - -import java.io.IOException; -import org.jboss.remoting3.spi.AbstractHandleableCloseable; -import org.jboss.remoting3.spi.Handle; -import org.jboss.remoting3.spi.RequestHandler; -import org.jboss.remoting3.spi.RequestHandlerSource; -import org.jboss.xnio.IoUtils; -import org.jboss.xnio.log.Logger; - -/** - * - */ -final class ClientSourceImpl extends AbstractHandleableCloseable> implements ClientSource { - - private static final Logger log =3D Logger.getLogger("org.jboss.remoti= ng.client-source"); = - - private final Handle handle; - private final Endpoint endpoint; - private final Class requestClass; - private final Class replyClass; - - private ClientSourceImpl(final Handle handle, fi= nal EndpointImpl endpoint, final Class requestClass, final Class repl= yClass) { - super(endpoint.getExecutor()); - this.handle =3D handle; - this.endpoint =3D endpoint; - this.requestClass =3D requestClass; - this.replyClass =3D replyClass; - } - - static ClientSourceImpl create(final Handle handle, final EndpointImpl endpoint, final Class requestClass, = final Class replyClass) { - final ClientSourceImpl csi =3D new ClientSourceImpl(ha= ndle, endpoint, requestClass, replyClass); - handle.addCloseHandler(new CloseHandler>() { - public void handleClose(final Handle clo= sed) { - IoUtils.safeClose(csi); - } - }); - return csi; - } - - protected void closeAction() throws IOException { - handle.close(); - } - - public Client createClient() throws IOException { - if (! isOpen()) { - throw new IOException("Client source is not open"); - } - final Handle clientHandle =3D handle.getResource()= .createRequestHandler(); - try { - return endpoint.createClient(clientHandle.getResource(), reque= stClass, replyClass); - } finally { - IoUtils.safeClose(clientHandle); - } - } - - public String toString() { - return "client source instance <" + Integer.toString(hashCode()) += ">"; - } - - Handle getRequestHandlerSourceHandle() { - return handle; - } - - Class getRequestClass() { - return requestClass; - } - - Class getReplyClass() { - return replyClass; - } -} Added: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Con= nection.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Connec= tion.java (rev 0) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Connec= tion.java 2009-04-30 22:50:24 UTC (rev 5099) @@ -0,0 +1,62 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2009, 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.remoting3; + +import org.jboss.xnio.IoFuture; +import java.io.IOException; + +/** + * A connection to a remote peer. + *

+ * This interface is part of the Remoting public API. It is intended to b= e consumed by Remoting applications; it is + * not intended to be implemented by them. Methods may be added to this i= nterface in future minor releases without + * advance notice. + */ +public interface Connection extends HandleableCloseable { + + /** + * Open a client on the remote side of this connection. + * + * @param serviceType the service type + * @param groupName the group name + * @param requestClass the request class + * @param replyClass the reply class + * @param the request type + * @param the reply type + * @return the future client + */ + IoFuture> openClient(String serviceType,= String groupName, Class requestClass, Class replyClass); + + /** + * Create a client connector which may only transmitted to the = remote side of this connection, allowing + * it to use the included service. + * + * @param listener the local listener + * @param requestClass the request class + * @param replyClass the reply class + * @param the request type + * @param the reply type + * @return a connector which may be sent to the connection peer + */ + ClientConnector createClientConnector(RequestListener listener, Class requestClass, Class replyClass) throws IOException; +} Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/= Endpoint.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Endpoi= nt.java 2009-04-30 22:49:46 UTC (rev 5098) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Endpoi= nt.java 2009-04-30 22:50:24 UTC (rev 5099) @@ -1,32 +1,22 @@ package org.jboss.remoting3; = -import java.io.Closeable; import java.io.IOException; import java.net.URI; import java.util.Set; -import java.util.concurrent.ConcurrentMap; -import org.jboss.remoting3.spi.Handle; +import org.jboss.remoting3.spi.ConnectionProviderFactory; import org.jboss.remoting3.spi.RequestHandler; -import org.jboss.remoting3.spi.RequestHandlerSource; -import org.jboss.remoting3.spi.ConnectionProvider; -import org.jboss.remoting3.spi.EndpointConnectionAcceptor; import org.jboss.xnio.IoFuture; = /** * A potential participant in a JBoss Remoting communications relationship. + *

+ * This interface is part of the Remoting public API. It is intended to b= e consumed by Remoting applications; it is + * not intended to be implemented by them. Methods may be added to this i= nterface in future minor releases without + * advance notice. * * @apiviz.landmark */ public interface Endpoint extends HandleableCloseable { - /** - * Get the endpoint attribute map. This is a storage area for any dat= a associated with this endpoint, including - * (but not limited to) connection and protocol information, and appli= cation information. - * - * You must have the TODO permission to invoke this method. - * - * @return the endpoint map - */ - ConcurrentMap getAttributes(); = /** * Get the name of this endpoint. @@ -38,32 +28,26 @@ /** * Create a request handler that can be used to receive incoming reque= sts on this endpoint. The client may be passed to a * remote endpoint as part of a request or a reply, or it may be used = locally. - * + *

* You must have the {@link org.jboss.remoting3.EndpointPermission cre= ateRequestHandler EndpointPermission} to invoke this method. * - * @param the request type - * @param the reply type * @param requestListener the request listener * @param requestClass the class of requests sent to this request list= ener * @param replyClass the class of replies received back from this requ= est listener * @return a handle for the client * @throws IOException if an error occurs */ - Handle createLocalRequestHandler(RequestListene= r requestListener, final Class requestClass, final Class replyC= lass) throws IOException; + RequestHandler createLocalRequestHandler(RequestListener = requestListener, final Class requestClass, final Class replyClass) th= rows IOException; = /** * Create a request handler source that can be used to acquire clients= associated with a request listener on this endpoint. - * The request handler source may be ignored, passed to a remote endpo= int as part of a request or a reply, or used locally. - * The objects that are produced by this method may be used to mass-pr= oduce {@code RequestHandler} instances. - * + *

* You must have the {@link org.jboss.remoting3.EndpointPermission reg= isterService EndpointPermission} to invoke this method. * - * @param the request type - * @param the reply type * @param configuration the configuration to use * @throws IOException if an error occurs */ - Handle registerService(LocalServiceConfig= uration configuration) throws IOException; + SimpleCloseable registerService(LocalServiceConfiguration= configuration) throws IOException; = /** * Add a service registration listener which is called whenever a loca= l service is registered. @@ -76,7 +60,7 @@ = /** * Create a client that uses the given request handler to handle its r= equests. - * + *

* You must have the {@link org.jboss.remoting3.EndpointPermission cre= ateClient EndpointPermission} to invoke this method. * * @param the request type @@ -90,73 +74,25 @@ Client createClient(RequestHandler handler, Class requ= estClass, Class replyClass) throws IOException; = /** - * Create a client source that uses the given request handler source t= o generate clients. + * Open a connection with a peer. * - * You must have the {@link org.jboss.remoting3.EndpointPermission cre= ateClientSource EndpointPermission} to invoke this method. - * - * @param the request type - * @param the reply type - * @param handlerSource the request handler source - * @param requestClass the class of requests sent through this client = source - * @param replyClass the class of replies received back through this c= lient source - * @return the client source - * @throws IOException if an error occurs + * @param destination the destination + * @return + * @throws IOException */ - ClientSource createClientSource(RequestHandlerSource hand= lerSource, Class requestClass, Class replyClass) throws IOException; + IoFuture connect(URI destination) throws IOExcep= tion; = /** - * Attempt to open a client source by URI. + * Register a connection provider for a URI scheme. The provider fact= ory is called with the context which can + * be used to accept new connections or terminate the registration. * - * @param the request type - * @param the reply type - * @param uri the URI of the service - * @param requestClass the class of requests sent through the client s= ource - * @param replyClass the class of replies received back through the cl= ient source - * @return the future service - * @throws IllegalArgumentException if the URI scheme does not corresp= ond to a client souerce connection provider - */ - IoFuture> openClientSource(URI uri= , Class requestClass, Class replyClass) throws IllegalArgumentExcepti= on; - - /** - * Attempt to open a client by URI. - * - * @param the request type - * @param the reply type - * @param uri the URI of the service - * @param requestClass the class of requests sent through the client s= ource - * @param replyClass the class of replies received back through the cl= ient source - * @return the future service - * @throws IllegalArgumentException if the URI scheme does not corresp= ond to a client connection provider - */ - IoFuture> openClient(URI uri, Class r= equestClass, Class replyClass) throws IllegalArgumentException; - - /** - * Connect to a remote endpoint. - * - * @param endpointUri the URI of the endpoint to connect to - * @return the future connection - * @throws IllegalArgumentException if the URI scheme does not corresp= ond to an endpoint connection provider - */ - IoFuture openEndpointConnection(URI endpointUri) = throws IllegalArgumentException; - - /** - * Register a connection provider for a URI scheme. - * * @param uriScheme the URI scheme - * @param provider the provider + * @param providerFactory the provider factory * @return a handle which may be used to remove the registration */ - EndpointConnectionAcceptor addConnectionProvider(String uriScheme, Con= nectionProvider provider); + void addConnectionProvider(String uriScheme, ConnectionProviderFactory= providerFactory); = /** - * Get the type of resource specified by the given URI. If the type c= annot be determined, returns {@link org.jboss.remoting3.ResourceType#UNKNOW= N UNKNOWN}. - * - * @param uri the connection URI - * @return the resource type - */ - ResourceType getResourceType(URI uri); - - /** * Flags which can be passed in to listener registration methods. */ enum ListenerFlag { Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/= EndpointImpl.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Endpoi= ntImpl.java 2009-04-30 22:49:46 UTC (rev 5098) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Endpoi= ntImpl.java 2009-04-30 22:50:24 UTC (rev 5099) @@ -22,15 +22,14 @@ = package org.jboss.remoting3; = -import java.io.Closeable; import java.io.IOException; -import java.lang.ref.WeakReference; import java.net.URI; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; import java.util.Queue; import java.util.Set; @@ -42,18 +41,18 @@ import java.util.concurrent.locks.ReentrantLock; import org.jboss.remoting3.spi.AbstractHandleableCloseable; import org.jboss.remoting3.spi.AbstractSimpleCloseable; +import org.jboss.remoting3.spi.Cancellable; +import org.jboss.remoting3.spi.ConnectionHandler; +import org.jboss.remoting3.spi.ConnectionHandlerFactory; import org.jboss.remoting3.spi.ConnectionProvider; -import org.jboss.remoting3.spi.Handle; +import org.jboss.remoting3.spi.ConnectionProviderContext; +import org.jboss.remoting3.spi.ConnectionProviderFactory; import org.jboss.remoting3.spi.RequestHandler; -import org.jboss.remoting3.spi.RequestHandlerSource; -import org.jboss.remoting3.spi.Cancellable; -import org.jboss.remoting3.spi.EndpointConnection; -import org.jboss.remoting3.spi.EndpointConnectionAcceptor; -import org.jboss.remoting3.spi.AbstractEndpointConnectionAcceptor; +import org.jboss.remoting3.spi.RequestHandlerConnector; +import org.jboss.remoting3.spi.Result; import org.jboss.xnio.IoFuture; import org.jboss.xnio.IoUtils; import org.jboss.xnio.WeakCloseable; -import org.jboss.xnio.AbstractIoFuture; import org.jboss.xnio.log.Logger; = /** @@ -82,6 +81,10 @@ return new ConcurrentLinkedQueue(); } = + static List arrayList() { + return new ArrayList(); + } + private static final Logger log =3D Logger.getLogger("org.jboss.remoti= ng.endpoint"); = private final String name; @@ -92,23 +95,17 @@ */ private final Lock serviceRegistrationLock =3D new ReentrantLock(); = - /** - * = - */ - private final Queue> service= ListenerRegistrations =3D concurrentLinkedQueue(); + private final Set> serviceLi= stenerRegistrations =3D hashSet(); + private final Map registeredLocalServices= =3D hashMap(); = - private final ConcurrentMap registeredLoc= alServices =3D concurrentHashMap(); + private final ConcurrentMap connectionProv= iders =3D concurrentHashMap(); = - private final ConcurrentMap> connectionP= roviders =3D concurrentHashMap(); - - private final ConcurrentMap endpointMap =3D concurrent= HashMap(); - private static final EndpointPermission CREATE_ENDPOINT_PERM =3D new E= ndpointPermission("createEndpoint"); private static final EndpointPermission CREATE_REQUEST_HANDLER_PERM = =3D new EndpointPermission("createRequestHandler"); private static final EndpointPermission REGISTER_SERVICE_PERM =3D new = EndpointPermission("registerService"); private static final EndpointPermission CREATE_CLIENT_PERM =3D new End= pointPermission("createClient"); - private static final EndpointPermission CREATE_CLIENT_SOURCE_PERM =3D = new EndpointPermission("createClientSource"); private static final EndpointPermission ADD_SERVICE_LISTENER_PERM =3D = new EndpointPermission("addServiceListener"); + private static final EndpointPermission CONNECT_PERM =3D new EndpointP= ermission("connect"); private static final EndpointPermission ADD_CONNECTION_PROVIDER_PERM = =3D new EndpointPermission("addConnectionProvider"); = public EndpointImpl(final Executor executor, final String name) { @@ -117,7 +114,6 @@ if (sm !=3D null) { sm.checkPermission(CREATE_ENDPOINT_PERM); } - connectionProviders.put("jrs", new JrsConnectionProvider()); this.executor =3D executor; this.name =3D name; } @@ -138,21 +134,21 @@ return name; } = - public ConcurrentMap getAttributes() { - return endpointMap; - } - - public Handle createLocalRequestHandler(final R= equestListener requestListener, final Class requestClass, final Cl= ass replyClass) throws IOException { + public RequestHandler createLocalRequestHandler(final RequestLi= stener requestListener, final Class requestClass, final Class r= eplyClass) throws IOException { SecurityManager sm =3D System.getSecurityManager(); if (sm !=3D null) { sm.checkPermission(CREATE_REQUEST_HANDLER_PERM); } - LocalRequestHandler.Config config =3D new LocalRequestHandle= r.Config(requestClass, replyClass); - config.setExecutor(executor); - config.setRequestListener(requestListener); - config.setClientContext(new ClientContextImpl(executor)); - final LocalRequestHandler localRequestHandler =3D new LocalR= equestHandler(config); + checkOpen(); + final ClientContextImpl clientContext =3D new ClientContextImpl(ex= ecutor, loopbackConnection); + final LocalRequestHandler localRequestHandler =3D new LocalR= equestHandler(executor, + requestListener, clientContext, requestClass, replyClass); final WeakCloseable lrhCloseable =3D new WeakCloseable(localReques= tHandler); + clientContext.addCloseHandler(new CloseHandler() { + public void handleClose(final ClientContext closed) { + IoUtils.safeClose(localRequestHandler); + } + }); final Key key =3D addCloseHandler(new CloseHandler() { public void handleClose(final Endpoint closed) { IoUtils.safeClose(lrhCloseable); @@ -163,15 +159,17 @@ key.remove(); } }); - localRequestHandler.open(); - return localRequestHandler.getHandle(); + return localRequestHandler; } = - public Handle registerService(final Local= ServiceConfiguration configuration) throws IOException { + public SimpleCloseable registerService(final LocalServiceConfig= uration configuration) throws IOException { SecurityManager sm =3D System.getSecurityManager(); if (sm !=3D null) { sm.checkPermission(REGISTER_SERVICE_PERM); } + if (configuration =3D=3D null) { + throw new NullPointerException("configuration is null"); + } final String serviceType =3D configuration.getServiceType(); final String groupName =3D configuration.getGroupName(); final int metric =3D configuration.getMetric(); @@ -180,58 +178,91 @@ } ServiceURI.validateServiceType(serviceType); ServiceURI.validateGroupName(groupName); + checkOpen(); final String serviceKey =3D serviceType.toLowerCase() + ":" + grou= pName.toLowerCase(); - final LocalRequestHandlerSource.Config config =3D new LocalR= equestHandlerSource.Config(configuration.getRequestClass(), configurat= ion.getReplyClass()); - config.setRequestListener(configuration.getRequestListener()); - config.setExecutor(executor); - final LocalRequestHandlerSource localRequestHandlerSource = =3D new LocalRequestHandlerSource(config); - final ServiceRegistration registration =3D new ServiceRegistration= (serviceType, groupName, name, localRequestHandlerSource); + final Class requestClass =3D configuration.getRequestClass(); + final Class replyClass =3D configuration.getReplyClass(); + final ClientListener clientListener =3D configuration.getCli= entListener(); + final Executor executor =3D this.executor; + final Map registeredLocalServices =3D= this.registeredLocalServices; + final RequestHandlerConnector requestHandlerConnector =3D new Requ= estHandlerConnector() { + public Cancellable createRequestHandler(final Result result) throws SecurityException { + try { + final ClientContextImpl clientContext =3D new ClientCo= ntextImpl(executor, loopbackConnection); + final RequestListener requestListener =3D client= Listener.handleClientOpen(clientContext); + final RequestHandler localRequestHandler =3D createLoc= alRequestHandler(requestListener, requestClass, replyClass); + clientContext.addCloseHandler(new CloseHandler() { + public void handleClose(final ClientContext closed= ) { + IoUtils.safeClose(localRequestHandler); + } + }); + result.setResult(localRequestHandler); + } catch (IOException e) { + result.setException(e); + } + return Cancellable.NULL_CANCELLABLE; + } + }; + final ServiceRegistration registration =3D new ServiceRegistration= (serviceType, groupName, name, requestHandlerConnector); + // this handle is used to remove the service registration final AbstractSimpleCloseable newHandle =3D new AbstractSimpleClos= eable(executor) { protected void closeAction() throws IOException { - // todo fix - registeredLocalServices.remove(serviceKey); + final Lock lock =3D serviceRegistrationLock; + lock.lock(); + try { + registeredLocalServices.remove(serviceKey); + } finally { + lock.unlock(); + } } }; registration.setHandle(newHandle); + final List> serviceListe= nerRegistrations; final Lock lock =3D serviceRegistrationLock; + // actually register the service, and while we have the lock, snag= a copy of the registration listener list lock.lock(); try { - if (registeredLocalServices.putIfAbsent(serviceKey, registrati= on) !=3D null) { + if (registeredLocalServices.containsKey(serviceKey)) { throw new ServiceRegistrationException("Registration of se= rvice of type \"" + serviceType + "\" in group \"" + groupName + "\" duplic= ates an already-registered service's specification"); } + registeredLocalServices.put(serviceKey, registration); + serviceListenerRegistrations =3D new ArrayList>(this.serviceListenerRegistrations); } finally { lock.unlock(); } - final WeakCloseable lrhCloseable =3D new WeakCloseable(localReques= tHandlerSource); - final Key key =3D addCloseHandler(new CloseHandler() { - public void handleClose(final Endpoint closed) { + // this registration closes the service registration when the endp= oint is closed + final WeakCloseable lrhCloseable =3D new WeakCloseable(newHandle); + final Key key =3D addCloseHandler(new CloseHandler() { + public void handleClose(final Object closed) { IoUtils.safeClose(lrhCloseable); } }); - localRequestHandlerSource.addCloseHandler(new CloseHandler() { - public void handleClose(final RequestHandlerSource closed) { + // this registration removes the prior registration if the service= registration is closed + newHandle.addCloseHandler(new CloseHandler() { + public void handleClose(final Object closed) { key.remove(); } }); - localRequestHandlerSource.open(); - for (Registration slr : serviceListen= erRegistrations) { - final ServiceRegistrationListener registrationListener =3D slr= .getResource(); - try { - final ServiceRegistrationListener.ServiceInfo serviceInfo = =3D new ServiceRegistrationListener.ServiceInfo(); - serviceInfo.setGroupName(groupName); - serviceInfo.setServiceType(serviceType); - serviceInfo.setMetric(metric); - serviceInfo.setRegistrationHandle(newHandle); - serviceInfo.setRequestHandlerSource(localRequestHandlerSou= rce); - registrationListener.serviceRegistered(slr, serviceInfo); - } catch (VirtualMachineError vme) { - // panic! - throw vme; - } catch (Throwable t) { - logListenerError(t); + // notify all service listener registrations that were registered = at the time the service was created + final ServiceRegistrationListener.ServiceInfo serviceInfo =3D new = ServiceRegistrationListener.ServiceInfo(); + serviceInfo.setGroupName(groupName); + serviceInfo.setServiceType(serviceType); + serviceInfo.setMetric(metric); + serviceInfo.setRegistrationHandle(newHandle); + serviceInfo.setRequestHandlerConnector(requestHandlerConnector); + executor.execute(new Runnable() { + public void run() { + for (final Registration slr := serviceListenerRegistrations) { + final ServiceRegistrationListener registrationListener= =3D slr.getResource(); + try { + registrationListener.serviceRegistered(slr, servic= eInfo.clone()); + } catch (Throwable t) { + logListenerError(t); + } + } } - } - return localRequestHandlerSource.getHandle(); + }); + return newHandle; } = private static void logListenerError(final Throwable t) { @@ -243,196 +274,40 @@ if (sm !=3D null) { sm.checkPermission(CREATE_CLIENT_PERM); } - boolean ok =3D false; - final Handle handle =3D requestHandler.getHandle(); - try { - final ClientImpl client =3D ClientImpl.create(handle, ex= ecutor, requestType, replyType); - final WeakCloseable lrhCloseable =3D new WeakCloseable(new Wea= kReference(client)); - final Key key =3D addCloseHandler(new CloseHandler()= { - public void handleClose(final Endpoint closed) { - IoUtils.safeClose(lrhCloseable); - } - }); - client.addCloseHandler(new CloseHandler() { - public void handleClose(final Client closed) { - key.remove(); - } - }); - ok =3D true; - return client; - } finally { - if (! ok) { - IoUtils.safeClose(handle); - } + if (requestHandler =3D=3D null) { + throw new NullPointerException("requestHandler is null"); } - } - - public ClientSource createClientSource(final RequestHandl= erSource requestHandlerSource, final Class requestClass, final Class = replyClass) throws IOException { - SecurityManager sm =3D System.getSecurityManager(); - if (sm !=3D null) { - sm.checkPermission(CREATE_CLIENT_SOURCE_PERM); + if (requestType =3D=3D null) { + throw new NullPointerException("requestType is null"); } - boolean ok =3D false; - final Handle handle =3D requestHandlerSource= .getHandle(); - try { - final ClientSourceImpl clientSource =3D ClientSourceImpl= .create(handle, this, requestClass, replyClass); - final WeakCloseable lrhCloseable =3D new WeakCloseable(new Wea= kReference(clientSource)); - final Key key =3D addCloseHandler(new CloseHandler()= { - public void handleClose(final Endpoint closed) { - IoUtils.safeClose(lrhCloseable); - } - }); - clientSource.addCloseHandler(new CloseHandler() { - public void handleClose(final ClientSource closed) { - key.remove(); - } - }); - ok =3D true; - return clientSource; - } finally { - if (! ok) { - IoUtils.safeClose(handle); - } + if (replyType =3D=3D null) { + throw new NullPointerException("replyType is null"); } - } - - public IoFuture> openClientSource(final URI = uri, final Class requestClass, final Class replyClass) throws Illegal= ArgumentException { - final ConnectionProvider cp =3D getConnectio= nProvider(uri); - if (cp.getResourceType() !=3D ResourceType.CLIENT_SOURCE) { - throw new IllegalArgumentException("URI can not be used to ope= n a client source"); - } - final FutureResult> futureClientSource =3D new = FutureResult>(); - cp.connect(uri, new ConnectionProvider.Result() { - public void setResult(final RequestHandlerSource result) { - final ClientSource clientSource; - try { - clientSource =3D createClientSource(result, requestCla= ss, replyClass); - } catch (IOException e) { - IoUtils.safeClose(result); - futureClientSource.setException(e); - return; - } - futureClientSource.setResult(clientSource); + checkOpen(); + final ClientImpl client =3D ClientImpl.create(requestHandler= , executor, requestType, replyType); + final WeakCloseable lrhCloseable =3D new WeakCloseable(client); + // this registration closes the client when the endpoint is closed + final Key key =3D addCloseHandler(new CloseHandler() { + public void handleClose(final Endpoint closed) { + IoUtils.safeClose(lrhCloseable); } - - public void setException(final IOException exception) { - futureClientSource.setException(exception); - } - - public void setCancelled() { - futureClientSource.finishCancel(); - } }); - return futureClientSource; - } - - public IoFuture> openClient(final URI ur= i, final Class requestClass, final Class replyClass) throws IllegalAr= gumentException { - final ConnectionProvider cp =3D getConnectionProvi= der(uri); - if (cp.getResourceType() !=3D ResourceType.CLIENT) { - throw new IllegalArgumentException("URI can not be used to ope= n a client"); - } - final FutureResult> futureClient =3D new FutureResult= >(); - cp.connect(uri, new ConnectionProvider.Result() { - public void setResult(final RequestHandler result) { - final Client client; - try { - client =3D createClient(result, requestClass, replyCla= ss); - } catch (IOException e) { - IoUtils.safeClose(result); - futureClient.setException(e); - return; - } - futureClient.setResult(client); + // this registration removes the prior registration if the client = is closed + client.addCloseHandler(new CloseHandler() { + public void handleClose(final Client closed) { + IoUtils.safeClose(requestHandler); + key.remove(); } - - public void setException(final IOException exception) { - futureClient.setException(exception); - } - - public void setCancelled() { - futureClient.finishCancel(); - } }); - return futureClient; + return client; } = - public IoFuture openEndpointConnection(final URI = endpointUri) throws IllegalArgumentException { - final ConnectionProvider cp =3D getConnectionP= rovider(endpointUri); - if (cp.getResourceType() !=3D ResourceType.CLIENT) { - throw new IllegalArgumentException("URI can not be used to ope= n an endpoint connection"); - } - final FutureResult futureEndpointConn =3D new Fut= ureResult(); - cp.connect(endpointUri, new ConnectionProvider.Result() { - public void setResult(final EndpointConnection result) { - if (futureEndpointConn.setResult(new AbstractSimpleCloseab= le(executor) { - protected void closeAction() throws IOException { - result.close(); - } - })) { - // todo - add the endpoint connection to the endpoint = registry; notify listeners; etc. - } - } - - public void setException(final IOException exception) { - futureEndpointConn.setException(exception); - } - - public void setCancelled() { - futureEndpointConn.finishCancel(); - } - }); - return futureEndpointConn; - } - - public EndpointConnectionAcceptor addConnectionProvider(final String u= riScheme, final ConnectionProvider provider) { - final SecurityManager sm =3D System.getSecurityManager(); - if (sm !=3D null) { - sm.checkPermission(ADD_CONNECTION_PROVIDER_PERM); - } - final String key =3D uriScheme.toLowerCase(); - if (connectionProviders.putIfAbsent(key, provider) !=3D null) { - throw new IllegalArgumentException("Provider already registere= d for scheme \"" + uriScheme + "\""); - } - return new AbstractEndpointConnectionAcceptor(executor) { - protected void closeAction() throws IOException { - connectionProviders.remove(key, provider); - } - - public void accept(final EndpointConnection connection) { - // todo - add the endpoint connection to the endpoint regi= stry; notify listeners; etc. - } - }; - } - - public ResourceType getResourceType(final URI uri) { - final String scheme =3D uri.getScheme().toLowerCase(); - final ConnectionProvider provider =3D connectionProviders.get(s= cheme); - return provider !=3D null ? provider.getResourceType() : ResourceT= ype.UNKNOWN; - } - - @SuppressWarnings({ "unchecked" }) - private ConnectionProvider getConnectionProvider(final URI uri)= { - if (uri =3D=3D null) { - throw new NullPointerException("serviceUri is null"); - } - final String scheme =3D uri.getScheme(); - // this cast is checked later, indirectly - final ConnectionProvider cp =3D (ConnectionProvider) connect= ionProviders.get(scheme); - if (cp =3D=3D null) { - throw new IllegalArgumentException("No connection providers av= ailable for URI scheme \"" + scheme + "\""); - } - if (! ServiceURI.isRemotingServiceUri(uri)) { - throw new IllegalArgumentException("Not a valid remoting servi= ce URI"); - } - return cp; - } - public SimpleCloseable addServiceRegistrationListener(final ServiceReg= istrationListener listener, final Set flags) { final SecurityManager sm =3D System.getSecurityManager(); if (sm !=3D null) { sm.checkPermission(ADD_SERVICE_LISTENER_PERM); } - final Registration registration =3D n= ew Registration(executor, listener, serviceLis= tenerRegistrations); + final Registration registration =3D n= ew Registration(listener); final Lock lock =3D serviceRegistrationLock; final Collection services; lock.lock(); @@ -451,7 +326,7 @@ serviceInfo.setGroupName(service.getGroupName()); serviceInfo.setMetric(service.getMetric()); serviceInfo.setRegistrationHandle(service.getHandle()); - serviceInfo.setRequestHandlerSource(service.getHandlerSource()= ); + serviceInfo.setRequestHandlerConnector(service.getConnector()); serviceInfo.setServiceType(service.getServiceType()); listener.serviceRegistered(registration, serviceInfo); if (! registration.isOpen()) { @@ -461,18 +336,108 @@ return registration; } = - private static final class Registration extends AbstractSimpleClose= able { + public IoFuture connect(final URI destination) t= hrows IOException { + final SecurityManager sm =3D System.getSecurityManager(); + if (sm !=3D null) { + sm.checkPermission(CONNECT_PERM); + } + final ConnectionProvider connectionProvider =3D connectionProvider= s.get(destination.getScheme()); + final FutureResult futureRes= ult =3D new FutureResult() { + protected Connection translate(final ConnectionHandlerFactory = result) { + return new ConnectionImpl(result); + } + }; + connectionProvider.connect(destination, futureResult.getResult()); + return futureResult; + } + + public void addConnectionProvider(final String uriScheme, final Connec= tionProviderFactory providerFactory) { + final SecurityManager sm =3D System.getSecurityManager(); + if (sm !=3D null) { + sm.checkPermission(ADD_CONNECTION_PROVIDER_PERM); + } + final ConnectionProviderContextImpl context =3D new ConnectionProv= iderContextImpl(executor, LOOPBACK_CONNECTION_HANDLER); + final ConnectionProvider provider =3D providerFactory.createInstan= ce(context); + if (connectionProviders.putIfAbsent(uriScheme, provider) !=3D null= ) { + IoUtils.safeClose(context); + throw new IllegalArgumentException("URI scheme '" + uriScheme = + "' is already registered to a provider"); + } + context.addCloseHandler(new CloseHandler() { + public void handleClose(final ConnectionProviderContext closed= ) { + connectionProviders.remove(uriScheme, provider); + } + }); + } + + public String toString() { + return "endpoint \"" + name + "\" <" + Integer.toHexString(hashCod= e()) + ">"; + } + + private IoFuture> doOpenClient(final Con= nectionHandler connectionHandler, final String serviceType, final String gr= oupName, final Class requestClass, final Class replyClass) { + final FutureResult, RequestHandler> futureResult =3D = new FutureResult, RequestHandler>() { + protected Client translate(final RequestHandler result) = throws IOException { + return createClient(result, requestClass, replyClass); + } + }; + connectionHandler.open(serviceType, groupName, futureResult.getRes= ult()); + return futureResult; + } + + private class ConnectionImpl extends AbstractHandleableCloseable implements Connection { + private final ConnectionHandler connectionHandler; + + private ConnectionImpl(final ConnectionHandlerFactory connectionHa= ndler) { + super(EndpointImpl.this.executor); + this.connectionHandler =3D connectionHandler.createInstance(LO= OPBACK_CONNECTION_HANDLER); + } + + public IoFuture> openClient(final St= ring serviceType, final String groupName, final Class requestClass, fina= l Class replyClass) { + return doOpenClient(connectionHandler, serviceType, groupName,= requestClass, replyClass); + } + + public ClientConnector createClientConnector(final Re= questListener listener, final Class requestClass, final Class r= eplyClass) throws IOException { + final RequestHandler localRequestHandler =3D createLocalReques= tHandler(listener, requestClass, replyClass); + final RequestHandlerConnector connector =3D connectionHandler.= createConnector(localRequestHandler); + final ClientContextImpl context =3D new ClientContextImpl(exec= utor, this); + context.addCloseHandler(new CloseHandler() { + public void handleClose(final ClientContext closed) { + IoUtils.safeClose(localRequestHandler); + } + }); + return new ClientConnectorImpl(connector, EndpointImpl.t= his, requestClass, replyClass, context); + } + } + + private static final class ConnectionProviderContextImpl extends Abstr= actHandleableCloseable implements ConnectionProv= iderContext { + + private final ConnectionHandler localConnectionHandler; + + private ConnectionProviderContextImpl(final Executor executor, fin= al ConnectionHandler localConnectionHandler) { + super(executor); + this.localConnectionHandler =3D localConnectionHandler; + } + + public void accept(final ConnectionHandlerFactory connectionHandle= rFactory) { + connectionHandlerFactory.createInstance(localConnectionHandler= ); + } + } + + private final class Registration extends AbstractSimpleCloseable { private final T resource; - private final Queue> resourceQueue; = - private Registration(final Executor executor, final T resource, fi= nal Queue> resourceQueue) { + private Registration(final T resource) { super(executor); this.resource =3D resource; - this.resourceQueue =3D resourceQueue; } = protected void closeAction() throws IOException { - resourceQueue.remove(this); + final Lock lock =3D serviceRegistrationLock; + lock.lock(); + try { + serviceListenerRegistrations.remove(this); + } finally { + lock.unlock(); + } } = protected boolean isOpen() { @@ -484,47 +449,47 @@ } } = - public String toString() { - return "endpoint \"" + name + "\" <" + Integer.toHexString(hashCod= e()) + ">"; - } - - final class JrsConnectionProvider implements ConnectionProvider { - - public Cancellable connect(final URI uri, final Result requestHandlerSourceResult) throws IllegalArgumentException { - final ServiceSpecification spec =3D ServiceSpecification.fromU= ri(uri); - for (ServiceRegistration sr : registeredLocalServices.values()= ) { - if (sr.matches(spec)) { - requestHandlerSourceResult.setResult(sr.getHandlerSour= ce()); - } + private final ConnectionHandler LOOPBACK_CONNECTION_HANDLER =3D new Co= nnectionHandler() { + public Cancellable open(final String serviceName, final String gro= upName, final Result result) { + // the loopback connection opens a local service + // local services are registered as RequestHandlerConnectors + final ServiceRegistration registration =3D registeredLocalServ= ices.get(serviceName + ":" + groupName); + if (registration !=3D null) { + return registration.getConnector().createRequestHandler(re= sult); } - // todo - iterate through discovered services as well + result.setException(new ServiceNotFoundException(ServiceURI.cr= eate(serviceName, groupName, name), "No such service located")); return Cancellable.NULL_CANCELLABLE; } = - public URI getConnectionUri(final URI uri) { - return uri; + public RequestHandlerConnector createConnector(final RequestHandle= r localHandler) { + // the loopback connection just returns the local handler dire= ctly as no forwarding is involved + return new RequestHandlerConnector() { + public Cancellable createRequestHandler(final Result result) throws SecurityException { + result.setResult(localHandler); + return Cancellable.NULL_CANCELLABLE; + } + }; } = - public ResourceType getResourceType() { - return ResourceType.CLIENT_SOURCE; + public void close() { + // not closeable } - } + }; = - /** - * - */ - static final class FutureResult extends AbstractIoFuture { + private final Connection loopbackConnection =3D new Connection() { + public IoFuture> openClient(final St= ring serviceType, final String groupName, final Class requestClass, fina= l Class replyClass) { + return null; + } = - protected boolean setException(final IOException exception) { - return super.setException(exception); + public ClientConnector createClientConnector(final Re= questListener listener, final Class requestClass, final Class r= eplyClass) { + return null; } = - protected boolean setResult(final T result) { - return super.setResult(result); + public void close() throws IOException { } = - protected boolean finishCancel() { - return super.finishCancel(); + public Key addCloseHandler(final CloseHandler = closeHandler) { + return null; } - } + }; } Added: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Fut= ureResult.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Future= Result.java (rev 0) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Future= Result.java 2009-04-30 22:50:24 UTC (rev 5099) @@ -0,0 +1,65 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2009, 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.remoting3; + +import org.jboss.xnio.AbstractIoFuture; +import org.jboss.remoting3.spi.Result; +import java.io.IOException; + +abstract class FutureResult extends AbstractIoFuture { + private final Result result =3D new Result() { + public void setResult(final X result) { + try { + FutureResult.this.setResult(translate(result)); + } catch (IOException e) { + FutureResult.this.setException(e); + } + } + + public void setException(final IOException exception) { + FutureResult.this.setException(exception); + } + + public void setCancelled() { + finishCancel(); + } + }; + + abstract protected T translate(X result) throws IOException; + + Result getResult() { + return result; + } + + protected boolean setException(final IOException exception) { + return super.setException(exception); + } + + protected boolean setResult(final T result) { + return super.setResult(result); + } + + protected boolean finishCancel() { + return super.finishCancel(); + } +} Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/= IndeterminateOutcomeException.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Indete= rminateOutcomeException.java 2009-04-30 22:49:46 UTC (rev 5098) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Indete= rminateOutcomeException.java 2009-04-30 22:50:24 UTC (rev 5099) @@ -1,3 +1,25 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2009, 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.remoting3; = /** Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/= LocalRequestHandler.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/LocalR= equestHandler.java 2009-04-30 22:49:46 UTC (rev 5098) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/LocalR= equestHandler.java 2009-04-30 22:50:24 UTC (rev 5099) @@ -44,12 +44,12 @@ = private static final Logger log =3D Logger.getLogger("org.jboss.remoti= ng.listener"); = - LocalRequestHandler(Config config) { - super(config.getExecutor()); - requestListener =3D config.getRequestListener(); - clientContext =3D config.getClientContext(); - requestClass =3D config.getRequestClass(); - replyClass =3D config.getReplyClass(); + LocalRequestHandler(final Executor executor, final RequestListener requestListener, final ClientContextImpl clientContext, final Class r= equestClass, final Class replyClass) { + super(executor); + this.requestListener =3D requestListener; + this.clientContext =3D clientContext; + this.requestClass =3D requestClass; + this.replyClass =3D replyClass; } = public RemoteRequestContext receiveRequest(final Object request, final= ReplyHandler replyHandler) { @@ -86,69 +86,13 @@ = protected void closeAction() throws IOException { try { - requestListener.handleClientClose(clientContext); + requestListener.handleClose(); } catch (Throwable t) { - log.error(t, "Unexpected exception in request listener client = close handler method"); + log.error(t, "Unexpected exception in request listener handleC= lose() method"); } } = - void open() throws IOException { - try { - requestListener.handleClientOpen(clientContext); - } catch (Throwable t) { - final IOException ioe =3D new IOException("Failed to open clie= nt context"); - ioe.initCause(t); - throw ioe; - } - } - public String toString() { return "local request handler <" + Integer.toHexString(hashCode())= + "> (request listener =3D " + String.valueOf(requestListener) + ")"; } - - static class Config { - private final Class requestClass; - private final Class replyClass; - - private Executor executor; - private RequestListener requestListener; - private ClientContextImpl clientContext; - - Config(final Class requestClass, final Class replyClass) { - this.requestClass =3D requestClass; - this.replyClass =3D replyClass; - } - - public Class getRequestClass() { - return requestClass; - } - - public Class getReplyClass() { - return replyClass; - } - - public Executor getExecutor() { - return executor; - } - - public void setExecutor(final Executor executor) { - this.executor =3D executor; - } - - public RequestListener getRequestListener() { - return requestListener; - } - - public void setRequestListener(final RequestListener request= Listener) { - this.requestListener =3D requestListener; - } - - public ClientContextImpl getClientContext() { - return clientContext; - } - - public void setClientContext(final ClientContextImpl clientContext= ) { - this.clientContext =3D clientContext; - } - } } Deleted: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/L= ocalRequestHandlerSource.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/LocalR= equestHandlerSource.java 2009-04-30 22:49:46 UTC (rev 5098) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/LocalR= equestHandlerSource.java 2009-04-30 22:50:24 UTC (rev 5099) @@ -1,131 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2008, 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.remoting3; - -import java.io.IOException; -import java.util.concurrent.Executor; -import org.jboss.remoting3.spi.AbstractAutoCloseable; -import org.jboss.remoting3.spi.Handle; -import org.jboss.remoting3.spi.RequestHandler; -import org.jboss.remoting3.spi.RequestHandlerSource; -import org.jboss.xnio.log.Logger; - -/** - * - */ -final class LocalRequestHandlerSource extends AbstractAutoCloseable<= RequestHandlerSource> implements RequestHandlerSource { - - private final RequestListener requestListener; - private final ServiceContextImpl serviceContext; - private final Executor executor; - private final Class requestClass; - private final Class replyClass; - - private static final Logger log =3D Logger.getLogger("org.jboss.remoti= ng.listener-source"); - - LocalRequestHandlerSource(final Config config) { - super(config.getExecutor()); - requestClass =3D config.getRequestClass(); - replyClass =3D config.getReplyClass(); - requestListener =3D config.getRequestListener(); - executor =3D config.getExecutor(); - serviceContext =3D new ServiceContextImpl(executor); - } - - public Handle createRequestHandler() throws IOExceptio= n { - if (isOpen()) { - final LocalRequestHandler.Config config =3D new LocalReq= uestHandler.Config(requestClass, replyClass); - config.setExecutor(executor); - config.setRequestListener(requestListener); - config.setClientContext(new ClientContextImpl(serviceContext)); - final LocalRequestHandler localRequestHandler =3D new Lo= calRequestHandler(config); - localRequestHandler.open(); - return localRequestHandler.getHandle(); - } else { - throw new IOException("LocalRequestHandlerSource is closed"); - } - } - - void open() throws IOException { - try { - requestListener.handleServiceOpen(serviceContext); - addCloseHandler(new CloseHandler() { - public void handleClose(final RequestHandlerSource closed)= { - try { - requestListener.handleServiceClose(serviceContext); - } catch (Throwable t) { - log.error(t, "Unexpected exception in request list= ener client close handler method"); - } - } - }); - } catch (Throwable t) { - final IOException ioe =3D new IOException("Failed to open clie= nt context"); - ioe.initCause(t); - throw ioe; - } - } - - ServiceContextImpl getServiceContext() { - return serviceContext; - } - - public String toString() { - return "local request handler source <" + Integer.toHexString(hash= Code()) + "> (request listener =3D " + String.valueOf(requestListener) + ")= "; - } - - static class Config { - private final Class requestClass; - private final Class replyClass; - private Executor executor; - private RequestListener requestListener; - - Config(final Class requestClass, final Class replyClass) { - this.requestClass =3D requestClass; - this.replyClass =3D replyClass; - } - - public Class getRequestClass() { - return requestClass; - } - - public Class getReplyClass() { - return replyClass; - } - - public Executor getExecutor() { - return executor; - } - - public void setExecutor(final Executor executor) { - this.executor =3D executor; - } - - public RequestListener getRequestListener() { - return requestListener; - } - - public void setRequestListener(final RequestListener request= Listener) { - this.requestListener =3D requestListener; - } - } -} Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/= LocalServiceConfiguration.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/LocalS= erviceConfiguration.java 2009-04-30 22:49:46 UTC (rev 5098) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/LocalS= erviceConfiguration.java 2009-04-30 22:50:24 UTC (rev 5099) @@ -28,7 +28,7 @@ * @apiviz.exclude */ public final class LocalServiceConfiguration { - private final RequestListener requestListener; + private final ClientListener clientListener; private final Class requestClass; private final Class replyClass; private String serviceType; @@ -38,12 +38,12 @@ /** * Construct a new instance. * - * @param requestListener the request listener + * @param clientListener the client listener * @param requestClass the request class * @param replyClass the reply class */ - public LocalServiceConfiguration(final RequestListener requestLi= stener, final Class requestClass, final Class replyClass) { - this.requestListener =3D requestListener; + public LocalServiceConfiguration(final ClientListener clientList= ener, final Class requestClass, final Class replyClass) { + this.clientListener =3D clientListener; this.requestClass =3D requestClass; this.replyClass =3D replyClass; } @@ -53,8 +53,8 @@ * * @return the request listener */ - public RequestListener getRequestListener() { - return requestListener; + public ClientListener getClientListener() { + return clientListener; } = /** Added: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Not= OpenException.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/NotOpe= nException.java (rev 0) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/NotOpe= nException.java 2009-04-30 22:50:24 UTC (rev 5099) @@ -0,0 +1,72 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2009, 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.remoting3; + +import java.io.IOException; + +/** + * The resource is not open. + */ +public class NotOpenException extends IOException { + + private static final long serialVersionUID =3D 8918460812305000601L; + + /** + * Constructs a {@code NotOpenException} with no detail message. The c= ause is not initialized, and may subsequently be + * initialized by a call to {@link #initCause(Throwable) initCause}. + */ + public NotOpenException() { + } + + /** + * Constructs a {@code NotOpenException} with the specified detail mes= sage. The cause is not initialized, and may + * subsequently be initialized by a call to {@link #initCause(Throwabl= e) initCause}. + * + * @param msg the detail message + */ + public NotOpenException(final String msg) { + super(msg); + } + + /** + * Constructs a {@code NotOpenException} with the specified cause. The= detail message is set to: + *
(cause =3D=3D null ? null : cause.toString())
+ * (which typically contains the class and detail message of {@code ca= use}). + * + * @param cause the cause (which is saved for later retrieval by the {= @link #getCause()} method) + */ + public NotOpenException(final Throwable cause) { + super(cause); + } + + /** + * Constructs a {@code NotOpenException} with the specified detail mes= sage and cause. + * + * @param msg the detail message + * @param cause the cause (which is saved for later retrieval by the {= @link #getCause()} method) + */ + public NotOpenException(final String msg, final Throwable cause) { + super(msg, cause); + } + +} Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/= RemoteExecutionException.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Remote= ExecutionException.java 2009-04-30 22:49:46 UTC (rev 5098) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Remote= ExecutionException.java 2009-04-30 22:50:24 UTC (rev 5099) @@ -1,3 +1,25 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2009, 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.remoting3; = /** Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/= Remoting.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Remoti= ng.java 2009-04-30 22:49:46 UTC (rev 5098) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Remoti= ng.java 2009-04-30 22:50:24 UTC (rev 5099) @@ -29,9 +29,7 @@ import java.util.concurrent.ThreadFactory; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; -import org.jboss.remoting3.spi.Handle; import org.jboss.remoting3.spi.RequestHandler; -import org.jboss.remoting3.spi.RequestHandlerSource; import org.jboss.xnio.CloseableExecutor; import org.jboss.xnio.IoUtils; import org.jboss.xnio.log.Logger; @@ -126,34 +124,15 @@ * @throws IOException if an error occurs */ public static Client createLocalClient(final Endpoint end= point, final RequestListener requestListener, final Class requestC= lass, final Class replyClass) throws IOException { - final Handle handle =3D endpoint.createLocalReques= tHandler(requestListener, requestClass, replyClass); + final RequestHandler requestHandler =3D endpoint.createLocalReques= tHandler(requestListener, requestClass, replyClass); try { - return endpoint.createClient(handle.getResource(), requestClas= s, replyClass); + return endpoint.createClient(requestHandler, requestClass, rep= lyClass); } finally { - IoUtils.safeClose(handle); + IoUtils.safeClose(requestHandler); } } = /** - * Create a local client source from a local service configuration. T= he client source will be registered on the endpoint. - * - * @param endpoint the endpoint to bind the service to - * @param config the service configuration - * @param the request type - * @param the reply type - * @return a new client source - * @throws IOException if an error occurs - */ - public static ClientSource createLocalClientSource(final = Endpoint endpoint, final LocalServiceConfiguration config) throws IOE= xception { - final Handle handle =3D endpoint.registerSer= vice(config); - try { - return endpoint.createClientSource(handle.getResource(), confi= g.getRequestClass(), config.getReplyClass()); - } finally { - IoUtils.safeClose(handle); - } - } - - /** * An exception indicating that there was a problem creating an endpoi= nt. * * @apiviz.exclude Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/= RequestListener.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Reques= tListener.java 2009-04-30 22:49:46 UTC (rev 5098) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Reques= tListener.java 2009-04-30 22:50:24 UTC (rev 5099) @@ -32,20 +32,6 @@ */ public interface RequestListener { /** - * Handle the opening of a client. - * - * @param context the client context - */ - void handleClientOpen(ClientContext context); - - /** - * Handle the opening of a service. - * - * @param context the service context - */ - void handleServiceOpen(ServiceContext context); - - /** * Handle a request. If this method throws {@code RemoteExecutionExce= ption}, then that exception is passed * back to the caller and the request is marked as complete. Otherwis= e, the request * listener must send back either a reply (using the {@code sendReply(= )} method on the {@code RequestContext}) or @@ -59,16 +45,8 @@ void handleRequest(RequestContext context, I request) throws Remote= ExecutionException; = /** - * Handle the close of a service. - * - * @param context the service context + * Handle the client closing. Free up any resources. This method is = called after the close has occurred, + * so exceptions thrown will be ignored. */ - void handleServiceClose(ServiceContext context); - - /** - * Handle the close of a client. - * - * @param context the client context - */ - void handleClientClose(ClientContext context); + void handleClose(); } Deleted: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/R= esourceType.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Resour= ceType.java 2009-04-30 22:49:46 UTC (rev 5098) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Resour= ceType.java 2009-04-30 22:50:24 UTC (rev 5099) @@ -1,51 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2009, 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.remoting3; - -/** - * The type of resource supported by a specific connection manager. - * - * @apiviz.excluded - */ -public enum ResourceType { - - /** - * An unknown resource. Such a resource cannot be opened by an endpoi= nt. - */ - UNKNOWN, - /** - * A client resource. Use {@link Endpoint#openClient(java.net.URI, Cl= ass, Class) Endpoint.openClient(*)} to open - * a client resource URI. - */ - CLIENT, - /** - * A client source resource. Use {@link Endpoint#openClientSource(jav= a.net.URI, Class, Class) Endpoint.openClientSource(*)} to open - * a client source resource URI. - */ - CLIENT_SOURCE, - /** - * An endpoint resource. Use {@link Endpoint#openEndpointConnection(j= ava.net.URI) Endpoint.openEndpointConnection(*)} to open - * an endpoint resource URI. - */ - ENDPOINT, -} Deleted: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/S= erviceContext.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Servic= eContext.java 2009-04-30 22:49:46 UTC (rev 5098) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Servic= eContext.java 2009-04-30 22:50:24 UTC (rev 5099) @@ -1,41 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2009, 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.remoting3; - -import java.util.concurrent.ConcurrentMap; - -/** - * The server-side context of a service. Used to hold state relating to a= service (known as a {@code ContextSource} on - * the client side). - * - * @apiviz.exclude - */ -public interface ServiceContext extends HandleableCloseable { - - /** - * Get an attribute map which can be used to cache arbitrary state on = the server side. - * - * @return the attribute map - */ - ConcurrentMap getAttributes(); -} Deleted: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/S= erviceContextImpl.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Servic= eContextImpl.java 2009-04-30 22:49:46 UTC (rev 5098) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Servic= eContextImpl.java 2009-04-30 22:50:24 UTC (rev 5099) @@ -1,41 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2008, 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.remoting3; - -import java.util.concurrent.Executor; -import org.jboss.xnio.log.Logger; - -/** - * - */ -final class ServiceContextImpl extends AbstractContextImpl= implements ServiceContext { - private static final Logger log =3D Logger.getLogger("org.jboss.remoti= ng.service-context"); - - protected ServiceContextImpl(final Executor executor) { - super(executor); - } - - public String toString() { - return "service context instance <" + Integer.toHexString(hashCode= ()) + ">"; - } -} Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/= ServiceNotFoundException.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Servic= eNotFoundException.java 2009-04-30 22:49:46 UTC (rev 5098) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Servic= eNotFoundException.java 2009-04-30 22:50:24 UTC (rev 5099) @@ -27,7 +27,7 @@ /** * Service not found. This exception is thrown when a service is looked u= p which is not registered anywhere. */ -public final class ServiceNotFoundException extends RemotingException { +public class ServiceNotFoundException extends RemotingException { = private static final long serialVersionUID =3D -998858276817298658L; = Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/= ServiceRegistration.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Servic= eRegistration.java 2009-04-30 22:49:46 UTC (rev 5098) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Servic= eRegistration.java 2009-04-30 22:50:24 UTC (rev 5099) @@ -22,7 +22,7 @@ = package org.jboss.remoting3; = -import org.jboss.remoting3.spi.RequestHandlerSource; +import org.jboss.remoting3.spi.RequestHandlerConnector; = /** * @@ -33,25 +33,25 @@ private final String groupName; private final String endpointName; private final int metric; - private final RequestHandlerSource handlerSource; + private final RequestHandlerConnector connector; private volatile SimpleCloseable handle; = - ServiceRegistration(final String serviceType, final String groupName, = final String endpointName, final int metric, final RequestHandlerSource han= dlerSource) { + ServiceRegistration(final String serviceType, final String groupName, = final String endpointName, final int metric, final RequestHandlerConnector = connector) { remote =3D true; this.serviceType =3D serviceType; this.groupName =3D groupName; this.endpointName =3D endpointName; this.metric =3D metric; - this.handlerSource =3D handlerSource; + this.connector =3D connector; } = - ServiceRegistration(final String serviceType, final String groupName, = final String endpointName, final RequestHandlerSource handlerSource) { + ServiceRegistration(final String serviceType, final String groupName, = final String endpointName, final RequestHandlerConnector connector) { remote =3D false; metric =3D 0; this.serviceType =3D serviceType; this.groupName =3D groupName; this.endpointName =3D endpointName; - this.handlerSource =3D handlerSource; + this.connector =3D connector; } = public boolean matches(final String serviceType, final String groupNam= e, final String endpointName) { @@ -87,8 +87,8 @@ return metric; } = - public RequestHandlerSource getHandlerSource() { - return handlerSource; + public RequestHandlerConnector getConnector() { + return connector; } = public SimpleCloseable getHandle() { Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/= ServiceRegistrationListener.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Servic= eRegistrationListener.java 2009-04-30 22:49:46 UTC (rev 5098) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Servic= eRegistrationListener.java 2009-04-30 22:50:24 UTC (rev 5099) @@ -22,7 +22,7 @@ = package org.jboss.remoting3; = -import org.jboss.remoting3.spi.RequestHandlerSource; +import org.jboss.remoting3.spi.RequestHandlerConnector; = /** * A listener for watching service registrations on an endpoint. @@ -44,11 +44,11 @@ * * @apiviz.exclude */ - final class ServiceInfo { + final class ServiceInfo implements Cloneable { private String serviceType; private String groupName; private int metric; - private RequestHandlerSource requestHandlerSource; + private RequestHandlerConnector requestHandlerConnector; private SimpleCloseable registrationHandle; = /** @@ -116,17 +116,17 @@ * * @return the request handler source */ - public RequestHandlerSource getRequestHandlerSource() { - return requestHandlerSource; + public RequestHandlerConnector getRequestHandlerConnector() { + return requestHandlerConnector; } = /** * Set the request handler source. * - * @param requestHandlerSource the request handler source + * @param requestHandlerConnector the request handler source */ - public void setRequestHandlerSource(final RequestHandlerSource req= uestHandlerSource) { - this.requestHandlerSource =3D requestHandlerSource; + public void setRequestHandlerConnector(final RequestHandlerConnect= or requestHandlerConnector) { + this.requestHandlerConnector =3D requestHandlerConnector; } = /** @@ -146,5 +146,18 @@ public void setRegistrationHandle(final SimpleCloseable registrati= onHandle) { this.registrationHandle =3D registrationHandle; } + + /** + * Create a shallow clone. + * + * @return the clone + */ + public ServiceInfo clone() { + try { + return (ServiceInfo) super.clone(); + } catch (CloneNotSupportedException e) { + throw new IllegalStateException(e); + } + } } } Added: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Unk= nownURISchemeException.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Unknow= nURISchemeException.java (rev 0) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Unknow= nURISchemeException.java 2009-04-30 22:50:24 UTC (rev 5099) @@ -0,0 +1,70 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2009, 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.remoting3; + +/** + * Unknown URI scheme. Thrown when attempting to open a connection or cli= ent with a URI whose scheme is not associated + * with any registered providers. + */ +public class UnknownURISchemeException extends RemotingException { + + private static final long serialVersionUID =3D 4880830942189310924L; + + /** + * Constructs a {@code UnknownURISchemeException} with no detail messa= ge. The cause is not initialized, and may + * subsequently be initialized by a call to {@link #initCause(Throwabl= e) initCause}. + */ + public UnknownURISchemeException() { + } + + /** + * Constructs a {@code UnknownURISchemeException} with the specified d= etail message. The cause is not initialized, and + * may subsequently be initialized by a call to {@link #initCause(Thro= wable) initCause}. + * + * @param msg the detail message + */ + public UnknownURISchemeException(final String msg) { + super(msg); + } + + /** + * Constructs a {@code UnknownURISchemeException} with the specified c= ause. The detail message is set to: + *
(cause =3D=3D null ? null : cause.toString())
+ * (which typically contains the class and detail message of {@code ca= use}). + * + * @param cause the cause (which is saved for later retrieval by the {= @link #getCause()} method) + */ + public UnknownURISchemeException(final Throwable cause) { + super(cause); + } + + /** + * Constructs a {@code UnknownURISchemeException} with the specified d= etail message and cause. + * + * @param msg the detail message + * @param cause the cause (which is saved for later retrieval by the {= @link #getCause()} method) + */ + public UnknownURISchemeException(final String msg, final Throwable cau= se) { + super(msg, cause); + } +} Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/= package-info.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/packag= e-info.java 2009-04-30 22:49:46 UTC (rev 5098) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/packag= e-info.java 2009-04-30 22:50:24 UTC (rev 5099) @@ -1,6 +1,77 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2009, 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. + */ + /** * The base Remoting 3 API package. + *

+ * The main flow of client requests works like this: + *

+ * {@websequence.show mainflow} + *

* * @apiviz.exclude org.jboss.remoting.transporter + * + * @websequence.diagram mainflow + * participant "User code" as user + * participant "IoFuture" as fr + * participant "Client\n(endpoint A)" as client + * participant "Protocol's\nRequest Handler" as rh1 + * participant "~~~\n~~~" + * participant "Local Request\nHandler (endpoint B)" as rh2 + * participant "RequestListener\n(endpoint B)" as rl + * loop + * user->client: "client.send(request);" + * activate client + * client->rh1: "requestHandler\n.receiveRequest();" + * activate rh1 + * client->fr: "...creates..." + * activate fr + * deactivate client + * fr->user: "return\nfutureReply;" + * deactivate fr + * activate user + * rh1-->rh2: Marshalled request + * deactivate rh1 + * activate rh2 + * rh2->rl: listener\n.handleRequest() + * deactivate rh2 + * activate rl + * rl->rh2: context\n.sendReply() + * activate rh2 + * deactivate rl + * rh2-->rh1: Marshalled reply + * deactivate rh2 + * activate rh1 + * rh1->fr: replyHandler.handleReply() + * deactivate rh1 + * activate fr + * fr->user: invoke notifiers\n(async) + * deactivate fr + * user->fr: futureReply.get(); + * deactivate user + * activate fr + * fr->user: reply + * destroy fr + * activate user + * end */ package org.jboss.remoting3; \ No newline at end of file Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/= spi/AbstractAutoCloseable.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Ab= stractAutoCloseable.java 2009-04-30 22:49:46 UTC (rev 5098) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Ab= stractAutoCloseable.java 2009-04-30 22:50:24 UTC (rev 5099) @@ -29,6 +29,7 @@ import java.util.concurrent.atomic.AtomicInteger; import org.jboss.remoting3.CloseHandler; import org.jboss.remoting3.RemotingException; +import org.jboss.remoting3.HandleableCloseable; import org.jboss.xnio.IoUtils; import org.jboss.xnio.WeakCloseable; import org.jboss.xnio.log.Logger; @@ -37,7 +38,7 @@ * A closeable implementation that supports reference counting. Since the= initial reference count is zero, implementors * must be careful to ensure that the first operation invoked is a call to= {@link #getHandle()}. */ -public abstract class AbstractAutoCloseable extends AbstractHandleableC= loseable implements AutoCloseable { +public abstract class AbstractAutoCloseable> extends AbstractHandleableCloseable implements AutoCloseable { = private static final Logger log =3D Logger.getLogger("org.jboss.remoti= ng.resource"); = Copied: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/sp= i/AbstractConnectionProviderContext.java (from rev 5050, remoting3/trunk/jb= oss-remoting/src/main/java/org/jboss/remoting3/spi/AbstractEndpointConnecti= onAcceptor.java) =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Ab= stractConnectionProviderContext.java (rev 0) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Ab= stractConnectionProviderContext.java 2009-04-30 22:50:24 UTC (rev 5099) @@ -0,0 +1,37 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2009, 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.remoting3.spi; + +import java.util.concurrent.Executor; + +public abstract class AbstractConnectionProviderContext extends AbstractHa= ndleableCloseable implements ConnectionProviderC= ontext { + + /** + * Basic constructor. + * + * @param executor the executor used to execute the close notification= handlers + */ + protected AbstractConnectionProviderContext(final Executor executor) { + super(executor); + } +} Deleted: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/s= pi/AbstractEndpointConnectionAcceptor.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Ab= stractEndpointConnectionAcceptor.java 2009-04-30 22:49:46 UTC (rev 5098) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Ab= stractEndpointConnectionAcceptor.java 2009-04-30 22:50:24 UTC (rev 5099) @@ -1,37 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2009, 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.remoting3.spi; - -import java.util.concurrent.Executor; - -public abstract class AbstractEndpointConnectionAcceptor extends AbstractH= andleableCloseable implements EndpointConnectio= nAcceptor { - - /** - * Basic constructor. - * - * @param executor the executor used to execute the close notification= handlers - */ - protected AbstractEndpointConnectionAcceptor(final Executor executor) { - super(executor); - } -} Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/= spi/AbstractHandleableCloseable.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Ab= stractHandleableCloseable.java 2009-04-30 22:49:46 UTC (rev 5098) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Ab= stractHandleableCloseable.java 2009-04-30 22:50:24 UTC (rev 5099) @@ -25,13 +25,13 @@ import java.io.IOException; import java.security.AccessController; import java.security.PrivilegedAction; -import java.util.HashSet; -import java.util.Set; +import java.util.IdentityHashMap; +import java.util.Map; import java.util.concurrent.Executor; import java.util.concurrent.RejectedExecutionException; -import java.util.concurrent.atomic.AtomicBoolean; import org.jboss.remoting3.CloseHandler; import org.jboss.remoting3.HandleableCloseable; +import org.jboss.remoting3.NotOpenException; import org.jboss.remoting3.RemotingException; import org.jboss.xnio.IoUtils; import org.jboss.xnio.log.Logger; @@ -40,18 +40,18 @@ * A basic implementation of a closeable resource. Use as a convenient ba= se class for your closeable resources. * Ensures that the {@code close()} method is idempotent; implements the r= egistry of close handlers. */ -public abstract class AbstractHandleableCloseable implements Handleable= Closeable { +public abstract class AbstractHandleableCloseable> implements HandleableCloseable { = private static final Logger log =3D Logger.getLogger("org.jboss.remoti= ng.resource"); + private static final boolean LEAK_DEBUGGING; = - protected final Executor executor; + private final Executor executor; + private final StackTraceElement[] backtrace; + private final Object closeLock =3D new Object(); - private final AtomicBoolean closed =3D new AtomicBoolean(); - private Set> closeHandlers; + private boolean closed; + private Map> closeHandlers =3D null; = - private static final boolean LEAK_DEBUGGING; - private final StackTraceElement[] backtrace; - static { boolean b =3D false; try { @@ -86,7 +86,9 @@ * @return {@code true} if the resource is still open */ protected boolean isOpen() { - return ! closed.get(); + synchronized (closeLock) { + return ! closed; + } } = /** @@ -99,24 +101,21 @@ /** * {@inheritDoc} */ - @SuppressWarnings({ "unchecked" }) public final void close() throws IOException { - if (! closed.getAndSet(true)) { + final Map> closeHandlers; + synchronized (closeLock) { + if (closed) { + return; + } + closed =3D true; + closeHandlers =3D this.closeHandlers; + this.closeHandlers =3D null; + } + if (closeHandlers !=3D null) { log.trace("Closed %s", this); - synchronized (closeLock) { - if (closeHandlers !=3D null) { - for (final CloseHandler handler : closeHand= lers) { - try { - executor.execute(new Runnable() { - public void run() { - SpiUtils.safeHandleClose(handler, (T) = AbstractHandleableCloseable.this); - } - }); - } catch (RejectedExecutionException ree) { - SpiUtils.safeHandleClose(handler, (T) Abstract= HandleableCloseable.this); - } - } - closeHandlers =3D null; + if (closeHandlers !=3D null) { + for (final CloseHandler handler : closeHandlers= .values()) { + runCloseTask(new CloseHandlerTask(handler)); } } closeAction(); @@ -127,21 +126,56 @@ * {@inheritDoc} */ public Key addCloseHandler(final CloseHandler handler) { + if (handler =3D=3D null) { + throw new NullPointerException("handler is null"); + } synchronized (closeLock) { - if (closeHandlers =3D=3D null) { - closeHandlers =3D new HashSet>(); + if (! closed) { + final Key key =3D new KeyImpl(this); + final Map> closeHandlers =3D = this.closeHandlers; + if (closeHandlers =3D=3D null) { + final IdentityHashMap> ne= wMap =3D new IdentityHashMap>(); + this.closeHandlers =3D newMap; + newMap.put(key, handler); + } else { + closeHandlers.put(key, handler); + } + return key; } - closeHandlers.add(handler); - return new Key() { - public void remove() { - synchronized (closeLock) { - final Set> closeHandlers = =3D AbstractHandleableCloseable.this.closeHandlers; - if (closeHandlers !=3D null) { - closeHandlers.remove(handler); - } - } + } + runCloseTask(new CloseHandlerTask(handler)); + return new NullKey(); + } + + private void runCloseTask(final CloseHandlerTask task) { + try { + executor.execute(task); + } catch (RejectedExecutionException ree) { + task.run(); + } + } + + private static final class NullKey implements Key { + public void remove() { + } + } + + private static final class KeyImpl> i= mplements Key { + + private final AbstractHandleableCloseable instance; + + private KeyImpl(final AbstractHandleableCloseable instance) { + this.instance =3D instance; + } + + public void remove() { + synchronized (instance.closeLock) { + final Map> closeHandlers =3D = instance.closeHandlers; + + if (closeHandlers !=3D null) { + closeHandlers.remove(this); } - }; + } } } = @@ -161,7 +195,7 @@ try { super.finalize(); } finally { - if (isOpen()) { + if (! isOpen()) { if (LEAK_DEBUGGING) { final Throwable t =3D new LeakThrowable(); t.setStackTrace(backtrace); @@ -174,6 +208,19 @@ } } = + /** + * Check if open, throwing an exception if it is not. + * + * @throws org.jboss.remoting3.NotOpenException if not open + */ + protected void checkOpen() throws NotOpenException { + synchronized (closeLock) { + if (closed) { + throw new NotOpenException(toString() + " is not open"); + } + } + } + @SuppressWarnings({ "serial" }) private static final class LeakThrowable extends Throwable { = @@ -184,4 +231,18 @@ return "a leaked reference"; } } + + private final class CloseHandlerTask>= implements Runnable { + + private final CloseHandler handler; + + private CloseHandlerTask(final CloseHandler handler) { + this.handler =3D handler; + } + + @SuppressWarnings({ "unchecked" }) + public void run() { + SpiUtils.safeHandleClose(handler, (T) AbstractHandleableClosea= ble.this); + } + } } Copied: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/sp= i/ConnectionHandler.java (from rev 5032, remoting3/trunk/jboss-remoting/src= /main/java/org/jboss/remoting3/spi/EndpointConnection.java) =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Co= nnectionHandler.java (rev 0) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Co= nnectionHandler.java 2009-04-30 22:50:24 UTC (rev 5099) @@ -0,0 +1,49 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2009, 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.remoting3.spi; + +import java.io.Closeable; + +/** + * A connection to a foreign endpoint. This interface is implemented by t= he protocol implementation. + */ +public interface ConnectionHandler extends Closeable { + + /** + * Open a request handler. + * + * @param serviceName the service name + * @param groupName the group name + * @param result the result for the connected request handler + * @return a handle which may be used to cancel the pending operation + */ + Cancellable open(String serviceName, String groupName, Result result); + + /** + * Create a connector which may be used to communicate with the given = local RequestHandler. The connector + * should only produce a result once it has passed to the remote side = of this connection. + * + * @return the connector + */ + RequestHandlerConnector createConnector(RequestHandler localHandler); +} Added: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi= /ConnectionHandlerFactory.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Co= nnectionHandlerFactory.java (rev 0) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Co= nnectionHandlerFactory.java 2009-04-30 22:50:24 UTC (rev 5099) @@ -0,0 +1,38 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2009, 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.remoting3.spi; + +/** + * + */ +public interface ConnectionHandlerFactory { + + /** + * Create a connection handler instance. The provided connection hand= ler is the handler for the next hop of + * the local connection; typically this will be the endpoint loopback = connection but it may not be. + * + * @param localConnectionHandler the local connection handler for inco= ming requests + * @return the connection handler for outgoing requests + */ + ConnectionHandler createInstance(ConnectionHandler localConnectionHand= ler); +} Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/= spi/ConnectionProvider.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Co= nnectionProvider.java 2009-04-30 22:49:46 UTC (rev 5098) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Co= nnectionProvider.java 2009-04-30 22:50:24 UTC (rev 5099) @@ -22,25 +22,15 @@ = package org.jboss.remoting3.spi; = -import java.io.IOException; import java.net.URI; -import org.jboss.remoting3.ResourceType; = /** + * A connection provider. Used to establish connections with remote syste= ms. * + * @remoting.implement */ -public interface ConnectionProvider { - Cancellable connect(URI uri, Result result) throws IllegalArgumentE= xception; +public interface ConnectionProvider { + Cancellable connect(URI uri, Result result) = throws IllegalArgumentException; = URI getConnectionUri(URI uri); - - ResourceType getResourceType(); - - interface Result { - void setResult(T result); - - void setException(IOException exception); - - void setCancelled(); - } } Copied: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/sp= i/ConnectionProviderContext.java (from rev 5050, remoting3/trunk/jboss-remo= ting/src/main/java/org/jboss/remoting3/spi/EndpointConnectionAcceptor.java) =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Co= nnectionProviderContext.java (rev 0) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Co= nnectionProviderContext.java 2009-04-30 22:50:24 UTC (rev 5099) @@ -0,0 +1,32 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2009, 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.remoting3.spi; + +import org.jboss.remoting3.HandleableCloseable; + +/** + * + */ +public interface ConnectionProviderContext extends HandleableCloseable { + void accept(ConnectionHandlerFactory connectionHandlerFactory); +} Added: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi= /ConnectionProviderFactory.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Co= nnectionProviderFactory.java (rev 0) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Co= nnectionProviderFactory.java 2009-04-30 22:50:24 UTC (rev 5099) @@ -0,0 +1,30 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2009, 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.remoting3.spi; + +/** + * + */ +public interface ConnectionProviderFactory { + ConnectionProvider createInstance(ConnectionProviderContext context); +} Deleted: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/s= pi/EndpointConnection.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/En= dpointConnection.java 2009-04-30 22:49:46 UTC (rev 5098) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/En= dpointConnection.java 2009-04-30 22:50:24 UTC (rev 5099) @@ -1,38 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2009, 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.remoting3.spi; - -import java.io.Closeable; - -/** - * A connection to a foreign endpoint. - */ -public interface EndpointConnection extends Closeable { - String getEndpointName(); - - int getMetric(); - - ConnectionProvider getRequestHandlerConnectionProvider= (); - - ConnectionProvider getRequestHandlerSourceConnec= tionProvider(); -} Deleted: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/s= pi/EndpointConnectionAcceptor.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/En= dpointConnectionAcceptor.java 2009-04-30 22:49:46 UTC (rev 5098) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/En= dpointConnectionAcceptor.java 2009-04-30 22:50:24 UTC (rev 5099) @@ -1,32 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2009, 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.remoting3.spi; - -import org.jboss.remoting3.HandleableCloseable; - -/** - * - */ -public interface EndpointConnectionAcceptor extends HandleableCloseable { - void accept(EndpointConnection connection); -} Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/= spi/RequestHandler.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Re= questHandler.java 2009-04-30 22:49:46 UTC (rev 5098) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Re= questHandler.java 2009-04-30 22:50:24 UTC (rev 5099) @@ -22,15 +22,16 @@ = package org.jboss.remoting3.spi; = +import org.jboss.remoting3.HandleableCloseable; + /** - * A request handler, which can be passed to remote endpoints. Remote sys= tems can then use the handler - * to make invocations, or they may forward a handler on to other remote s= ystems. + * A request handler. *

* This is an internal Remoting interface, intended to be implemented only= by Remoting internals and protocol implementations. - * It should not be implemented by end-users, as members may be added with= out notice. Applications should instead use + * It should not be used or implemented by end-users. Members may be adde= d without notice. Applications should instead use * the {@link org.jboss.remoting3.Client Client} and {@link org.jboss.remo= ting3.RequestListener RequestListener} interfaces. */ -public interface RequestHandler extends AutoCloseable { +public interface RequestHandler extends HandleableCloseable { = /** * Receive a request from a remote system. This method is intended to= be called by protocol handlers. If the Added: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi= /RequestHandlerConnector.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Re= questHandlerConnector.java (rev 0) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Re= questHandlerConnector.java 2009-04-30 22:50:24 UTC (rev 5099) @@ -0,0 +1,39 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2009, 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.remoting3.spi; + +/** + * + */ +public interface RequestHandlerConnector { + + /** + * Get the request handler. If this connector was forwarded, this met= hod may only be called once; + * further attempts to call it should result in a {@code SecurityExcep= tion}. + * + * @param result the result of the connection + * @return the cancellation handle + * @throws SecurityException if this is a forwarding connector, thrown= if the connector was not forwarded or if this method is called more than o= ne time + */ + Cancellable createRequestHandler(Result result) throws= SecurityException; +} Deleted: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/s= pi/RequestHandlerSource.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Re= questHandlerSource.java 2009-04-30 22:49:46 UTC (rev 5098) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Re= questHandlerSource.java 2009-04-30 22:50:24 UTC (rev 5099) @@ -1,42 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2008, 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.remoting3.spi; - -import java.io.IOException; - -/** - * A request handler source, which can be passed to remote endpoints. Rem= ote systems can then use the handler source - * to acquire request handlers, or they may pass it on to other systems. = Acquiring a request handler using this method - * has the advantage that a round trip to the remote side is not necessary= ; the local side can spawn a request handler - * and simply notify the remote side of the change. - */ -public interface RequestHandlerSource extends AutoCloseable { - - /** - * Create a request handler for the service corresponding to this requ= est handler source. - * - * @return a request handler - * @throws IOException if a client could not be opened - */ - Handle createRequestHandler() throws IOException; -} Added: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi= /Result.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Re= sult.java (rev 0) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Re= sult.java 2009-04-30 22:50:24 UTC (rev 5099) @@ -0,0 +1,33 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2009, 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.remoting3.spi; + +import java.io.IOException; + +public interface Result { + void setResult(T result); + + void setException(IOException exception); + + void setCancelled(); +} Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/= stream/InputStreamHandlerFactory.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/stream= /InputStreamHandlerFactory.java 2009-04-30 22:49:46 UTC (rev 5098) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/stream= /InputStreamHandlerFactory.java 2009-04-30 22:50:24 UTC (rev 5099) @@ -22,13 +22,14 @@ = package org.jboss.remoting3.stream; = +import java.io.IOException; import java.io.InputStream; -import java.io.IOException; import java.nio.ByteBuffer; -import org.jboss.xnio.channels.StreamChannel; +import java.nio.channels.Channel; +import org.jboss.xnio.IoFuture; import org.jboss.xnio.IoHandler; import org.jboss.xnio.IoUtils; -import org.jboss.xnio.IoFuture; +import org.jboss.xnio.channels.StreamChannel; import org.jboss.xnio.log.Logger; = /** @@ -73,7 +74,7 @@ }; } = - public IoHandler getRemoteHandler() { + public IoHandler getRemoteHandler() { return IoUtils.nullHandler(); } = Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/= stream/OutputStreamHandlerFactory.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/stream= /OutputStreamHandlerFactory.java 2009-04-30 22:49:46 UTC (rev 5098) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/stream= /OutputStreamHandlerFactory.java 2009-04-30 22:50:24 UTC (rev 5099) @@ -22,21 +22,22 @@ = package org.jboss.remoting3.stream; = -import java.io.OutputStream; import java.io.IOException; +import java.io.InputStreamReader; import java.io.InterruptedIOException; -import java.io.InputStreamReader; +import java.io.OutputStream; +import static java.lang.Math.min; +import static java.lang.Thread.currentThread; import java.nio.ByteBuffer; +import java.nio.channels.Channel; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; -import static java.lang.Math.min; -import static java.lang.Thread.currentThread; -import org.jboss.xnio.channels.StreamChannel; -import org.jboss.xnio.channels.ChannelInputStream; +import org.jboss.xnio.IoFuture; import org.jboss.xnio.IoHandler; -import org.jboss.xnio.IoFuture; +import static org.jboss.xnio.IoUtils.nullHandler; import static org.jboss.xnio.IoUtils.safeClose; -import static org.jboss.xnio.IoUtils.nullHandler; +import org.jboss.xnio.channels.ChannelInputStream; +import org.jboss.xnio.channels.StreamChannel; = /** * A handler factory for automatic forwarding of output streams. @@ -62,7 +63,7 @@ return new LocalHandler(localInstance); } = - public IoHandler getRemoteHandler() { + public IoHandler getRemoteHandler() { return nullHandler(); } = Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/= stream/StreamHandler.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/stream= /StreamHandler.java 2009-04-30 22:49:46 UTC (rev 5098) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/stream= /StreamHandler.java 2009-04-30 22:50:24 UTC (rev 5099) @@ -44,7 +44,7 @@ * * @return the local XNIO handler */ - IoHandler getLocalHandler(); + IoHandler getLocalHandler(); = /** * Get the remote XNIO handler for this stream. The remote handler sh= ould not be instantiated until the @@ -52,7 +52,7 @@ * * @return the remote XNIO handler */ - IoHandler getRemoteHandler(); + IoHandler getRemoteHandler(); = /** * Get the remote proxy instance for this stream. The remote proxy sh= ould not be instantiated until the Modified: remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/= EndpointTestCase.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/Endpoi= ntTestCase.java 2009-04-30 22:49:46 UTC (rev 5098) +++ remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/Endpoi= ntTestCase.java 2009-04-30 22:50:24 UTC (rev 5099) @@ -22,22 +22,12 @@ = package org.jboss.remoting3; = -import junit.framework.TestCase; -import java.util.concurrent.Executors; import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; -import java.io.IOException; -import org.jboss.remoting3.AbstractRequestListener; -import org.jboss.remoting3.RequestContext; -import org.jboss.remoting3.RemoteExecutionException; -import org.jboss.remoting3.CloseHandler; -import org.jboss.remoting3.Client; -import org.jboss.remoting3.IndeterminateOutcomeException; -import org.jboss.remoting3.spi.RequestHandler; -import org.jboss.remoting3.spi.Handle; +import junit.framework.TestCase; import org.jboss.xnio.IoUtils; -import org.jboss.xnio.IoFuture; import org.jboss.xnio.log.Logger; = /** @@ -68,47 +58,6 @@ final Object requestObj =3D new Object(); final Object replyObj =3D new Object(); try { - final Handle handle =3D endpoint.createLoc= alRequestHandler(new AbstractRequestListener() { - public void handleRequest(final RequestContext= context, final Object request) throws RemoteExecutionException { - assertEquals(request, requestObj); - try { - context.sendReply(replyObj); - } catch (IOException e) { - log.error(e, "Error sending reply!"); - } - } - }, Object.class, Object.class); - try { - final RequestHandler requestHandler =3D handle.getReso= urce(); - try { - requestHandler.addCloseHandler(new CloseHandler() { - public void handleClose(final RequestHandler c= losed) { - clientEndpointClosed.set(true); - } - }); - final Client client =3D endpoint.cr= eateClient(requestHandler, Object.class, Object.class); - try { - client.addCloseHandler(new CloseHandler>() { - public void handleClose(final Client closed) { - clientClosed.set(true); - } - }); - handle.close(); - assertEquals(replyObj, client.invoke(requestOb= j)); - client.close(); - executorService.shutdown(); - assertTrue(executorService.awaitTermination(1L= , TimeUnit.SECONDS)); - assertTrue(clientEndpointClosed.get()); - assertTrue(clientClosed.get()); - } finally { - IoUtils.safeClose(client); - } - } finally { - IoUtils.safeClose(requestHandler); - } - } finally { - IoUtils.safeClose(handle); - } } finally { IoUtils.safeClose(endpoint); } @@ -124,51 +73,6 @@ try { final EndpointImpl endpoint =3D new EndpointImpl(executorServi= ce, "test-endpoint"); try { - final Object requestObj =3D new Object(); - final Object replyObj =3D new Object(); - final Handle handle =3D endpoint.createLoc= alRequestHandler(new AbstractRequestListener() { - public void handleRequest(final RequestContext= context, final Object request) throws RemoteExecutionException { - assertEquals(request, requestObj); - try { - context.sendReply(replyObj); - } catch (IOException e) { - log.error(e, "Error sending reply!"); - } - } - }, Object.class, Object.class); - try { - final RequestHandler requestHandler =3D handle.getReso= urce(); - try { - requestHandler.addCloseHandler(new CloseHandler() { - public void handleClose(final RequestHandler c= losed) { - clientEndpointClosed.set(true); - } - }); - final Client client =3D endpoint.cr= eateClient(requestHandler, Object.class, Object.class); - try { - client.addCloseHandler(new CloseHandler>() { - public void handleClose(final Client closed) { - clientClosed.set(true); - } - }); - handle.close(); - final IoFuture futureReply = =3D client.send(requestObj); - assertEquals(IoFuture.Status.DONE, futureReply= .await(1L, TimeUnit.SECONDS)); - assertEquals(replyObj, futureReply.get()); - client.close(); - executorService.shutdown(); - assertTrue(executorService.awaitTermination(1L= , TimeUnit.SECONDS)); - assertTrue(clientEndpointClosed.get()); - assertTrue(clientClosed.get()); - } finally { - IoUtils.safeClose(client); - } - } finally { - IoUtils.safeClose(requestHandler); - } - } finally { - IoUtils.safeClose(handle); - } } finally { IoUtils.safeClose(endpoint); } @@ -182,30 +86,6 @@ try { final EndpointImpl endpoint =3D new EndpointImpl(executorServi= ce, "test-endpoint"); try { - final Object requestObj =3D new Object(); - final Handle handle =3D endpoint.createLoc= alRequestHandler(new AbstractRequestListener() { - public void handleRequest(final RequestContext= context, final Object request) throws RemoteExecutionException { - assertEquals(request, requestObj); - // don't send a reply!! - } - }, Object.class, Object.class); - try { - final RequestHandler requestHandler =3D handle.getReso= urce(); - try { - final Client client =3D endpoint.cr= eateClient(requestHandler, Object.class, Object.class); - try { - final IoFuture futureReply = =3D client.send(requestObj); - assertEquals(IoFuture.Status.FAILED, futureRep= ly.await(500L, TimeUnit.MILLISECONDS)); - assertTrue(futureReply.getException() instance= of IndeterminateOutcomeException); - } finally { - IoUtils.safeClose(client); - } - } finally { - IoUtils.safeClose(requestHandler); - } - } finally { - IoUtils.safeClose(handle); - } } finally { IoUtils.safeClose(endpoint); } @@ -219,50 +99,6 @@ try { final EndpointImpl endpoint =3D new EndpointImpl(executorServi= ce, "test-endpoint"); try { - final Object requestObj =3D new Object(); - final Handle handle =3D endpoint.createLoc= alRequestHandler(new AbstractRequestListener() { - public void handleRequest(final RequestContext= context, final Object request) throws RemoteExecutionException { - assertEquals(request, requestObj); - context.execute(new Runnable() { - public void run() { - context.execute(new Runnable() { - public void run() { - context.execute(new Runnable() { - public void run() { - } - }); - } - }); - context.execute(new Runnable() { - public void run() { - } - }); - } - }); - context.execute(new Runnable() { - public void run() { - } - }); - // don't send a reply!! - } - }, Object.class, Object.class); - try { - final RequestHandler requestHandler =3D handle.getReso= urce(); - try { - final Client client =3D endpoint.cr= eateClient(requestHandler, Object.class, Object.class); - try { - final IoFuture futureReply = =3D client.send(requestObj); - assertEquals(IoFuture.Status.FAILED, futureRep= ly.await(500L, TimeUnit.MILLISECONDS)); - assertTrue(futureReply.getException() instance= of IndeterminateOutcomeException); - } finally { - IoUtils.safeClose(client); - } - } finally { - IoUtils.safeClose(requestHandler); - } - } finally { - IoUtils.safeClose(handle); - } } finally { IoUtils.safeClose(endpoint); } Modified: remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/= spi/CloseableTestCase.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/spi/Cl= oseableTestCase.java 2009-04-30 22:49:46 UTC (rev 5098) +++ remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/spi/Cl= oseableTestCase.java 2009-04-30 22:50:24 UTC (rev 5099) @@ -46,7 +46,7 @@ try { final AtomicBoolean closed =3D new AtomicBoolean(); final CountDownLatch latch =3D new CountDownLatch(1); - final AbstractHandleableCloseable closeable =3D new Ab= stractHandleableCloseable(executorService) { + final AbstractSimpleCloseable closeable =3D new AbstractSimple= Closeable(executorService) { // empty }; try { @@ -75,12 +75,12 @@ try { final AtomicBoolean closed =3D new AtomicBoolean(); final CountDownLatch latch =3D new CountDownLatch(1); - final AbstractAutoCloseable closeable =3D new Abstract= AutoCloseable(executorService) { + final AbstractAutoCloseable closeable =3D new AbstractAutoClos= eable(executorService) { // empty }; - final Handle rootHandle =3D closeable.getHandle(); + final Handle rootHandle =3D closeable.getHandle(); try { - closeable.addCloseHandler(new CloseHandler() { + closeable.addCloseHandler(new CloseHandler() { public void handleClose(final Object x) { closed.set(true); latch.countDown(); @@ -105,7 +105,7 @@ try { final AtomicBoolean closed =3D new AtomicBoolean(); final CountDownLatch latch =3D new CountDownLatch(1); - final AbstractAutoCloseable closeable =3D new Abstract= AutoCloseable(executorService) { + final AbstractAutoCloseable closeable =3D new AbstractAutoClos= eable(executorService) { // empty }; final Handle rootHandle =3D closeable.getHandle(); @@ -141,7 +141,7 @@ try { final AtomicBoolean closed =3D new AtomicBoolean(); final CountDownLatch latch =3D new CountDownLatch(1); - final AbstractAutoCloseable closeable =3D new Abstract= AutoCloseable(executorService) { + final AbstractAutoCloseable closeable =3D new AbstractAutoClos= eable(executorService) { // empty }; final Handle rootHandle =3D closeable.getHandle(); @@ -183,7 +183,7 @@ public void testHandlerRemoval() throws Throwable { final AtomicBoolean handlerCalled =3D new AtomicBoolean(); final Executor executor =3D IoUtils.directExecutor(); - final AbstractAutoCloseable closeable =3D new AbstractAuto= Closeable(executor) { + final AbstractAutoCloseable closeable =3D new AbstractAutoCloseabl= e(executor) { // empty }; final Handle rootHandle =3D closeable.getHandle(); --===============4636074511258383274==-- From jboss-remoting-commits at lists.jboss.org Thu Apr 30 19:04:23 2009 Content-Type: multipart/mixed; boundary="===============6624998412675452650==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5100 - in remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3: spi and 1 other directory. Date: Thu, 30 Apr 2009 18:58:40 -0400 Message-ID: --===============6624998412675452650== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: david.lloyd(a)jboss.com Date: 2009-04-30 18:58:40 -0400 (Thu, 30 Apr 2009) New Revision: 5100 Removed: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Service= Specification.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Abs= tractConnectionProviderContext.java Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Service= LocationListener.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Service= Registration.java Log: Remove unused stuff, update javadocs Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/= ServiceLocationListener.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Servic= eLocationListener.java 2009-04-30 22:50:24 UTC (rev 5099) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Servic= eLocationListener.java 2009-04-30 22:58:40 UTC (rev 5100) @@ -32,33 +32,66 @@ public interface ServiceLocationListener { void serviceLocated(SimpleCloseable listenerHandler, ServiceInfo info); = + /** + * Information about a located service. + */ final class ServiceInfo { private URI serviceUri; private URI locationUri; - private int preference; + private int metric; = + /** + * Get the URI of the located service. + * + * @return the URI + */ public URI getServiceUri() { return serviceUri; } = + /** + * Set the URI of the located service. + * + * @param serviceUri the URI + */ public void setServiceUri(final URI serviceUri) { this.serviceUri =3D serviceUri; } = + /** + * Get the URI of the location of the located service. + * + * @return the URI + */ public URI getLocationUri() { return locationUri; } = + /** + * Set the URI of the location of the located service. + * + * @param locationUri the URI + */ public void setLocationUri(final URI locationUri) { this.locationUri =3D locationUri; } = - public int getPreference() { - return preference; + /** + * Get the preference metric of this located service. + * + * @return the preference metric + */ + public int getMetric() { + return metric; } = - public void setPreference(final int preference) { - this.preference =3D preference; + /** + * Set the preference metric of this located service. + * + * @param metric the preference metric + */ + public void setMetric(final int metric) { + this.metric =3D metric; } } } Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/= ServiceRegistration.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Servic= eRegistration.java 2009-04-30 22:50:24 UTC (rev 5099) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Servic= eRegistration.java 2009-04-30 22:58:40 UTC (rev 5100) @@ -60,13 +60,6 @@ (endpointName =3D=3D null || endpointName.length() =3D=3D = 0 || "*".equals(endpointName) || endpointName.equals(this.endpointName)); } = - public boolean matches(final ServiceSpecification spec) { - final String serviceType =3D spec.getServiceType(); - final String groupName =3D spec.getGroupName(); - final String endpointName =3D spec.getEndpointName(); - return matches(serviceType, groupName, endpointName); - } - public boolean isRemote() { return remote; } Deleted: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/S= erviceSpecification.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Servic= eSpecification.java 2009-04-30 22:50:24 UTC (rev 5099) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Servic= eSpecification.java 2009-04-30 22:58:40 UTC (rev 5100) @@ -1,158 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2009, 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.remoting3; - -import java.net.URI; - -/** - * A specification of a JBoss Remoting service. - * - * @apiviz.exclude - */ -public final class ServiceSpecification { - private final String serviceType; - private final String groupName; - private final String endpointName; - - /** - * Construct a new instance. Each argument is validated and converted= into a canonical form. The arguments - * may be "*" indicating that anything will match. - * - * @param serviceType the service type - * @param groupName the group name - * @param endpointName the endpoint name - */ - public ServiceSpecification(final String serviceType, final String gro= upName, final String endpointName) { - if (serviceType =3D=3D null) { - throw new NullPointerException("serviceType is null"); - } - if (groupName =3D=3D null) { - throw new NullPointerException("groupName is null"); - } - if (endpointName =3D=3D null) { - throw new NullPointerException("endpointName is null"); - } - if (serviceType.length() > 0 && ! "*".equals(serviceType)) { - ServiceURI.validateServiceType(serviceType); - this.serviceType =3D serviceType.toLowerCase(); - } else { - this.serviceType =3D "*"; - } - if (groupName.length() > 0 && ! "*".equals(groupName)) { - ServiceURI.validateGroupName(groupName); - this.groupName =3D groupName.toLowerCase(); - } else { - this.groupName =3D "*"; - } - if (endpointName.length() > 0 && ! "*".equals(endpointName)) { - ServiceURI.validateEndpointName(endpointName); - this.endpointName =3D endpointName.toLowerCase(); - } else { - this.endpointName =3D "*"; - } - } - - /** - * Create an instance from a service URI. - * - * @param uri the URI - * @return the specificaion - */ - public static ServiceSpecification fromUri(final URI uri) { - return new ServiceSpecification(ServiceURI.getServiceType(uri), Se= rviceURI.getGroupName(uri), ServiceURI.getEndpointName(uri)); - } - - /** - * Get the service type of this specification. - * - * @return the service type - */ - public String getServiceType() { - return serviceType; - } - - /** - * Get the group name of this specification. - * - * @return the group name - */ - public String getGroupName() { - return groupName; - } - - /** - * Get the endpoint name of this specification. - * - * @return the endpoint name - */ - public String getEndpointName() { - return endpointName; - } - - /** - * Determine whether the given URI matches this specification. - * - * @param serviceUri the service URI - * @return {@code true} if the URI is a service which matches this spe= cification - */ - public boolean matches(final URI serviceUri) { - if (! ServiceURI.isRemotingServiceUri(serviceUri)) { - return false; - } - if (! "*".equals(serviceType)) { - if (! serviceType.equals(ServiceURI.getServiceType(serviceUri)= )) { - return false; - } - } - if (! "*".equals(groupName)) { - if (! groupName.equals(ServiceURI.getGroupName(serviceUri))) { - return false; - } - } - if (! "*".equals(endpointName)) { - if (! endpointName.equals(ServiceURI.getEndpointName(serviceUr= i))) { - return false; - } - } - return true; - } - - /** {@inheritDoc} */ - public boolean equals(final Object o) { - if (this =3D=3D o) return true; - if (! (o instanceof ServiceSpecification)) return false; - final ServiceSpecification that =3D (ServiceSpecification) o; - if (!endpointName.equals(that.endpointName)) return false; - if (!groupName.equals(that.groupName)) return false; - if (!serviceType.equals(that.serviceType)) return false; - return true; - } - - /** {@inheritDoc} */ - public int hashCode() { - int result =3D serviceType.hashCode(); - result =3D 31 * result + groupName.hashCode(); - result =3D 31 * result + endpointName.hashCode(); - return result; - } -} Deleted: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/s= pi/AbstractConnectionProviderContext.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Ab= stractConnectionProviderContext.java 2009-04-30 22:50:24 UTC (rev 5099) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Ab= stractConnectionProviderContext.java 2009-04-30 22:58:40 UTC (rev 5100) @@ -1,37 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2009, 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.remoting3.spi; - -import java.util.concurrent.Executor; - -public abstract class AbstractConnectionProviderContext extends AbstractHa= ndleableCloseable implements ConnectionProviderC= ontext { - - /** - * Basic constructor. - * - * @param executor the executor used to execute the close notification= handlers - */ - protected AbstractConnectionProviderContext(final Executor executor) { - super(executor); - } -} --===============6624998412675452650==-- From jboss-remoting-commits at lists.jboss.org Thu Apr 30 19:06:12 2009 Content-Type: multipart/mixed; boundary="===============7613226663752550595==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5101 - in remoting3/trunk/jboss-remoting/src: main/java/org/jboss/remoting3/spi and 1 other directories. Date: Thu, 30 Apr 2009 19:01:14 -0400 Message-ID: --===============7613226663752550595== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: david.lloyd(a)jboss.com Date: 2009-04-30 19:01:14 -0400 (Thu, 30 Apr 2009) New Revision: 5101 Removed: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Abs= tractAutoCloseable.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Aut= oCloseable.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Han= dle.java Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/LocalRe= questHandler.java remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/spi/Clo= seableTestCase.java Log: The new connection model does not rely on refcounting, so remove that stuff Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/= LocalRequestHandler.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/LocalR= equestHandler.java 2009-04-30 22:58:40 UTC (rev 5100) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/LocalR= equestHandler.java 2009-04-30 23:01:14 UTC (rev 5101) @@ -25,7 +25,7 @@ import java.io.IOException; import java.util.concurrent.Executor; import java.util.concurrent.RejectedExecutionException; -import org.jboss.remoting3.spi.AbstractAutoCloseable; +import org.jboss.remoting3.spi.AbstractHandleableCloseable; import org.jboss.remoting3.spi.RemoteRequestContext; import org.jboss.remoting3.spi.ReplyHandler; import org.jboss.remoting3.spi.RequestHandler; @@ -35,7 +35,7 @@ /** * */ -final class LocalRequestHandler extends AbstractAutoCloseable implements RequestHandler { +final class LocalRequestHandler extends AbstractHandleableCloseable<= RequestHandler> implements RequestHandler { = private final RequestListener requestListener; private final ClientContextImpl clientContext; Deleted: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/s= pi/AbstractAutoCloseable.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Ab= stractAutoCloseable.java 2009-04-30 22:58:40 UTC (rev 5100) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Ab= stractAutoCloseable.java 2009-04-30 23:01:14 UTC (rev 5101) @@ -1,160 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2008, 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.remoting3.spi; - -import java.io.Closeable; -import java.io.IOException; -import java.lang.ref.WeakReference; -import java.util.concurrent.Executor; -import java.util.concurrent.atomic.AtomicInteger; -import org.jboss.remoting3.CloseHandler; -import org.jboss.remoting3.RemotingException; -import org.jboss.remoting3.HandleableCloseable; -import org.jboss.xnio.IoUtils; -import org.jboss.xnio.WeakCloseable; -import org.jboss.xnio.log.Logger; - -/** - * A closeable implementation that supports reference counting. Since the= initial reference count is zero, implementors - * must be careful to ensure that the first operation invoked is a call to= {@link #getHandle()}. - */ -public abstract class AbstractAutoCloseable> extends AbstractHandleableCloseable implements AutoCloseable { - - private static final Logger log =3D Logger.getLogger("org.jboss.remoti= ng.resource"); - - private final AtomicInteger refcount =3D new AtomicInteger(0); - private final Executor executor; - - /** - * Basic constructor. - * - * @param executor the executor used to execute the close notification= handlers - */ - protected AbstractAutoCloseable(final Executor executor) { - super(executor); - this.executor =3D executor; - } - - /** - * Decrement the reference count by one. If the count drops to zero, = the resource is closed. - * - * @throws IOException if the reference count dropped to zero and the = close operation threw an exception - */ - protected void dec() throws IOException { - final int v =3D refcount.decrementAndGet(); - if (v =3D=3D 0) { - // we dropped the refcount to zero - log.trace("Lowering reference count of %s to 0 (closing)", thi= s); - if (refcount.compareAndSet(0, -65536)) { - // we are closing - close(); - } - // someone incremented it in the meantime... lucky them - } else if (v < 0) { - // was already closed; put the count back - refcount.incrementAndGet(); - } else { - log.trace("Lowering reference count of %s to %d", this, Intege= r.valueOf(v)); - } - // otherwise, the resource remains open - } - - /** - * Increment the reference count by one. If the resource is closed, a= n exception is thrown. - * - * @throws RemotingException if the resource is closed - */ - protected void inc() throws IOException { - final int v =3D refcount.getAndIncrement(); - log.trace("Raising reference count of %s to %d", this, Integer.val= ueOf(v + 1)); - if (v < 0) { - // was already closed - refcount.decrementAndGet(); - throw new IOException("Resource is closed"); - } - } - - /** - * Get a handle to this resource. Increments the reference count by o= ne. If the resource is closed, an exception - * is thrown. - * - * @return the handle - * @throws RemotingException if the resource is closed - */ - public Handle getHandle() throws IOException { - final HandleImpl handle =3D new HandleImpl(); - final Key key =3D addCloseHandler(new HandleCloseHandler(handle= )); - handle.addCloseHandler(new KeyCloseHandler>(key)); - return handle; - } - - private final class HandleImpl extends AbstractHandleableCloseable> implements Handle { - - private HandleImpl() throws IOException { - super(AbstractAutoCloseable.this.executor); - inc(); - } - - protected void closeAction() throws IOException { - dec(); - } - - @SuppressWarnings({ "unchecked" }) - public T getResource() { - return (T) AbstractAutoCloseable.this; - } - - public String toString() { - return "handle <" + Integer.toHexString(hashCode()) + "> to " = + String.valueOf(AbstractAutoCloseable.this); - } - } - - private static class HandleCloseHandler implements CloseHandler { - - private final Closeable handle; - - public HandleCloseHandler(final Handle handle) { - this.handle =3D new WeakCloseable(new WeakReference= (handle)); - } - - public void handleClose(final T closed) { - IoUtils.safeClose(handle); - } - } - - private static class KeyCloseHandler implements CloseHandler { - private final Key key; - - public KeyCloseHandler(final Key key) { - this.key =3D key; - } - - public void handleClose(final T closed) { - key.remove(); - } - } - - public String toString() { - return "generic resource <" + Integer.toHexString(hashCode()) + ">= "; - } -} Deleted: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/s= pi/AutoCloseable.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Au= toCloseable.java 2009-04-30 22:58:40 UTC (rev 5100) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Au= toCloseable.java 2009-04-30 23:01:14 UTC (rev 5101) @@ -1,41 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2008, 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.remoting3.spi; - -import java.io.IOException; -import org.jboss.remoting3.HandleableCloseable; - -/** - * A closeable resource which closes automatically when the number of acti= ve handles reaches zero. Handles are considered - * active until they are closed. - */ -public interface AutoCloseable extends HandleableCloseable { - - /** - * Get a handle to this resource. When the number of open handles rea= ches zero, the resource will be closed. - * - * @return a handle - * @throws IOException if an error occurs, particularly if this resour= ce is already closed - */ - Handle getHandle() throws IOException; -} Deleted: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/s= pi/Handle.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Ha= ndle.java 2009-04-30 22:58:40 UTC (rev 5100) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Ha= ndle.java 2009-04-30 23:01:14 UTC (rev 5101) @@ -1,55 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2008, 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.remoting3.spi; - -import java.io.IOException; -import org.jboss.remoting3.CloseHandler; -import org.jboss.remoting3.HandleableCloseable; - -/** - * A handle to a reference-counted {@link org.jboss.remoting3.spi.AutoClos= eable AutoCloseable} resource. - */ -public interface Handle extends HandleableCloseable> { - - /** - * Get the resource. - * - * @return the resource - */ - T getResource(); - - /** - * Close this handle. If this is the last handle to be closed, also c= lose the resource (throwing any exception - * that may result). - * - * @throws IOException if the close failed - */ - void close() throws IOException; - - /** - * Add a handler that is invoked when this handle is closed. - * - * @param handler the handler - */ - Key addCloseHandler(final CloseHandler> handler); -} Modified: remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/= spi/CloseableTestCase.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/spi/Cl= oseableTestCase.java 2009-04-30 22:58:40 UTC (rev 5100) +++ remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/spi/Cl= oseableTestCase.java 2009-04-30 23:01:14 UTC (rev 5101) @@ -22,17 +22,15 @@ = package org.jboss.remoting3.spi; = -import junit.framework.TestCase; -import java.util.concurrent.Executors; -import java.util.concurrent.ExecutorService; import java.util.concurrent.CountDownLatch; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; -import java.util.concurrent.Executor; import java.util.concurrent.atomic.AtomicBoolean; +import junit.framework.TestCase; +import org.jboss.remoting3.CloseHandler; import org.jboss.xnio.IoUtils; import org.jboss.xnio.log.Logger; -import org.jboss.remoting3.CloseHandler; -import org.jboss.remoting3.HandleableCloseable; = /** * @@ -69,135 +67,4 @@ executorService.shutdownNow(); } } - - public void testAutoClose() throws Throwable { - final ExecutorService executorService =3D Executors.newCachedThrea= dPool(); - try { - final AtomicBoolean closed =3D new AtomicBoolean(); - final CountDownLatch latch =3D new CountDownLatch(1); - final AbstractAutoCloseable closeable =3D new AbstractAutoClos= eable(executorService) { - // empty - }; - final Handle rootHandle =3D closeable.getHandle(); - try { - closeable.addCloseHandler(new CloseHandler() { - public void handleClose(final Object x) { - closed.set(true); - latch.countDown(); - } - }); - assertTrue(closeable.isOpen()); - assertFalse(closed.get()); - rootHandle.close(); - assertTrue(latch.await(500L, TimeUnit.MILLISECONDS)); - assertFalse(closeable.isOpen()); - assertTrue(closed.get()); - } finally { - IoUtils.safeClose(closeable); - } - } finally { - executorService.shutdownNow(); - } - } - - public void testAutoCloseWithOneRef() throws Throwable { - final ExecutorService executorService =3D Executors.newCachedThrea= dPool(); - try { - final AtomicBoolean closed =3D new AtomicBoolean(); - final CountDownLatch latch =3D new CountDownLatch(1); - final AbstractAutoCloseable closeable =3D new AbstractAutoClos= eable(executorService) { - // empty - }; - final Handle rootHandle =3D closeable.getHandle(); - try { - closeable.addCloseHandler(new CloseHandler() { - public void handleClose(final Object x) { - closed.set(true); - latch.countDown(); - } - }); - assertTrue(closeable.isOpen()); - assertFalse(closed.get()); - final Handle h1 =3D closeable.getHandle(); - assertTrue(closeable.isOpen()); - assertFalse(closed.get()); - rootHandle.close(); - assertTrue(closeable.isOpen()); - assertFalse(closed.get()); - h1.close(); - assertTrue(latch.await(500L, TimeUnit.MILLISECONDS)); - assertFalse(closeable.isOpen()); - assertTrue(closed.get()); - } finally { - IoUtils.safeClose(closeable); - } - } finally { - executorService.shutdownNow(); - } - } - - public void testAutoCloseWithThreeRefs() throws Throwable { - final ExecutorService executorService =3D Executors.newCachedThrea= dPool(); - try { - final AtomicBoolean closed =3D new AtomicBoolean(); - final CountDownLatch latch =3D new CountDownLatch(1); - final AbstractAutoCloseable closeable =3D new AbstractAutoClos= eable(executorService) { - // empty - }; - final Handle rootHandle =3D closeable.getHandle(); - try { - closeable.addCloseHandler(new CloseHandler() { - public void handleClose(final Object x) { - closed.set(true); - latch.countDown(); - } - }); - assertTrue(closeable.isOpen()); - assertFalse(closed.get()); - final Handle h1 =3D closeable.getHandle(); - final Handle h2 =3D closeable.getHandle(); - final Handle h3 =3D closeable.getHandle(); - assertTrue(closeable.isOpen()); - assertFalse(closed.get()); - rootHandle.close(); - assertTrue(closeable.isOpen()); - assertFalse(closed.get()); - h1.close(); - assertTrue(closeable.isOpen()); - assertFalse(closed.get()); - h2.close(); - assertTrue(closeable.isOpen()); - assertFalse(closed.get()); - h3.close(); - assertTrue(latch.await(500L, TimeUnit.MILLISECONDS)); - assertFalse(closeable.isOpen()); - assertTrue(closed.get()); - } finally { - IoUtils.safeClose(closeable); - } - } finally { - executorService.shutdownNow(); - } - } - - public void testHandlerRemoval() throws Throwable { - final AtomicBoolean handlerCalled =3D new AtomicBoolean(); - final Executor executor =3D IoUtils.directExecutor(); - final AbstractAutoCloseable closeable =3D new AbstractAutoCloseabl= e(executor) { - // empty - }; - final Handle rootHandle =3D closeable.getHandle(); - try { - final HandleableCloseable.Key key =3D closeable.addCloseHandle= r(new CloseHandler() { - public void handleClose(final Object closed) { - handlerCalled.set(true); - } - }); - key.remove(); - rootHandle.close(); - assertFalse(handlerCalled.get()); - } finally { - IoUtils.safeClose(closeable); - } - } } --===============7613226663752550595==-- From jboss-remoting-commits at lists.jboss.org Thu Apr 30 19:13:26 2009 Content-Type: multipart/mixed; boundary="===============1889816073330776802==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5102 - remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi. Date: Thu, 30 Apr 2009 19:11:43 -0400 Message-ID: --===============1889816073330776802== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: david.lloyd(a)jboss.com Date: 2009-04-30 19:11:43 -0400 (Thu, 30 Apr 2009) New Revision: 5102 Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Con= nectionProviderFactory.java Log: javadocs Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/= spi/ConnectionProviderFactory.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Co= nnectionProviderFactory.java 2009-04-30 23:01:14 UTC (rev 5101) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Co= nnectionProviderFactory.java 2009-04-30 23:11:43 UTC (rev 5102) @@ -23,8 +23,15 @@ package org.jboss.remoting3.spi; = /** - * + * A connection provider factory. Implementations of this interface provi= de a connection facility for a URI scheme. */ public interface ConnectionProviderFactory { + + /** + * Create a provider instance for an endpoint. + * + * @param context the provider context + * @return the provider + */ ConnectionProvider createInstance(ConnectionProviderContext context); } --===============1889816073330776802==-- From jboss-remoting-commits at lists.jboss.org Thu Apr 30 19:22:10 2009 Content-Type: multipart/mixed; boundary="===============4296697543711928191==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5103 - remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi. Date: Thu, 30 Apr 2009 19:20:27 -0400 Message-ID: --===============4296697543711928191== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: david.lloyd(a)jboss.com Date: 2009-04-30 19:20:27 -0400 (Thu, 30 Apr 2009) New Revision: 5103 Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Con= nectionProvider.java Log: Unused method Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/= spi/ConnectionProvider.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Co= nnectionProvider.java 2009-04-30 23:11:43 UTC (rev 5102) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Co= nnectionProvider.java 2009-04-30 23:20:27 UTC (rev 5103) @@ -31,6 +31,4 @@ */ public interface ConnectionProvider { Cancellable connect(URI uri, Result result) = throws IllegalArgumentException; - - URI getConnectionUri(URI uri); } --===============4296697543711928191==-- From jboss-remoting-commits at lists.jboss.org Thu Apr 30 19:23:59 2009 Content-Type: multipart/mixed; boundary="===============1222970990529421850==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5104 - remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi. Date: Thu, 30 Apr 2009 19:22:16 -0400 Message-ID: --===============1222970990529421850== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: david.lloyd(a)jboss.com Date: 2009-04-30 19:22:16 -0400 (Thu, 30 Apr 2009) New Revision: 5104 Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Con= nectionProvider.java Log: Javadoc Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/= spi/ConnectionProvider.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Co= nnectionProvider.java 2009-04-30 23:20:27 UTC (rev 5103) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Co= nnectionProvider.java 2009-04-30 23:22:16 UTC (rev 5104) @@ -30,5 +30,15 @@ * @remoting.implement */ public interface ConnectionProvider { + + /** + * Open an outbound connection to the given URI. This method is expec= ted to be non-blocking, with the result + * stored in the result variable possibly asynchronously. + * + * @param uri the URI to connect to + * @param result the result which should receive the connection + * @return a handle which may be used to cancel the connect attempt + * @throws IllegalArgumentException if the URI is not valid + */ Cancellable connect(URI uri, Result result) = throws IllegalArgumentException; } --===============1222970990529421850==-- From jboss-remoting-commits at lists.jboss.org Thu Apr 30 19:46:55 2009 Content-Type: multipart/mixed; boundary="===============0075382440230240271==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5105 - remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi. Date: Thu, 30 Apr 2009 19:41:11 -0400 Message-ID: --===============0075382440230240271== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: david.lloyd(a)jboss.com Date: 2009-04-30 19:41:11 -0400 (Thu, 30 Apr 2009) New Revision: 5105 Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Con= nectionProviderContext.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Spi= Utils.java Log: More javadoc Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/= spi/ConnectionProviderContext.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Co= nnectionProviderContext.java 2009-04-30 23:22:16 UTC (rev 5104) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Co= nnectionProviderContext.java 2009-04-30 23:41:11 UTC (rev 5105) @@ -25,8 +25,16 @@ import org.jboss.remoting3.HandleableCloseable; = /** + * A context for a connection provider which provides a means to accept a = connection. * + * @remoting.consume */ public interface ConnectionProviderContext extends HandleableCloseable { + + /** + * Accept a connection that was received by the corresponding protocol= handler. + * + * @param connectionHandlerFactory the connection handler factory + */ void accept(ConnectionHandlerFactory connectionHandlerFactory); } Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/= spi/SpiUtils.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Sp= iUtils.java 2009-04-30 23:22:16 UTC (rev 5104) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/Sp= iUtils.java 2009-04-30 23:41:11 UTC (rev 5105) @@ -26,6 +26,7 @@ import org.jboss.remoting3.CloseHandler; import org.jboss.remoting3.RequestCancelHandler; import org.jboss.remoting3.RequestContext; +import org.jboss.xnio.IoFuture; import org.jboss.xnio.log.Logger; = /** @@ -110,6 +111,20 @@ } = /** + * Get a {@code Cancellable} for an {@code IoFuture}. + * + * @param future the future + * @return the cancellable + */ + public static Cancellable cancellable(final IoFuture future) { + return new Cancellable() { + public void cancel() { + future.cancel(); + } + }; + } + + /** * Get a remote request context that simply ignores a cancel request. * * @return a blank remote request context --===============0075382440230240271==--