JBoss Remoting SVN: r3516 - in remoting3/trunk: jrpp/src/main/java/org/jboss/cx/remoting/jrpp and 1 other directory.
by jboss-remoting-commits@lists.jboss.org
Author: david.lloyd(a)jboss.com
Date: 2008-02-26 09:49:26 -0500 (Tue, 26 Feb 2008)
New Revision: 3516
Modified:
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/CommonKeys.java
remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/JrppConnection.java
Log:
Start of JBREM-914 for someone to finish
Modified: remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/CommonKeys.java
===================================================================
--- remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/CommonKeys.java 2008-02-26 06:40:57 UTC (rev 3515)
+++ remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/CommonKeys.java 2008-02-26 14:49:26 UTC (rev 3516)
@@ -44,4 +44,13 @@
public static final AttributeKey<String> AUTHORIZATION_ID = key("AUTHORIZATION_ID");
// TODO: add keys for SSL/TLS
+
+ // Protocol keys
+
+ /**
+ * The keepalive interval. For protocols that are represented by a connection of some sort, this property indicates
+ * that a "keepalive" message should be sent at regular intervals to prevent an idle connection from being
+ * automatically closed by a firewall (for example).
+ */
+ public static final AttributeKey<Integer> KEEPALIVE_INTERVAL = key("KEEPALIVE_INTERVAL");
}
Modified: remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/JrppConnection.java
===================================================================
--- remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/JrppConnection.java 2008-02-26 06:40:57 UTC (rev 3515)
+++ remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/JrppConnection.java 2008-02-26 14:49:26 UTC (rev 3516)
@@ -666,6 +666,9 @@
state.requireTransition(State.AWAITING_CLIENT_AUTH_REQUEST);
return;
}
+ case PING: {
+ return;
+ }
default: break OUT;
}
}
@@ -704,6 +707,9 @@
state.transition(State.AWAITING_CLIENT_AUTH_REQUEST);
break; // fall thru to AWAITING_CLIENT_AUTH_REQUEST/AUTH_REQUEST
}
+ case PING: {
+ return;
+ }
default: break OUT;
}
}
@@ -743,6 +749,9 @@
}
return;
}
+ case PING: {
+ return;
+ }
default: break OUT;
}
}
@@ -759,6 +768,9 @@
state.requireTransition(State.AWAITING_SERVER_CHALLENGE);
return;
}
+ case PING: {
+ return;
+ }
default: break OUT;
}
}
@@ -800,6 +812,9 @@
sendAuthRequest();
return;
}
+ case PING: {
+ return;
+ }
default: break OUT;
}
}
@@ -873,6 +888,9 @@
protocolContext.receiveStreamData(streamIdentifier, input);
return;
}
+ case PING: {
+ return;
+ }
default: break OUT;
}
}
@@ -905,5 +923,6 @@
REQUEST,
SERVICE_TERMINATE,
STREAM_DATA,
+ PING,
}
}
16 years, 9 months
JBoss Remoting SVN: r3515 - remoting2/tags.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-02-26 01:40:57 -0500 (Tue, 26 Feb 2008)
New Revision: 3515
Added:
remoting2/tags/2.2.2-SP5/
Log:
Copied: remoting2/tags/2.2.2-SP5 (from rev 3514, remoting2/branches/2.2)
16 years, 9 months
JBoss Remoting SVN: r3514 - remoting2/branches/2.2/src/main/org/jboss/remoting/transport.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-02-26 01:35:40 -0500 (Tue, 26 Feb 2008)
New Revision: 3514
Modified:
remoting2/branches/2.2/src/main/org/jboss/remoting/transport/Connector.java
Log:
JBREM-910: init() calls ServerInvoker.create() before ServerInvoker.getMBeanObjectName().
Modified: remoting2/branches/2.2/src/main/org/jboss/remoting/transport/Connector.java
===================================================================
--- remoting2/branches/2.2/src/main/org/jboss/remoting/transport/Connector.java 2008-02-26 02:33:50 UTC (rev 3513)
+++ remoting2/branches/2.2/src/main/org/jboss/remoting/transport/Connector.java 2008-02-26 06:35:40 UTC (rev 3514)
@@ -394,29 +394,8 @@
{
// create the server invoker
invoker = InvokerRegistry.createServerInvoker(locator, configuration);
+ invoker.setMBeanServer(server);
- // this will set the mbean server on the invoker and register it with mbean server
- if (server != null)
- {
- try
- {
- ObjectName objName = new ObjectName(invoker.getMBeanObjectName());
- if (!server.isRegistered(objName))
- {
- server.registerMBean(invoker, objName);
- }
- else
- {
- log.warn(objName + " is already registered with MBeanServer");
- }
- invoker.setMBeanServer(server);
- }
- catch (Throwable e)
- {
- log.warn("Error registering invoker " + invoker + " with MBeanServer.", e);
- }
- }
-
// set the server socket factory if has been already set on the connector
invoker.setServerSocketFactory(svrSocketFactory);
// seting to null as don't want to keep reference in connector, but the server invoker
@@ -429,6 +408,27 @@
invoker.create();
}
+
+ // this will set the mbean server on the invoker and register it with mbean server
+ if (server != null)
+ {
+ try
+ {
+ ObjectName objName = new ObjectName(invoker.getMBeanObjectName());
+ if (!server.isRegistered(objName))
+ {
+ server.registerMBean(invoker, objName);
+ }
+ else
+ {
+ log.warn(objName + " is already registered with MBeanServer");
+ }
+ }
+ catch (Throwable e)
+ {
+ log.warn("Error registering invoker " + invoker + " with MBeanServer.", e);
+ }
+ }
// if using a generic locator (such as socket://localhost:0), the locator may change so
// keep the local cache in synch
16 years, 9 months
JBoss Remoting SVN: r3513 - remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/connector.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-02-25 21:33:50 -0500 (Mon, 25 Feb 2008)
New Revision: 3513
Added:
remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/connector/ObjectNameWithZeroesAddressTestCase.java
Log:
JBREM-910: New unit test.
Added: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/connector/ObjectNameWithZeroesAddressTestCase.java
===================================================================
--- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/connector/ObjectNameWithZeroesAddressTestCase.java (rev 0)
+++ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/connector/ObjectNameWithZeroesAddressTestCase.java 2008-02-26 02:33:50 UTC (rev 3513)
@@ -0,0 +1,175 @@
+/*
+* 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.connector;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import javax.management.MBeanServer;
+import javax.management.MBeanServerFactory;
+import javax.management.ObjectInstance;
+import javax.management.ObjectName;
+
+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.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;
+
+
+/**
+ * Unit test for JBREM-910.
+ *
+ * @author <a href="ron.sigal(a)jboss.com">Ron Sigal</a>
+ * @version $Revision: 1.1 $
+ * <p>
+ * Copyright Feb 25, 2008
+ * </p>
+ */
+public class ObjectNameWithZeroesAddressTestCase extends TestCase
+{
+ private static Logger log = Logger.getLogger(ObjectNameWithZeroesAddressTestCase.class);
+
+ private static boolean firstTime = true;
+
+ protected String host;
+ protected int port;
+ protected String locatorURI;
+ protected InvokerLocator serverLocator;
+ protected Connector connector;
+ protected TestInvocationHandler invocationHandler;
+ protected MBeanServer mbeanServer;
+
+
+ public void setUp() throws Exception
+ {
+ if (firstTime)
+ {
+ firstTime = false;
+ Logger.getLogger("org.jboss.remoting").setLevel(XLevel.INFO);
+ Logger.getLogger("org.jboss.test.remoting").setLevel(Level.INFO);
+ String pattern = "[%d{ABSOLUTE}] [%t] %5p (%F:%L) - %m%n";
+ PatternLayout layout = new PatternLayout(pattern);
+ ConsoleAppender consoleAppender = new ConsoleAppender(layout);
+ Logger.getRootLogger().addAppender(consoleAppender);
+ }
+ }
+
+
+ public void tearDown()
+ {
+ }
+
+
+ public void testMethod() throws Throwable
+ {
+ log.info("entering " + getName());
+
+ // Start server.
+ setupServer();
+
+ log.info("Updated locator: " + connector.getInvokerLocator());
+ ServerInvoker invoker = connector.getServerInvoker();
+ String name = invoker.getMBeanObjectName();
+ ObjectName objectName = new ObjectName(name);
+ log.info("objectName:" + objectName);
+ printMBeans();
+ assertTrue(mbeanServer.isRegistered(objectName));
+ shutdownServer();
+ printMBeans();
+ assertFalse(mbeanServer.isRegistered(objectName));
+
+ log.info(getName() + " PASSES");
+ }
+
+
+ protected void printMBeans()
+ {
+ log.info("MBean count: " + mbeanServer.getMBeanCount());
+ Set mbeans = mbeanServer.queryMBeans(null, null);
+ Iterator it = mbeans.iterator();
+ int i = 0;
+ while (it.hasNext())
+ {
+ ObjectInstance mbean = (ObjectInstance) it.next();
+ log.info("MBean " + i++ + ": " + mbean.getObjectName());
+ }
+ }
+
+
+ protected String getTransport()
+ {
+ return "socket";
+ }
+
+
+ protected void addExtraClientConfig(Map config) {}
+ protected void addExtraServerConfig(Map config) {}
+
+
+ protected void setupServer() throws Exception
+ {
+ locatorURI = getTransport() + "://0.0.0.0:5555";
+ serverLocator = new InvokerLocator(locatorURI);
+ log.info("Starting remoting server with locator uri of: " + locatorURI);
+ HashMap config = new HashMap();
+ config.put(InvokerLocator.FORCE_REMOTE, "true");
+ addExtraServerConfig(config);
+ mbeanServer = MBeanServerFactory.createMBeanServer();
+ connector = new Connector(serverLocator, config);
+ connector.preRegister(mbeanServer, new ObjectName("remoting:service=connector"));
+ connector.create();
+ invocationHandler = new TestInvocationHandler();
+ connector.addInvocationHandler("test", invocationHandler);
+ connector.start();
+ }
+
+
+ protected void shutdownServer() throws Exception
+ {
+ if (connector != null)
+ connector.stop();
+ }
+
+
+ static class TestInvocationHandler implements ServerInvocationHandler
+ {
+ public void addListener(InvokerCallbackHandler callbackHandler) {}
+ public Object invoke(final InvocationRequest invocation) throws Throwable
+ {
+ return invocation.getParameter();
+ }
+ public void removeListener(InvokerCallbackHandler callbackHandler) {}
+ public void setMBeanServer(MBeanServer server) {}
+ public void setInvoker(ServerInvoker invoker) {}
+ }
+}
\ No newline at end of file
16 years, 9 months
JBoss Remoting SVN: r3512 - in remoting3/trunk: api/src/main/java/org/jboss/cx/remoting/service and 2 other directories.
by jboss-remoting-commits@lists.jboss.org
Author: david.lloyd(a)jboss.com
Date: 2008-02-25 21:14:55 -0500 (Mon, 25 Feb 2008)
New Revision: 3512
Added:
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/CloseHandler.java
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/Closeable.java
Modified:
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/Context.java
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/ContextSource.java
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/Endpoint.java
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/Session.java
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/service/ServiceRequest.java
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/wrapper/ContextSourceWrapper.java
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/wrapper/ContextWrapper.java
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/wrapper/EndpointWrapper.java
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/wrapper/SessionWrapper.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreEndpoint.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreInboundService.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreOutboundContext.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreOutboundService.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreSession.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ServiceLocatorListener.java
Log:
Add close callback notifiers - needed for service locator system
Added: remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/CloseHandler.java
===================================================================
--- remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/CloseHandler.java (rev 0)
+++ remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/CloseHandler.java 2008-02-26 02:14:55 UTC (rev 3512)
@@ -0,0 +1,8 @@
+package org.jboss.cx.remoting;
+
+/**
+ *
+ */
+public interface CloseHandler<T> {
+ void handleClose(T closed);
+}
Added: remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/Closeable.java
===================================================================
--- remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/Closeable.java (rev 0)
+++ remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/Closeable.java 2008-02-26 02:14:55 UTC (rev 3512)
@@ -0,0 +1,10 @@
+package org.jboss.cx.remoting;
+
+/**
+ *
+ */
+public interface Closeable<T> extends java.io.Closeable {
+ void close() throws RemotingException;
+
+ void addCloseHandler(CloseHandler<T> handler);
+}
Modified: remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/Context.java
===================================================================
--- remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/Context.java 2008-02-26 02:01:05 UTC (rev 3511)
+++ remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/Context.java 2008-02-26 02:14:55 UTC (rev 3512)
@@ -1,13 +1,12 @@
package org.jboss.cx.remoting;
import java.util.concurrent.ConcurrentMap;
-import java.io.Closeable;
/**
* A communications context. The context may be associated with a security/authentication state and a transactional
* state, as well as other state maintained by the remote side.
*/
-public interface Context<I, O> extends Closeable {
+public interface Context<I, O> extends Closeable<Context<I, O>> {
void close() throws RemotingException;
Modified: remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/ContextSource.java
===================================================================
--- remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/ContextSource.java 2008-02-26 02:01:05 UTC (rev 3511)
+++ remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/ContextSource.java 2008-02-26 02:14:55 UTC (rev 3512)
@@ -3,7 +3,7 @@
/**
* A source for new Remoting contexts.
*/
-public interface ContextSource<I, O> {
+public interface ContextSource<I, O> extends Closeable<ContextSource<I, O>> {
/**
* Close the context source. New contexts may no longer be created after this
* method is called. Subsequent calls to this method have no additional effect.
Modified: remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/Endpoint.java
===================================================================
--- remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/Endpoint.java 2008-02-26 02:01:05 UTC (rev 3511)
+++ remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/Endpoint.java 2008-02-26 02:14:55 UTC (rev 3512)
@@ -9,7 +9,7 @@
/**
* A potential participant in a JBoss Remoting communications relationship.
*/
-public interface Endpoint {
+public interface Endpoint extends Closeable<Endpoint> {
/**
* Get the endpoint attribute map. This is a storage area for any data associated with this endpoint, including
* (but not limited to) connection and protocol information, and application information.
Modified: remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/Session.java
===================================================================
--- remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/Session.java 2008-02-26 02:01:05 UTC (rev 3511)
+++ remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/Session.java 2008-02-26 02:14:55 UTC (rev 3512)
@@ -1,7 +1,6 @@
package org.jboss.cx.remoting;
import java.util.concurrent.ConcurrentMap;
-import java.io.Closeable;
/**
* Represents a point-to-point relationship with another endpoint.
@@ -10,7 +9,7 @@
* <p/>
* A session may be shared safely among multiple threads.
*/
-public interface Session extends Closeable {
+public interface Session extends Closeable<Session> {
/**
* Close this session. Any associated connection(s) will be closed. Calling this method multiple times has no
* effect.
Modified: remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/service/ServiceRequest.java
===================================================================
--- remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/service/ServiceRequest.java 2008-02-26 02:01:05 UTC (rev 3511)
+++ remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/service/ServiceRequest.java 2008-02-26 02:14:55 UTC (rev 3512)
@@ -12,6 +12,7 @@
private URI uri;
private Class<I> requestType;
private Class<O> replyType;
+ private int ttl;
public ServiceRequest() {
}
@@ -47,4 +48,12 @@
public void setReplyType(final Class<O> replyType) {
this.replyType = replyType;
}
+
+ public int getTtl() {
+ return ttl;
+ }
+
+ public void setTtl(final int ttl) {
+ this.ttl = ttl;
+ }
}
Modified: remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/wrapper/ContextSourceWrapper.java
===================================================================
--- remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/wrapper/ContextSourceWrapper.java 2008-02-26 02:01:05 UTC (rev 3511)
+++ remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/wrapper/ContextSourceWrapper.java 2008-02-26 02:14:55 UTC (rev 3512)
@@ -3,6 +3,7 @@
import org.jboss.cx.remoting.Context;
import org.jboss.cx.remoting.ContextSource;
import org.jboss.cx.remoting.RemotingException;
+import org.jboss.cx.remoting.CloseHandler;
/**
*
@@ -18,6 +19,14 @@
delegate.close();
}
+ public void addCloseHandler(final CloseHandler<ContextSource<I, O>> closeHandler) {
+ delegate.addCloseHandler(new CloseHandler<ContextSource<I, O>>() {
+ public void handleClose(final ContextSource<I, O> closed) {
+ closeHandler.handleClose(ContextSourceWrapper.this);
+ }
+ });
+ }
+
public Context<I, O> createContext() throws RemotingException {
return delegate.createContext();
}
Modified: remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/wrapper/ContextWrapper.java
===================================================================
--- remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/wrapper/ContextWrapper.java 2008-02-26 02:01:05 UTC (rev 3511)
+++ remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/wrapper/ContextWrapper.java 2008-02-26 02:14:55 UTC (rev 3512)
@@ -5,6 +5,7 @@
import org.jboss.cx.remoting.FutureReply;
import org.jboss.cx.remoting.RemoteExecutionException;
import org.jboss.cx.remoting.RemotingException;
+import org.jboss.cx.remoting.CloseHandler;
/**
*
@@ -20,6 +21,14 @@
delegate.close();
}
+ public void addCloseHandler(final CloseHandler<Context<I, O>> closeHandler) {
+ delegate.addCloseHandler(new CloseHandler<Context<I, O>>() {
+ public void handleClose(final Context<I, O> closed) {
+ closeHandler.handleClose(ContextWrapper.this);
+ }
+ });
+ }
+
public O invoke(final I request) throws RemotingException, RemoteExecutionException, InterruptedException {
return delegate.invoke(request);
}
Modified: remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/wrapper/EndpointWrapper.java
===================================================================
--- remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/wrapper/EndpointWrapper.java 2008-02-26 02:01:05 UTC (rev 3511)
+++ remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/wrapper/EndpointWrapper.java 2008-02-26 02:14:55 UTC (rev 3512)
@@ -8,6 +8,7 @@
import org.jboss.cx.remoting.Context;
import org.jboss.cx.remoting.RequestListener;
import org.jboss.cx.remoting.ContextSource;
+import org.jboss.cx.remoting.CloseHandler;
import org.jboss.cx.remoting.util.AttributeMap;
import org.jboss.cx.remoting.spi.protocol.ProtocolRegistration;
import org.jboss.cx.remoting.spi.protocol.ProtocolRegistrationSpec;
@@ -45,4 +46,16 @@
public <I, O> ContextSource<I, O> createService(final RequestListener<I, O> requestListener) {
return delegate.createService(requestListener);
}
+
+ public void close() throws RemotingException {
+ delegate.close();
+ }
+
+ public void addCloseHandler(final CloseHandler<Endpoint> closeHandler) {
+ delegate.addCloseHandler(new CloseHandler<Endpoint>() {
+ public void handleClose(final Endpoint closed) {
+ closeHandler.handleClose(EndpointWrapper.this);
+ }
+ });
+ }
}
Modified: remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/wrapper/SessionWrapper.java
===================================================================
--- remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/wrapper/SessionWrapper.java 2008-02-26 02:01:05 UTC (rev 3511)
+++ remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/wrapper/SessionWrapper.java 2008-02-26 02:14:55 UTC (rev 3512)
@@ -4,6 +4,7 @@
import org.jboss.cx.remoting.RemotingException;
import org.jboss.cx.remoting.Session;
import org.jboss.cx.remoting.Context;
+import org.jboss.cx.remoting.CloseHandler;
/**
*
@@ -19,6 +20,14 @@
delegate.close();
}
+ public void addCloseHandler(final CloseHandler<Session> closeHandler) {
+ delegate.addCloseHandler(new CloseHandler<Session>() {
+ public void handleClose(final Session closed) {
+ closeHandler.handleClose(SessionWrapper.this);
+ }
+ });
+ }
+
public ConcurrentMap<Object, Object> getAttributes() {
return delegate.getAttributes();
}
Modified: remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreEndpoint.java
===================================================================
--- remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreEndpoint.java 2008-02-26 02:01:05 UTC (rev 3511)
+++ remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreEndpoint.java 2008-02-26 02:14:55 UTC (rev 3512)
@@ -14,6 +14,7 @@
import org.jboss.cx.remoting.Context;
import org.jboss.cx.remoting.RequestListener;
import org.jboss.cx.remoting.ContextSource;
+import org.jboss.cx.remoting.CloseHandler;
import org.jboss.cx.remoting.util.CollectionUtil;
import org.jboss.cx.remoting.version.Version;
import org.jboss.cx.remoting.log.Logger;
@@ -233,5 +234,12 @@
return null;
}
+ public void close() throws RemotingException {
+ // todo ...
+ }
+
+ public void addCloseHandler(final CloseHandler<Endpoint> closeHandler) {
+ // todo ...
+ }
}
}
Modified: remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreInboundService.java
===================================================================
--- remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreInboundService.java 2008-02-26 02:01:05 UTC (rev 3511)
+++ remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreInboundService.java 2008-02-26 02:14:55 UTC (rev 3512)
@@ -2,7 +2,6 @@
import org.jboss.cx.remoting.RemotingException;
import org.jboss.cx.remoting.RequestListener;
-import org.jboss.cx.remoting.log.Logger;
import org.jboss.cx.remoting.spi.protocol.ContextIdentifier;
import org.jboss.cx.remoting.spi.protocol.ServiceIdentifier;
@@ -10,8 +9,6 @@
*
*/
public final class CoreInboundService<I, O> {
- private static final Logger log = Logger.getLogger(CoreInboundService.class);
-
private final CoreSession coreSession;
private final ServiceIdentifier serviceIdentifier;
private final RequestListener<I, O> requestListener;
Modified: remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreOutboundContext.java
===================================================================
--- remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreOutboundContext.java 2008-02-26 02:01:05 UTC (rev 3511)
+++ remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreOutboundContext.java 2008-02-26 02:14:55 UTC (rev 3512)
@@ -7,6 +7,7 @@
import org.jboss.cx.remoting.RemoteExecutionException;
import org.jboss.cx.remoting.RemotingException;
import org.jboss.cx.remoting.RequestCompletionHandler;
+import org.jboss.cx.remoting.CloseHandler;
import org.jboss.cx.remoting.util.AtomicStateMachine;
import org.jboss.cx.remoting.util.CollectionUtil;
import org.jboss.cx.remoting.log.Logger;
@@ -132,6 +133,10 @@
receiveCloseContext();
}
+ public void addCloseHandler(final CloseHandler<Context<I, O>> closeHandler) {
+ // todo ...
+ }
+
public O invoke(final I request) throws RemotingException, RemoteExecutionException, InterruptedException {
state.requireHold(State.UP);
try {
Modified: remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreOutboundService.java
===================================================================
--- remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreOutboundService.java 2008-02-26 02:01:05 UTC (rev 3511)
+++ remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreOutboundService.java 2008-02-26 02:14:55 UTC (rev 3512)
@@ -3,6 +3,7 @@
import org.jboss.cx.remoting.Context;
import org.jboss.cx.remoting.ContextSource;
import org.jboss.cx.remoting.RemotingException;
+import org.jboss.cx.remoting.CloseHandler;
import org.jboss.cx.remoting.util.AtomicStateMachine;
import org.jboss.cx.remoting.log.Logger;
import org.jboss.cx.remoting.spi.protocol.ServiceIdentifier;
@@ -79,6 +80,10 @@
receiveServiceTerminate();
}
+ public void addCloseHandler(final CloseHandler<ContextSource<I, O>> closeHandler) {
+ // todo ...
+ }
+
public Context<I, O> createContext() throws RemotingException {
// Don't need waitForNotHold here since the state can't change again
final State currentState = state.waitForNot(State.WAITING_FOR_REPLY);
Modified: remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreSession.java
===================================================================
--- remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreSession.java 2008-02-26 02:01:05 UTC (rev 3511)
+++ remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreSession.java 2008-02-26 02:14:55 UTC (rev 3512)
@@ -19,6 +19,7 @@
import org.jboss.cx.remoting.RequestListener;
import org.jboss.cx.remoting.Session;
import org.jboss.cx.remoting.Context;
+import org.jboss.cx.remoting.CloseHandler;
import org.jboss.cx.remoting.core.stream.DefaultStreamDetector;
import org.jboss.cx.remoting.util.AtomicStateMachine;
import org.jboss.cx.remoting.util.AttributeMap;
@@ -375,6 +376,10 @@
}
}
+ public void addCloseHandler(final CloseHandler<Session> closeHandler) {
+ // todo ...
+ }
+
public ConcurrentMap<Object, Object> getAttributes() {
return sessionMap;
}
Modified: remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ServiceLocatorListener.java
===================================================================
--- remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ServiceLocatorListener.java 2008-02-26 02:01:05 UTC (rev 3511)
+++ remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ServiceLocatorListener.java 2008-02-26 02:14:55 UTC (rev 3512)
@@ -3,23 +3,41 @@
import org.jboss.cx.remoting.RequestListener;
import org.jboss.cx.remoting.RequestContext;
import org.jboss.cx.remoting.RemoteExecutionException;
+import org.jboss.cx.remoting.ContextSource;
+import org.jboss.cx.remoting.Context;
import org.jboss.cx.remoting.util.ServiceURI;
+import org.jboss.cx.remoting.util.CollectionUtil;
import org.jboss.cx.remoting.service.ServiceRequest;
import org.jboss.cx.remoting.service.ServiceReply;
import java.net.URI;
+import java.util.concurrent.ConcurrentMap;
/**
*
*/
public final class ServiceLocatorListener<I, O> implements RequestListener<ServiceRequest<I, O>, ServiceReply<I, O>> {
-
+ private interface Peer {
+ String getName();
+
+ int getCost();
+
+ <X, Y> Context<ServiceRequest<X, Y>, ServiceReply<X, Y>> getLocatorContext();
+ }
+
+ private static <K, V> ConcurrentMap<K, V> syncMap() {
+ return CollectionUtil.concurrentMap(CollectionUtil.<K, V>hashMap());
+ }
+
+ private final ConcurrentMap<String, ConcurrentMap<String, ContextSource<?, ?>>> deployments = syncMap();
+
public void handleRequest(final RequestContext<ServiceReply<I, O>> requestContext, final ServiceRequest<I, O> request) throws RemoteExecutionException, InterruptedException {
final URI uri = request.getUri();
final ServiceURI serviceURI = new ServiceURI(uri);
final String endpointName = serviceURI.getEndpointName();
final String groupName = serviceURI.getGroupName();
final String serviceType = serviceURI.getServiceType();
+
}
}
16 years, 9 months
JBoss Remoting SVN: r3511 - remoting2/branches/2.2/docs.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-02-25 21:01:05 -0500 (Mon, 25 Feb 2008)
New Revision: 3511
Modified:
remoting2/branches/2.2/docs/README.txt
Log:
JBREM-913: Added notes for 2.2.2.SP5 release.
Modified: remoting2/branches/2.2/docs/README.txt
===================================================================
--- remoting2/branches/2.2/docs/README.txt 2008-02-26 01:58:01 UTC (rev 3510)
+++ remoting2/branches/2.2/docs/README.txt 2008-02-26 02:01:05 UTC (rev 3511)
@@ -27,6 +27,21 @@
in Jira, please create one.
==========================================================================================================
+Release Notes - JBoss Remoting - Version 2.2.2.SP5
+Bug
+
+ * [JBREM-892] - CLONE -Client side connection exception is not thrown on the client side when the lease times out [JBREM-888]
+ * [JBREM-910] - CLONE -Connector.stop() cannot find invoker MBean when bind address is 0.0.0.0 [JBREM-909]
+
+Release
+
+ * [JBREM-913] - Release 2.2.2.SP5
+
+Task
+
+ * [JBREM-912] - Remove stacktrace when SSLSocketBuilder.createSSLSocketFactory() fails
+
+==========================================================================================================
Release Notes - JBoss Remoting - Version 2.2.2.SP4
** Bug
16 years, 9 months
JBoss Remoting SVN: r3510 - in remoting2/branches/2.2/src/etc/lib: remoting_2_2_2_SP4 and 1 other directory.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-02-25 20:58:01 -0500 (Mon, 25 Feb 2008)
New Revision: 3510
Added:
remoting2/branches/2.2/src/etc/lib/remoting_2_2_2_SP4/
remoting2/branches/2.2/src/etc/lib/remoting_2_2_2_SP4/jboss-remoting.jar
Log:
JBREM-913: Added jboss-remoting.jar from release 2.2.2.SP4.
Added: remoting2/branches/2.2/src/etc/lib/remoting_2_2_2_SP4/jboss-remoting.jar
===================================================================
(Binary files differ)
Property changes on: remoting2/branches/2.2/src/etc/lib/remoting_2_2_2_SP4/jboss-remoting.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
16 years, 9 months
JBoss Remoting SVN: r3509 - remoting2/branches/2.2.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-02-25 20:52:31 -0500 (Mon, 25 Feb 2008)
New Revision: 3509
Modified:
remoting2/branches/2.2/build.xml
Log:
JBREM-913: (1) Updated version; (2) Added version test for 2.2.2.SP4.
Modified: remoting2/branches/2.2/build.xml
===================================================================
--- remoting2/branches/2.2/build.xml 2008-02-26 01:40:01 UTC (rev 3508)
+++ remoting2/branches/2.2/build.xml 2008-02-26 01:52:31 UTC (rev 3509)
@@ -37,9 +37,9 @@
<!-- Module name(s) & version -->
<property name="module.name" value="remoting"/>
<property name="module.Name" value="JBoss Remoting"/>
- <property name="module.version" value="2.2.2.SP4"/>
+ <property name="module.version" value="2.2.2.SP5"/>
<!-- extension is for the file suffix to use for distribution build -->
- <property name="module.version.extension" value="2_2_2_SP4"/>
+ <property name="module.version.extension" value="2_2_2_SP5"/>
<property name="implementation.url" value="http://www.jboss.org/products/remoting"/>
<property name="root.dir" value="${basedir}"/>
@@ -959,6 +959,29 @@
<param name="client.classpath" value="${output.lib.dir}/jboss-remoting.jar"/>
<param name="server.classpath" value="${output.lib.dir}/jboss-remoting.jar"/>
</antcall>
+
+ <!-- ******************************************************************************** -->
+ <!-- Current <- -> 2.2.2.SP4 -->
+ <antcall target="tests.versioning.all_transports" inheritrefs="true">
+ <param name="jboss-junit-configuration" value="2_2_2_SP4-client"/>
+ <param name="client.classpath" value="${etc.dir}/lib/remoting_2_2_2_SP4/jboss-remoting.jar"/>
+ <param name="server.classpath" value="${output.lib.dir}/jboss-remoting.jar"/>
+ <param name="client.pre_2_0_compatible" value=""/>
+ <param name="server.pre_2_0_compatible" value=""/>
+ <param name="client.version" value=""/>
+ <param name="server.version" value="2"/>
+ <param name="check_connection" value="false"/>
+ </antcall>
+ <antcall target="tests.versioning.all_transports" inheritrefs="true">
+ <param name="jboss-junit-configuration" value="2_2_2_SP4-server"/>
+ <param name="server.classpath" value="${etc.dir}/lib/remoting_2_2_2_SP4/jboss-remoting.jar"/>
+ <param name="client.classpath" value="${output.lib.dir}/jboss-remoting.jar"/>
+ <param name="client.pre_2_0_compatible" value=""/>
+ <param name="server.pre_2_0_compatible" value=""/>
+ <param name="client.version" value="2"/>
+ <param name="server.version" value=""/>
+ <param name="check_connection" value="false"/>
+ </antcall>
<!-- ******************************************************************************** -->
<!-- Current <- -> 2.2.2.SP2 -->
16 years, 9 months
JBoss Remoting SVN: r3508 - remoting2/branches/2.2/src/tests/org/jboss/test/remoting/connection.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-02-25 20:40:01 -0500 (Mon, 25 Feb 2008)
New Revision: 3508
Added:
remoting2/branches/2.2/src/tests/org/jboss/test/remoting/connection/ConnectionValidatorTiedToLeaseTestCase.java
Log:
JBREM-892: New unit test.
Added: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/connection/ConnectionValidatorTiedToLeaseTestCase.java
===================================================================
--- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/connection/ConnectionValidatorTiedToLeaseTestCase.java (rev 0)
+++ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/connection/ConnectionValidatorTiedToLeaseTestCase.java 2008-02-26 01:40:01 UTC (rev 3508)
@@ -0,0 +1,588 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.remoting.connection;
+
+import java.lang.reflect.Field;
+import java.net.InetAddress;
+import java.util.HashMap;
+import java.util.Map;
+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.logging.XLevel;
+import org.jboss.remoting.Client;
+import org.jboss.remoting.ConnectionListener;
+import org.jboss.remoting.ConnectionValidator;
+import org.jboss.remoting.InvocationRequest;
+import org.jboss.remoting.InvokerLocator;
+import org.jboss.remoting.LeasePinger;
+import org.jboss.remoting.MicroRemoteClientInvoker;
+import org.jboss.remoting.ServerInvocationHandler;
+import org.jboss.remoting.ServerInvoker;
+import org.jboss.remoting.callback.InvokerCallbackHandler;
+import org.jboss.remoting.transport.ClientInvoker;
+import org.jboss.remoting.transport.Connector;
+import org.jboss.remoting.transport.PortUtil;
+
+
+/**
+ * Unit tests for JBREM-891.
+ *
+ * @author <a href="ron.sigal(a)jboss.com">Ron Sigal</a>
+ * @version $Revision: 1.1 $
+ * <p>
+ * Copyright Jan 19, 2008
+ * </p>
+ */
+public class ConnectionValidatorTiedToLeaseTestCase extends TestCase
+{
+ private static Logger log = Logger.getLogger(ConnectionValidatorTiedToLeaseTestCase.class);
+
+ private static boolean firstTime = true;
+
+ protected String host;
+ protected int port;
+ protected String locatorURI;
+ protected InvokerLocator serverLocator;
+ protected Connector connector;
+ protected TestInvocationHandler invocationHandler;
+ protected TestConnectionListener serverListener;
+
+
+ public void setUp() throws Exception
+ {
+ if (firstTime)
+ {
+ firstTime = false;
+ Logger.getLogger("org.jboss.remoting").setLevel(XLevel.INFO);
+ Logger.getLogger("org.jboss.test.remoting").setLevel(Level.INFO);
+ String pattern = "[%d{ABSOLUTE}] [%t] %5p (%F:%L) - %m%n";
+ PatternLayout layout = new PatternLayout(pattern);
+ ConsoleAppender consoleAppender = new ConsoleAppender(layout);
+ Logger.getRootLogger().addAppender(consoleAppender);
+ }
+ }
+
+
+ public void tearDown()
+ {
+ }
+
+
+ public void testTiedToLeaseDefaultConfigurationLocalInvoker() throws Throwable
+ {
+ log.info("entering " + getName());
+
+ // Start server.
+ setupServer(true);
+
+ // Create client.
+ InvokerLocator clientLocator = new InvokerLocator(locatorURI);
+ HashMap clientConfig = new HashMap();
+ clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
+ addExtraClientConfig(clientConfig);
+ Client client = new Client(clientLocator, clientConfig);
+ client.connect();
+ log.info("client is connected");
+
+ // Register client side listener.
+ Object lock = new Object();
+ TestConnectionListener clientListener = new TestConnectionListener(lock);
+ client.addConnectionListener(clientListener);
+ log.info("connection listener added on client side");
+
+ // Verify ConnectionValidator is running.
+ assertTrue(client.getPingPeriod() > -1);
+
+ // Test connections.
+ assertEquals("abc", client.invoke("abc"));
+ log.info("connection is good");
+
+ // Verify LeasePinger is running.
+ assertTrue(client.getInvoker() instanceof MicroRemoteClientInvoker);
+ ClientInvoker clientInvoker = client.getInvoker();
+ Field field = MicroRemoteClientInvoker.class.getDeclaredField("leasePinger");
+ field.setAccessible(true);
+ LeasePinger pinger = (LeasePinger) field.get(clientInvoker);
+ assertNotNull(pinger);
+ field = LeasePinger.class.getDeclaredField("timerTask");
+ field.setAccessible(true);
+ TimerTask timerTask = (TimerTask) field.get(pinger);
+ assertNotNull(timerTask);
+
+ // Shut down lease on server side.
+ connector.removeConnectionListener(serverListener);
+
+ // Wait for client side listener to be notified.
+ synchronized (lock)
+ {
+ lock.wait(30000);
+ }
+
+ // Verify ConnectionValidator has stopped.
+ Thread.sleep(4000);
+ assertTrue(clientListener.notified);
+ assertEquals(-1, client.getPingPeriod());
+
+ // Verfiy LeasePinger has stopped.
+ timerTask = (TimerTask) field.get(pinger);
+ assertNull(timerTask);
+
+ client.removeConnectionListener(clientListener);
+ client.disconnect();
+ shutdownServer();
+ log.info(getName() + " PASSES");
+ }
+
+
+ public void testTiedToLeaseDefaultConfigurationRemoteInvoker() throws Throwable
+ {
+ log.info("entering " + getName());
+
+ // Start server.
+ setupServer(true);
+
+ // Create client.
+ InvokerLocator clientLocator = new InvokerLocator(locatorURI);
+ HashMap clientConfig = new HashMap();
+ clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
+ addExtraClientConfig(clientConfig);
+ Client client = new Client(clientLocator, clientConfig);
+ client.connect();
+ log.info("client is connected");
+
+ // Register client side listener.
+ Object lock = new Object();
+ TestConnectionListener clientListener = new TestConnectionListener(lock);
+ Map metadata = new HashMap();
+ metadata.put(InvokerLocator.FORCE_REMOTE, "true");
+ client.addConnectionListener(clientListener, metadata);
+ log.info("connection listener added on client side");
+
+ // Verify ConnectionValidator is running.
+ assertTrue(client.getPingPeriod() > -1);
+
+ // Test connections.
+ assertEquals("abc", client.invoke("abc"));
+ log.info("connection is good");
+
+ // Verify LeasePinger is running.
+ assertTrue(client.getInvoker() instanceof MicroRemoteClientInvoker);
+ ClientInvoker clientInvoker = client.getInvoker();
+ Field field = MicroRemoteClientInvoker.class.getDeclaredField("leasePinger");
+ field.setAccessible(true);
+ LeasePinger pinger = (LeasePinger) field.get(clientInvoker);
+ assertNotNull(pinger);
+ field = LeasePinger.class.getDeclaredField("timerTask");
+ field.setAccessible(true);
+ TimerTask timerTask = (TimerTask) field.get(pinger);
+ assertNotNull(timerTask);
+
+ // Shut down lease on server side.
+ connector.removeConnectionListener(serverListener);
+
+ // Wait for client side listener to be notified.
+ synchronized (lock)
+ {
+ lock.wait(30000);
+ }
+
+ // Verify ConnectionValidator has stopped.
+ Thread.sleep(4000);
+ assertTrue(clientListener.notified);
+ assertEquals(-1, client.getPingPeriod());
+
+ // Verfiy LeasePinger has stopped.
+ timerTask = (TimerTask) field.get(pinger);
+ assertNull(timerTask);
+
+ client.removeConnectionListener(clientListener);
+ client.disconnect();
+ shutdownServer();
+ log.info(getName() + " PASSES");
+ }
+
+
+ public void testTiedToLeaseDontStopLease() throws Throwable
+ {
+ log.info("entering " + getName());
+
+ // Start server.
+ setupServer(true);
+
+ // Create client.
+ InvokerLocator clientLocator = new InvokerLocator(locatorURI);
+ HashMap clientConfig = new HashMap();
+ clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
+ addExtraClientConfig(clientConfig);
+ Client client = new Client(clientLocator, clientConfig);
+ client.connect();
+ log.info("client is connected");
+
+ // Register client side listener.
+ Object lock = new Object();
+ TestConnectionListener clientListener = new TestConnectionListener(lock);
+ Map metadata = new HashMap();
+ metadata.put(InvokerLocator.FORCE_REMOTE, "true");
+ metadata.put(ConnectionValidator.TIE_TO_LEASE, "true");
+ metadata.put(ConnectionValidator.STOP_LEASE_ON_FAILURE, "false");
+ client.addConnectionListener(clientListener, metadata);
+ log.info("connection listener added on client side");
+
+ // Verify ConnectionValidator is running.
+ assertTrue(client.getPingPeriod() > -1);
+
+ // Test connections.
+ assertEquals("abc", client.invoke("abc"));
+ log.info("connection is good");
+
+ // Verify LeasePinger is running.
+ assertTrue(client.getInvoker() instanceof MicroRemoteClientInvoker);
+ ClientInvoker clientInvoker = client.getInvoker();
+ Field field = MicroRemoteClientInvoker.class.getDeclaredField("leasePinger");
+ field.setAccessible(true);
+ LeasePinger pinger = (LeasePinger) field.get(clientInvoker);
+ assertNotNull(pinger);
+ field = LeasePinger.class.getDeclaredField("timerTask");
+ field.setAccessible(true);
+ TimerTask timerTask = (TimerTask) field.get(pinger);
+ assertNotNull(timerTask);
+
+ // Shut down lease on server side.
+ connector.removeConnectionListener(serverListener);
+
+ // Wait for client side listener to be notified.
+ synchronized (lock)
+ {
+ lock.wait(30000);
+ }
+
+ // Verify ConnectionValidator has stopped.
+ Thread.sleep(4000);
+ assertTrue(clientListener.notified);
+ assertEquals(-1, client.getPingPeriod());
+
+ // Verfiy LeasePinger has not stopped.
+ timerTask = (TimerTask) field.get(pinger);
+ assertNotNull(timerTask);
+
+ client.removeConnectionListener(clientListener);
+ client.disconnect();
+ shutdownServer();
+ log.info(getName() + " PASSES");
+ }
+
+
+ public void testNotTiedToLeaseDontStopLease() throws Throwable
+ {
+ log.info("entering " + getName());
+
+ // Start server.
+ setupServer(true);
+
+ // Create client.
+ InvokerLocator clientLocator = new InvokerLocator(locatorURI);
+ HashMap clientConfig = new HashMap();
+ clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
+ addExtraClientConfig(clientConfig);
+ Client client = new Client(clientLocator, clientConfig);
+ client.connect();
+ log.info("client is connected");
+
+ // Register client side listener.
+ Object lock = new Object();
+ TestConnectionListener clientListener = new TestConnectionListener(lock);
+ Map metadata = new HashMap();
+ metadata.put(InvokerLocator.FORCE_REMOTE, "true");
+ metadata.put(ConnectionValidator.TIE_TO_LEASE, "false");
+ metadata.put(ConnectionValidator.STOP_LEASE_ON_FAILURE, "false");
+ client.addConnectionListener(clientListener, metadata);
+ log.info("connection listener added on client side");
+
+ // Verify ConnectionValidator is running.
+ assertTrue(client.getPingPeriod() > -1);
+
+ // Test connections.
+ assertEquals("abc", client.invoke("abc"));
+ log.info("connection is good");
+
+ // Verify LeasePinger is running.
+ assertTrue(client.getInvoker() instanceof MicroRemoteClientInvoker);
+ ClientInvoker clientInvoker = client.getInvoker();
+ Field field = MicroRemoteClientInvoker.class.getDeclaredField("leasePinger");
+ field.setAccessible(true);
+ LeasePinger pinger = (LeasePinger) field.get(clientInvoker);
+ assertNotNull(pinger);
+ field = LeasePinger.class.getDeclaredField("timerTask");
+ field.setAccessible(true);
+ TimerTask timerTask = (TimerTask) field.get(pinger);
+ assertNotNull(timerTask);
+
+ // Shut down lease on server side.
+ connector.removeConnectionListener(serverListener);
+
+ // Wait for client side listener to be notified.
+ synchronized (lock)
+ {
+ lock.wait(30000);
+ }
+
+ // Verify ConnectionValidator has not stopped.
+ Thread.sleep(4000);
+ assertFalse(clientListener.notified);
+ assertTrue(client.getPingPeriod() > -1);
+
+ // Verfiy LeasePinger has not stopped.
+ timerTask = (TimerTask) field.get(pinger);
+ assertNotNull(timerTask);
+
+ client.removeConnectionListener(clientListener);
+ client.disconnect();
+ shutdownServer();
+ log.info(getName() + " PASSES");
+ }
+
+
+ public void testNotTiedToLeaseStopLease() throws Throwable
+ {
+ log.info("entering " + getName());
+
+ // Start server.
+ setupServer(true);
+
+ // Create client.
+ InvokerLocator clientLocator = new InvokerLocator(locatorURI);
+ HashMap clientConfig = new HashMap();
+ clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
+ addExtraClientConfig(clientConfig);
+ Client client = new Client(clientLocator, clientConfig);
+ client.connect();
+ log.info("client is connected");
+
+ // Register client side listener.
+ Object lock = new Object();
+ TestConnectionListener clientListener = new TestConnectionListener(lock);
+ Map metadata = new HashMap();
+ metadata.put(InvokerLocator.FORCE_REMOTE, "true");
+ metadata.put(ConnectionValidator.TIE_TO_LEASE, "false");
+ metadata.put(ConnectionValidator.STOP_LEASE_ON_FAILURE, "true");
+ client.addConnectionListener(clientListener, metadata);
+ log.info("connection listener added on client side");
+
+ // Verify ConnectionValidator is running.
+ assertTrue(client.getPingPeriod() > -1);
+
+ // Test connections.
+ assertEquals("abc", client.invoke("abc"));
+ log.info("connection is good");
+
+ // Verify LeasePinger is running.
+ assertTrue(client.getInvoker() instanceof MicroRemoteClientInvoker);
+ ClientInvoker clientInvoker = client.getInvoker();
+ Field field = MicroRemoteClientInvoker.class.getDeclaredField("leasePinger");
+ field.setAccessible(true);
+ LeasePinger pinger = (LeasePinger) field.get(clientInvoker);
+ assertNotNull(pinger);
+ field = LeasePinger.class.getDeclaredField("timerTask");
+ field.setAccessible(true);
+ TimerTask timerTask = (TimerTask) field.get(pinger);
+ assertNotNull(timerTask);
+
+ // Prevent server from responding to ConnectionValidator pings.
+ ServerInvoker serverInvoker = connector.getServerInvoker();
+ field = ServerInvoker.class.getDeclaredField("started");
+ field.setAccessible(true);
+ field.set(serverInvoker, new Boolean(false));
+ assertFalse(field.getBoolean(serverInvoker));
+ log.info("Stopped server invoker");
+
+ // Wait for client side listener to be notified.
+ synchronized (lock)
+ {
+ lock.wait(30000);
+ }
+
+ // Verify ConnectionValidator has stopped.
+ Thread.sleep(4000);
+ assertTrue(clientListener.notified);
+ assertEquals(-1, client.getPingPeriod());
+
+ // Verfiy LeasePinger has stopped.
+ field = LeasePinger.class.getDeclaredField("timerTask");
+ field.setAccessible(true);
+ timerTask = (TimerTask) field.get(pinger);
+ assertNull(timerTask);
+
+ client.removeConnectionListener(clientListener);
+ client.disconnect();
+ shutdownServer();
+ log.info(getName() + " PASSES");
+ }
+
+
+ public void testTiedToLeaseServerLeasingTurnedOff() throws Throwable
+ {
+ log.info("entering " + getName());
+
+ // Start server.
+ setupServer(false);
+
+ // Create client.
+ InvokerLocator clientLocator = new InvokerLocator(locatorURI);
+ HashMap clientConfig = new HashMap();
+ clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
+ addExtraClientConfig(clientConfig);
+ Client client = new Client(clientLocator, clientConfig);
+ client.connect();
+ log.info("client is connected");
+
+ // Register client side listener.
+ Object lock = new Object();
+ TestConnectionListener clientListener = new TestConnectionListener(lock);
+ Map metadata = new HashMap();
+ metadata.put(InvokerLocator.FORCE_REMOTE, "true");
+ client.addConnectionListener(clientListener, metadata);
+ log.info("connection listener added on client side");
+
+ // Verify ConnectionValidator is running.
+ assertTrue(client.getPingPeriod() > -1);
+
+ // Test connections.
+ assertEquals("abc", client.invoke("abc"));
+ log.info("connection is good");
+
+ // Wait for client side listener to be notified.
+ synchronized (lock)
+ {
+ lock.wait(30000);
+ }
+
+ // Verify ConnectionValidator has not stopped.
+ Thread.sleep(4000);
+ assertFalse(clientListener.notified);
+ assertTrue(client.getPingPeriod() > -1);
+
+ client.removeConnectionListener(clientListener);
+ 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 startLeasing) throws Exception
+ {
+ host = InetAddress.getLocalHost().getHostAddress();
+ port = PortUtil.findFreePort(host);
+ locatorURI = getTransport() + "://" + host + ":" + port;
+ locatorURI += "/?" + InvokerLocator.CLIENT_LEASE + "=true";
+ locatorURI += "&" + InvokerLocator.CLIENT_LEASE_PERIOD + "=4000";
+ serverLocator = new InvokerLocator(locatorURI);
+ log.info("Starting remoting server with locator uri of: " + locatorURI);
+ HashMap config = new HashMap();
+ config.put(InvokerLocator.FORCE_REMOTE, "true");
+ config.put(ServerInvoker.CLIENT_LEASE_PERIOD, "4000");
+ addExtraServerConfig(config);
+ connector = new Connector(serverLocator, config);
+ connector.create();
+ invocationHandler = new TestInvocationHandler();
+ connector.addInvocationHandler("test", invocationHandler);
+ if (startLeasing)
+ {
+ serverListener = new TestConnectionListener();
+ connector.addConnectionListener(serverListener);
+ }
+ connector.start();
+ }
+
+
+ protected void shutdownServer() throws Exception
+ {
+ if (connector != null)
+ {
+ connector.removeConnectionListener(serverListener);
+ connector.stop();
+ }
+ }
+
+
+ static class TestInvocationHandler implements ServerInvocationHandler
+ {
+ public void addListener(InvokerCallbackHandler callbackHandler) {}
+ public Object invoke(final InvocationRequest invocation) throws Throwable
+ {
+ return invocation.getParameter();
+ }
+ public void removeListener(InvokerCallbackHandler callbackHandler) {}
+ public void setMBeanServer(MBeanServer server) {}
+ public void setInvoker(ServerInvoker invoker) {}
+ }
+
+
+ static class TestConnectionListener implements ConnectionListener
+ {
+ public boolean notified;
+ private Object lock;
+
+ TestConnectionListener()
+ {
+ this(new Object());
+ }
+ TestConnectionListener(Object lock)
+ {
+ this.lock = lock;
+ }
+ public void handleConnectionException(Throwable throwable, Client client)
+ {
+ notified = true;
+ synchronized (lock)
+ {
+ try
+ {
+ // Give listener a chance to wait on lock.
+ Thread.sleep(4000);
+ }
+ catch (InterruptedException e)
+ {
+ log.info("Unexpected interrupt in TestConnectionListener");
+ }
+ lock.notifyAll();
+ }
+ }
+ }
+}
\ No newline at end of file
16 years, 9 months
JBoss Remoting SVN: r3507 - in remoting2/branches/2.2/src/main/org/jboss/remoting/transport: sslbisocket and 1 other directories.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-02-25 20:38:29 -0500 (Mon, 25 Feb 2008)
New Revision: 3507
Modified:
remoting2/branches/2.2/src/main/org/jboss/remoting/transport/http/ssl/HTTPSClientInvoker.java
remoting2/branches/2.2/src/main/org/jboss/remoting/transport/sslbisocket/SSLBisocketClientInvoker.java
remoting2/branches/2.2/src/main/org/jboss/remoting/transport/sslbisocket/SSLBisocketServerInvoker.java
remoting2/branches/2.2/src/main/org/jboss/remoting/transport/sslsocket/SSLSocketClientInvoker.java
Log:
JBREM-912: Logs stack trace at DEBUG level.
Modified: remoting2/branches/2.2/src/main/org/jboss/remoting/transport/http/ssl/HTTPSClientInvoker.java
===================================================================
--- remoting2/branches/2.2/src/main/org/jboss/remoting/transport/http/ssl/HTTPSClientInvoker.java 2008-02-26 01:37:17 UTC (rev 3506)
+++ remoting2/branches/2.2/src/main/org/jboss/remoting/transport/http/ssl/HTTPSClientInvoker.java 2008-02-26 01:38:29 UTC (rev 3507)
@@ -141,7 +141,9 @@
}
catch (Exception e)
{
- log.error("Error creating SSL Socket Factory for client invoker.", e);
+ log.error("Error creating SSL Socket Factory for client invoker: " + e.getMessage());
+ log.debug("Error creating SSL Socket Factory for client invoker.", e);
+
}
if (wrapper != null)
Modified: remoting2/branches/2.2/src/main/org/jboss/remoting/transport/sslbisocket/SSLBisocketClientInvoker.java
===================================================================
--- remoting2/branches/2.2/src/main/org/jboss/remoting/transport/sslbisocket/SSLBisocketClientInvoker.java 2008-02-26 01:37:17 UTC (rev 3506)
+++ remoting2/branches/2.2/src/main/org/jboss/remoting/transport/sslbisocket/SSLBisocketClientInvoker.java 2008-02-26 01:38:29 UTC (rev 3507)
@@ -91,7 +91,8 @@
}
catch (Exception e)
{
- log.error("Error creating SSL Socket Factory for client invoker.", e);
+ log.error("Error creating SSL Socket Factory for client invoker: " + e.getMessage());
+ log.debug("Error creating SSL Socket Factory for client invoker.", e);
}
if (wrapper != null)
Modified: remoting2/branches/2.2/src/main/org/jboss/remoting/transport/sslbisocket/SSLBisocketServerInvoker.java
===================================================================
--- remoting2/branches/2.2/src/main/org/jboss/remoting/transport/sslbisocket/SSLBisocketServerInvoker.java 2008-02-26 01:37:17 UTC (rev 3506)
+++ remoting2/branches/2.2/src/main/org/jboss/remoting/transport/sslbisocket/SSLBisocketServerInvoker.java 2008-02-26 01:38:29 UTC (rev 3507)
@@ -96,7 +96,8 @@
}
catch (Exception e)
{
- log.error("Error creating SSL Socket Factory for client invoker.", e);
+ log.error("Error creating SSL Socket Factory for client invoker: " + e.getMessage());
+ log.debug("Error creating SSL Socket Factory for client invoker.", e);
}
if (wrapper != null)
Modified: remoting2/branches/2.2/src/main/org/jboss/remoting/transport/sslsocket/SSLSocketClientInvoker.java
===================================================================
--- remoting2/branches/2.2/src/main/org/jboss/remoting/transport/sslsocket/SSLSocketClientInvoker.java 2008-02-26 01:37:17 UTC (rev 3506)
+++ remoting2/branches/2.2/src/main/org/jboss/remoting/transport/sslsocket/SSLSocketClientInvoker.java 2008-02-26 01:38:29 UTC (rev 3507)
@@ -92,7 +92,8 @@
}
catch (Exception e)
{
- log.error("Error creating SSL Socket Factory for client invoker.", e);
+ log.error("Error creating SSL Socket Factory for client invoker: " + e.getMessage());
+ log.debug("Error creating SSL Socket Factory for client invoker.", e);
}
if (wrapper != null)
16 years, 9 months