You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by ch...@apache.org on 2003/11/16 06:26:32 UTC
cvs commit: incubator-geronimo/modules/core/src/java/org/apache/geronimo/remoting/transport/async AbstractServer.java AsyncClient.java AsyncMsg.java BackChannelServer.java Channel.java ChannelListner.java ChannelPool.java Compression.java Correlator.java
chirino 2003/11/15 21:26:32
Modified: modules/core maven.xml
modules/core/src/deploy mx4j-service.xml
modules/core/src/java/org/apache/geronimo/enterprise/deploy/server
JmxServerConnection.java
modules/core/src/java/org/apache/geronimo/proxy
ProxyContainer.java ProxyInvocation.java
Added: modules/core/src/java/org/apache/geronimo/enterprise/deploy/server
RemoteMBeanServerFactory.java
modules/core/src/java/org/apache/geronimo/proxy
DelegatingInterceptor.java MarshalledMethod.java
Removed: modules/core/src/deploy remoting-service.xml
modules/core/src/java/org/apache/geronimo/remoting
DeMarshalingInterceptor.java
InterVMRoutingInterceptor.java
InterceptorRegistry.java
IntraVMRoutingInterceptor.java
InvocationSupport.java InvocationType.java
MarshalingInterceptor.java MarshalledMethod.java
MarshalledObject.java TransportInterceptor.java
modules/core/src/java/org/apache/geronimo/remoting/jmx
MBeanServerStub.java RemoteMBeanServerFactory.java
modules/core/src/java/org/apache/geronimo/remoting/router
AbstractInterceptorRouter.java
AbstractRouterRouter.java
InterceptorRegistryRouter.java JMXRouter.java
JMXTarget.java Router.java RouterTarget.java
SimpleInterceptorRegistryRouter.java
SubsystemRouter.java
modules/core/src/java/org/apache/geronimo/remoting/transport
BytesMarshalledObject.java BytesMsg.java
ConnectionFailedException.java Msg.java
NullTransportInterceptor.java
RemoteTransportInterceptor.java
StreamCorruptedException.java TransportClient.java
TransportException.java TransportFactory.java
TransportLoader.java TransportServer.java
URISupport.java
modules/core/src/java/org/apache/geronimo/remoting/transport/async
AbstractServer.java AsyncClient.java AsyncMsg.java
BackChannelServer.java Channel.java
ChannelListner.java ChannelPool.java
Compression.java Correlator.java
Log:
Moved all the remoting related modules into it's own sub project.
Revision Changes Path
1.22 +1 -15 incubator-geronimo/modules/core/maven.xml
Index: maven.xml
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/core/maven.xml,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- maven.xml 8 Nov 2003 06:10:08 -0000 1.21
+++ maven.xml 16 Nov 2003 05:26:32 -0000 1.22
@@ -53,20 +53,6 @@
<j:jelly xmlns="jelly:ant">
<!-- Create the directory where the test databases will reside -->
<mkdir dir="${maven.build.dir}/database"/>
-
- <!-- Compile the code for the Marshalling/Remoting tests -->
- <mkdir dir="${maven.build.dir}/mock-app"/>
- <javac
- destdir="${maven.build.dir}/mock-app"
- debug="${maven.compile.debug}"
- deprecation="${maven.compile.deprecation}"
- optimize="${maven.compile.optimize}">
- <src>
- <path>
- <pathelement location="${maven.src.dir}/test-data/mock-app"/>
- </path>
- </src>
- </javac>
</j:jelly>
</postGoal>
1.2 +1 -3 incubator-geronimo/modules/core/src/deploy/mx4j-service.xml
Index: mx4j-service.xml
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/core/src/deploy/mx4j-service.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- mx4j-service.xml 11 Nov 2003 01:50:00 -0000 1.1
+++ mx4j-service.xml 16 Nov 2003 05:26:32 -0000 1.2
@@ -4,14 +4,12 @@
<!-- RMI adaptor to support MX4J -->
<!-- Commented out for now since it is not working right now -->
- <!--
<mbean code="mx4j.tools.naming.NamingService"
name="Naming:type=rmiregistry">
</mbean>
- <mbean code="mx4j.adaptor.rmi.jrmp.JRMPAdaptor"
+ <mbean code="mx4j.tools.adaptor.rmi.jrmp.JRMPAdaptor"
name="Adaptor:protocol=JRMP">
<attribute name="JNDIName">jrmp</attribute>
</mbean>
- -->
</components>
1.3 +1 -2 incubator-geronimo/modules/core/src/java/org/apache/geronimo/enterprise/deploy/server/JmxServerConnection.java
Index: JmxServerConnection.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/enterprise/deploy/server/JmxServerConnection.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- JmxServerConnection.java 19 Oct 2003 01:56:14 -0000 1.2
+++ JmxServerConnection.java 16 Nov 2003 05:26:32 -0000 1.3
@@ -16,7 +16,6 @@
import javax.enterprise.deploy.shared.ModuleType;
import javax.management.MBeanServer;
import javax.management.ObjectName;
-import org.apache.geronimo.remoting.jmx.RemoteMBeanServerFactory;
import org.apache.geronimo.kernel.jmx.JMXUtil;
/**
1.1 incubator-geronimo/modules/core/src/java/org/apache/geronimo/enterprise/deploy/server/RemoteMBeanServerFactory.java
Index: RemoteMBeanServerFactory.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Geronimo" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* "Apache Geronimo", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* ====================================================================
*/
package org.apache.geronimo.enterprise.deploy.server;
import javax.management.MBeanServer;
/**
* @version $Revision: 1.1 $ $Date: 2003/11/16 05:26:32 $
*/
abstract public class RemoteMBeanServerFactory {
private static RemoteMBeanServerFactory instance = createRemoteMBeanServerFactory();
/**
* @param hostname
* @return
*/
public static MBeanServer create(String hostname) {
return instance.factoryCreate(hostname);
}
/**
* @param hostname
*/
abstract protected MBeanServer factoryCreate(String hostname);
/**
* @return
*/
private static RemoteMBeanServerFactory createRemoteMBeanServerFactory() {
try {
// Get the factory name via sys prop...
// In case we EVER used a different factory than: org.apache.geronimo.remoting.jmx.RemoteMBeanServerFactory
String factoryClass = System.getProperty("org.apache.geronimo.enterprise.deploy.server.RemoteMBeanServerFactory", "org.apache.geronimo.remoting.jmx.RemoteMBeanServerFactory");
return (RemoteMBeanServerFactory) RemoteMBeanServerFactory.class.getClassLoader().loadClass(factoryClass).newInstance();
} catch (Throwable e) {
throw new RuntimeException("The RemoteMBeanServerFactory instance could not be loaded:", e);
}
}
}
1.6 +5 -11 incubator-geronimo/modules/core/src/java/org/apache/geronimo/proxy/ProxyContainer.java
Index: ProxyContainer.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/proxy/ProxyContainer.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ProxyContainer.java 11 Nov 2003 21:53:27 -0000 1.5
+++ ProxyContainer.java 16 Nov 2003 05:26:32 -0000 1.6
@@ -82,16 +82,10 @@
ProxyInvocation.putMethod(invocation, method);
ProxyInvocation.putArguments(invocation, args);
ProxyInvocation.putProxy(invocation, proxy);
- try {
- InvocationResult result = this.invoke(invocation);
- return result.getResult();
- } catch(UndeclaredThrowableException e) {
- throw e.getCause(); // It's useless to know we got an undeclared throwable, we need the real thing!
- }
- }
-
- public Object createProxy(Class likeClass) {
- return createProxy(likeClass.getClassLoader(), likeClass.getInterfaces());
+ InvocationResult result = this.invoke(invocation);
+ if( result.isException() )
+ throw result.getException();
+ return result.getResult();
}
public Object createProxy(ClassLoader cl, Class[] interfaces) {
1.4 +1 -2 incubator-geronimo/modules/core/src/java/org/apache/geronimo/proxy/ProxyInvocation.java
Index: ProxyInvocation.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/proxy/ProxyInvocation.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ProxyInvocation.java 8 Sep 2003 04:31:39 -0000 1.3
+++ ProxyInvocation.java 16 Nov 2003 05:26:32 -0000 1.4
@@ -62,7 +62,6 @@
import org.apache.geronimo.core.service.Invocation;
import org.apache.geronimo.core.service.SimpleInvocation;
-import org.apache.geronimo.remoting.*;
/**
* @version $Revision$ $Date$
1.1 incubator-geronimo/modules/core/src/java/org/apache/geronimo/proxy/DelegatingInterceptor.java
Index: DelegatingInterceptor.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Geronimo" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* "Apache Geronimo", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* ====================================================================
*/
package org.apache.geronimo.proxy;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.HashSet;
import java.util.Set;
import org.apache.geronimo.core.service.AbstractInterceptor;
import org.apache.geronimo.core.service.Invocation;
import org.apache.geronimo.core.service.InvocationResult;
import org.apache.geronimo.core.service.SimpleInvocationResult;
import org.apache.geronimo.core.service.StackThreadLocal;
/**
* @version $Revision: 1.1 $ $Date: 2003/11/16 05:26:32 $
*/
final public class DelegatingInterceptor extends AbstractInterceptor {
Object target;
Set methods = new HashSet();
public class Context {
Invocation invocation;
public Invocation getInvocation() {
return invocation;
}
public DelegatingInterceptor getDelegatingInterceptor() {
return DelegatingInterceptor.this;
}
public Context(Invocation invocation) {
this.invocation = invocation;
}
/**
*
*/
public Object invokeNext() throws InvocationTargetException {
InvocationResult result;
try {
result = getNext().invoke(invocation);
} catch (Throwable e) {
throw new RuntimeException(e);
}
if( result.isNormal() )
return result.getResult();
else
throw new InvocationTargetException(result.getException());
}
}
private static StackThreadLocal contextThreadLocal = new StackThreadLocal();
static public Context getContext() {
return (Context) contextThreadLocal.peek();
}
public DelegatingInterceptor(Object target) {
this.target = target;
Method[] m = target.getClass().getDeclaredMethods();
for (int i = 0; i < m.length; i++) {
methods.add(MarshalledMethod.getSignature(m[i]));
}
}
/* (non-Javadoc)
* @see org.apache.geronimo.core.service.AbstractInterceptor#invoke(org.apache.geronimo.core.service.Invocation)
*/
public InvocationResult invoke(Invocation invocation) throws Throwable {
Method method = ProxyInvocation.getMethod(invocation);
if (!methods.contains(MarshalledMethod.getSignature(method)))
return getNext().invoke(invocation);
Object args[] = ProxyInvocation.getArguments(invocation);
Method m = target.getClass().getMethod(method.getName(), method.getParameterTypes());
try {
contextThreadLocal.push(new Context(invocation));
Object rc = m.invoke(target, args);
return new SimpleInvocationResult(rc);
} catch (InvocationTargetException e) {
Throwable t = e.getCause();
if (t instanceof Exception && t instanceof RuntimeException == false) {
return new SimpleInvocationResult((Exception) t);
} else {
throw t;
}
} finally {
contextThreadLocal.pop();
}
}
}
1.1 incubator-geronimo/modules/core/src/java/org/apache/geronimo/proxy/MarshalledMethod.java
Index: MarshalledMethod.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Geronimo" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* "Apache Geronimo", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* ====================================================================
*/
package org.apache.geronimo.proxy;
import java.io.Serializable;
import java.lang.reflect.Method;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.WeakHashMap;
import org.apache.geronimo.common.Classes;
/**
* @version $Revision: 1.1 $ $Date: 2003/11/16 05:26:32 $
*/
public class MarshalledMethod implements Serializable {
String declaringClass;
String signature;
/**
*
*/
public MarshalledMethod() {
}
/**
* @param method
*/
public MarshalledMethod(Method method) {
declaringClass = method.getDeclaringClass().getName();
signature = getSignature( method );
}
/**
* @param method
* @return
*/
static public String getSignature(Method method) {
StringBuffer sb = new StringBuffer();
sb.append(method.getName());
sb.append(' ');
Class[] args = method.getParameterTypes();
for (int i = 0; i < args.length; i++) {
sb.append(' ');
sb.append( Classes.getClassName(args[i]) );
}
return sb.toString();
}
/**
* @return
*/
public Method getMethod() throws ClassNotFoundException {
Class c = Thread.currentThread().getContextClassLoader().loadClass(declaringClass);
Map sigs = getCachedSignatureMap(c);
return (Method) sigs.get(signature);
}
/**
* TODO: try to cache the results.
* @param clazz
* @return
*/
static private Map getSignatureMapFor(Class clazz) {
Map rc = new HashMap();
Method[] methods = clazz.getDeclaredMethods();
for (int i = 0; i < methods.length; i++) {
Method method = methods[i];
rc.put(getSignature(method), method);
}
return rc;
}
private static Map SignatureMapCache= Collections.synchronizedMap(new WeakHashMap());
static class CacheValue {
Class clazz;
Map sigs;
}
public static Map getCachedSignatureMap(Class clazz) {
String cacheKey = clazz.getName();
CacheValue rc = (CacheValue) SignatureMapCache.get(cacheKey);
if (rc == null) {
rc = new CacheValue();
rc.clazz = clazz;
rc.sigs = getSignatureMapFor(clazz);
SignatureMapCache.put(cacheKey, rc);
return rc.sigs;
} else if ( rc.clazz.equals( clazz ) ) {
return rc.sigs;
} else {
// the previously cache class name might not be the same class
// due to classloader issues.
return getSignatureMapFor(clazz);
}
}
}