JBoss Remoting SVN: r4460 - remoting2/branches/2.x/src/etc.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-08-02 01:41:54 -0400 (Sat, 02 Aug 2008)
New Revision: 4460
Modified:
remoting2/branches/2.x/src/etc/remoting.security.policy.core
Log:
JBREM-1019: Added read permission for system property "org.jboss.remoting.classloadingParentFirstDelegation", which is read in MicroRemoteClientInvoker.
Modified: remoting2/branches/2.x/src/etc/remoting.security.policy.core
===================================================================
--- remoting2/branches/2.x/src/etc/remoting.security.policy.core 2008-08-02 04:00:54 UTC (rev 4459)
+++ remoting2/branches/2.x/src/etc/remoting.security.policy.core 2008-08-02 05:41:54 UTC (rev 4460)
@@ -182,6 +182,9 @@
/////////////////////////////////////////////////////////////////////////////////////////////
// System properties accessed by Remoting
+ // Used by org.jboss.remoting.MicroRemoteClientInvoker
+ permission java.util.PropertyPermission "org.jboss.remoting.classloadingParentFirstDelegation", "read";
+
// Used by org.jboss.remoting.callback.CallbackStore,
// org.jboss.remoting.callback.ServerInvokerCallbackHandler
permission java.util.PropertyPermission "file.separator", "read";
16 years, 4 months
JBoss Remoting SVN: r4459 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-08-02 00:00:54 -0400 (Sat, 02 Aug 2008)
New Revision: 4459
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/ClientSocketWrapper.java
Log:
JBREM-996, JBREM-997: In createStreams() took timeout reset out of finally clause.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/ClientSocketWrapper.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/ClientSocketWrapper.java 2008-08-01 05:55:00 UTC (rev 4458)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/ClientSocketWrapper.java 2008-08-02 04:00:54 UTC (rev 4459)
@@ -158,16 +158,10 @@
}
}
- try
- {
- out = createOutputStream(serializationType, socket, marshaller);
- in = createInputStream(serializationType, socket, unmarshaller);
- }
- finally
- {
- setTimeout(savedTimeout);
- log.debug("reset timeout: " + savedTimeout);
- }
+ out = createOutputStream(serializationType, socket, marshaller);
+ in = createInputStream(serializationType, socket, unmarshaller);
+ setTimeout(savedTimeout);
+ log.debug("reset timeout: " + savedTimeout);
}
protected InputStream createInputStream(String serializationType, Socket socket, UnMarshaller unmarshaller)
16 years, 4 months
JBoss Remoting SVN: r4458 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport/http.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-08-01 01:55:00 -0400 (Fri, 01 Aug 2008)
New Revision: 4458
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/http/HTTPClientInvoker.java
Log:
JBREM-990: (1) useHttpURLConnection() tries to add responseMessage and responseCode to CannotConnectException(); (2) readResponse() checks for EOF on inputStream and throws EOFException.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/http/HTTPClientInvoker.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/http/HTTPClientInvoker.java 2008-08-01 05:53:42 UTC (rev 4457)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/http/HTTPClientInvoker.java 2008-08-01 05:55:00 UTC (rev 4458)
@@ -51,6 +51,7 @@
import org.jboss.util.threadpool.Task;
import org.jboss.util.threadpool.ThreadPool;
+import java.io.EOFException;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -379,8 +380,21 @@
}
catch (Exception e)
{
- log.debug("Error invoking http client invoker.", e);
- throw new CannotConnectException("Can not connect http client invoker.", e);
+ String message = "Can not connect http client invoker.";
+ if (e.getMessage() != null)
+ message += " " + e.getMessage() + ".";
+
+ try
+ {
+ String responseMessage = conn.getResponseMessage();
+ int code = conn.getResponseCode();
+ message += " Response: " + responseMessage + "/" + code + ".";
+ }
+ catch (IOException e1)
+ {
+ log.debug("Unable to retrieve response message", e1);
+ }
+ throw new CannotConnectException(message, e);
}
// now check for error response and throw exception unless configured to not do so
@@ -501,9 +515,9 @@
}
private Object readResponse(Map metadata, Map headers, UnMarshaller unmarshaller, InputStream is)
- throws IOException, ClassNotFoundException
+ throws ClassNotFoundException, IOException
{
- Object result;
+ Object result = null;
String encoding = null;
Object ceObj = headers.get("Content-Encoding");
if (ceObj != null)
@@ -529,10 +543,25 @@
map.put(HTTPUnMarshaller.PRESERVE_LINES, o);
}
- if (unmarshaller instanceof VersionedUnMarshaller)
- result = ((VersionedUnMarshaller)unmarshaller).read(is, map, getVersion());
- else
- result = unmarshaller.read(is, map);
+ try
+ {
+ if (unmarshaller instanceof VersionedUnMarshaller)
+ result = ((VersionedUnMarshaller)unmarshaller).read(is, map, getVersion());
+ else
+ result = unmarshaller.read(is, map);
+ }
+ catch (ClassNotFoundException e)
+ {
+ throw e;
+ }
+ catch (IOException e)
+ {
+ if (-1 == is.read())
+ {
+ throw new EOFException();
+ }
+ throw e;
+ }
return result;
}
16 years, 4 months
JBoss Remoting SVN: r4457 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-08-01 01:53:42 -0400 (Fri, 01 Aug 2008)
New Revision: 4457
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/Connector.java
Log:
JBREM-1000: Added ability to read <repositories> element from xml config file.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/Connector.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/Connector.java 2008-08-01 05:52:52 UTC (rev 4456)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/Connector.java 2008-08-01 05:53:42 UTC (rev 4457)
@@ -508,7 +508,8 @@
// if loaderLocator is null, then probably not defined to have loader service (i.e. no loader port specified)
if (loaderLocator != null)
{
- marshallerLoader = MarshallLoaderFactory.createMarshallLoader(loaderLocator);
+ List repositories = getLoaderRepositories();
+ marshallerLoader = MarshallLoaderFactory.createMarshallLoader(loaderLocator, repositories, server);
}
return marshallerLoader;
}
@@ -972,6 +973,41 @@
}
}
+ private List getLoaderRepositories()
+ {
+ if (xml == null)
+ {
+ return null;
+ }
+
+ NodeList repositoryNodes = xml.getElementsByTagName("repository");
+ if (repositoryNodes.getLength() == 0)
+ {
+ return null;
+ }
+
+ List repositories = new ArrayList();
+ for (int i = 0; i < repositoryNodes.getLength(); i++)
+ {
+ Node node = repositoryNodes.item(i);
+ String repositoryName = node.getFirstChild().getNodeValue();
+
+ try
+ {
+ ObjectName objName = new ObjectName(repositoryName);
+ repositories.add(objName);
+ log.info("repository: " + repositoryName);
+ }
+ catch (MalformedObjectNameException e)
+ {
+ log.debug("repository name is not an object name: " + repositoryName);
+ continue;
+ }
+ }
+
+ return repositories;
+ }
+
private ServerInvocationHandler createHandlerProxy(ObjectName objName)
{
ServerInvocationHandler handler;
16 years, 4 months
JBoss Remoting SVN: r4456 - remoting2/branches/2.x/src/main/org/jboss/remoting/marshal.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-08-01 01:52:52 -0400 (Fri, 01 Aug 2008)
New Revision: 4456
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/marshal/MarshallLoaderFactory.java
Log:
JBREM-1000: arshallerLoaderHandler gets repositories set and MBeanServer.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/marshal/MarshallLoaderFactory.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/marshal/MarshallLoaderFactory.java 2008-08-01 05:52:08 UTC (rev 4455)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/marshal/MarshallLoaderFactory.java 2008-08-01 05:52:52 UTC (rev 4456)
@@ -23,7 +23,11 @@
package org.jboss.remoting.marshal;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
+
+import javax.management.MBeanServer;
+
import org.jboss.logging.Logger;
import org.jboss.remoting.InvokerLocator;
import org.jboss.remoting.transport.Connector;
@@ -43,9 +47,11 @@
* listen on. Will return null if can not create the connector.
*
* @param locator
+ * @param repositories
+ * @param mbeanServer
* @return
*/
- public static Connector createMarshallLoader(InvokerLocator locator)
+ public static Connector createMarshallLoader(InvokerLocator locator, List repositories, MBeanServer mbeanServer)
{
Connector marshallerConnector = null;
try
@@ -54,8 +60,11 @@
marshallerConnector.setInvokerLocator(locator.getLocatorURI());
marshallerConnector.start();
- MarshallerLoaderHandler loader = new MarshallerLoaderHandler();
+ MarshallerLoaderHandler loader = new MarshallerLoaderHandler(repositories);
marshallerConnector.addInvocationHandler("loader", loader);
+
+ // Set after Connector.addInvocationHandler(), which also sets MBeanServer.
+ loader.setMBeanServer(mbeanServer);
}
catch(Exception e)
{
16 years, 4 months
JBoss Remoting SVN: r4455 - remoting2/branches/2.x/src/main/org/jboss/remoting/marshal.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-08-01 01:52:08 -0400 (Fri, 01 Aug 2008)
New Revision: 4455
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/marshal/MarshallerLoaderHandler.java
Log:
JBREM-1000: Can look in HeirarchicalLoaderRepository3s for scoped classes.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/marshal/MarshallerLoaderHandler.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/marshal/MarshallerLoaderHandler.java 2008-08-01 05:50:12 UTC (rev 4454)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/marshal/MarshallerLoaderHandler.java 2008-08-01 05:52:08 UTC (rev 4455)
@@ -22,9 +22,19 @@
package org.jboss.remoting.marshal;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Iterator;
+import java.util.List;
import java.util.Map;
import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
import org.jboss.logging.Logger;
+import org.jboss.mx.loading.LoaderRepository;
+import org.jboss.mx.loading.RepositoryClassLoader;
import org.jboss.remoting.InvocationRequest;
import org.jboss.remoting.InvokerLocator;
import org.jboss.remoting.ServerInvocationHandler;
@@ -43,10 +53,15 @@
{
private ServerInvoker invoker = null;
private MBeanServer server = null;
+ private List repositories;
protected final static Logger log = Logger.getLogger(MarshallerLoaderHandler.class);
-
+ public MarshallerLoaderHandler(List repositories)
+ {
+ this.repositories = repositories;
+ }
+
/**
* set the mbean server that the handler can reference
*
@@ -102,9 +117,11 @@
else if(LOAD_CLASS_METHOD.equals(param))
{
String className = (String) metadMap.get(CLASSNAME);
+ log.debug("MarshallerLoaderHandler: loading class: " + className);
if(className != null)
{
ret = loadClassBytes(className, invoker.getClassLoader());
+ log.debug("MarshallerLoaderHandler: returning class: " + className + ": " + ret);
}
else
{
@@ -155,6 +172,39 @@
if(className != null)
{
byte[] classDefinition = ClassUtil.getClassBytes(className, classLoader);
+
+ if (classDefinition == null && repositories != null)
+ {
+ Iterator it = repositories.iterator();
+ while (it.hasNext())
+ {
+ ObjectName name = (ObjectName) it.next();
+ log.debug("searching repository " + name);
+
+ try
+ {
+ Object o = server.getAttribute(name, "Instance");
+ LoaderRepository repository = (LoaderRepository) o;
+ Class c = repository.getCachedClass(className);
+ if (c == null)
+ {
+ continue;
+ }
+ log.debug("found class in repository " + name);
+ RepositoryClassLoader cl = (RepositoryClassLoader) c.getClassLoader();
+ classDefinition = loadByteCode(cl, className);
+ }
+ catch (Exception e)
+ {
+ log.debug("unable to get class from " + name + ": " + e.getMessage(), e);
+ }
+ }
+ }
+
+ if (classDefinition == null)
+ {
+ log.debug("unable to load class " + className);
+ }
classBytes = new ClassBytes(className, classDefinition);
}
return classBytes;
@@ -179,4 +229,62 @@
{
//NO OP as don't won't allow listeners
}
+
+ /**
+ * Adapted from org.jboss.mx.loading.RepositoryClassLoader.
+ *
+ * @param cl
+ * @param classname
+ * @return
+ * @throws ClassNotFoundException
+ * @throws IOException
+ */
+ protected byte[] loadByteCode(ClassLoader cl, String classname)
+ throws ClassNotFoundException, IOException
+ {
+ byte[] bytecode = null;
+ URL classURL = getClassURL(cl, classname);
+
+ // Load the class bytecode
+ InputStream is = null;
+ try
+ {
+ is = classURL.openStream();
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ byte[] tmp = new byte[1024];
+ int read = 0;
+ while( (read = is.read(tmp)) > 0 )
+ {
+ baos.write(tmp, 0, read);
+ }
+ bytecode = baos.toByteArray();
+ }
+ finally
+ {
+ if( is != null )
+ is.close();
+ }
+
+ return bytecode;
+ }
+
+ /**
+ * Adapted from org.jboss.mx.loading.RepositoryClassLoader.
+ *
+ * @param cl
+ * @param classname
+ * @return
+ * @throws ClassNotFoundException
+ */
+ private URL getClassURL(ClassLoader cl, String classname) throws ClassNotFoundException
+ {
+ String classRsrcName = classname.replace('.', '/') + ".class";
+ URL classURL = cl.getResource(classRsrcName);
+ if( classURL == null )
+ {
+ String msg = "Failed to find: "+classname+" as resource: "+classRsrcName;
+ throw new ClassNotFoundException(msg);
+ }
+ return classURL;
+ }
}
16 years, 4 months
JBoss Remoting SVN: r4454 - remoting2/branches/2.x/src/main/org/jboss/remoting/loading.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-08-01 01:50:12 -0400 (Fri, 01 Aug 2008)
New Revision: 4454
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/loading/ClassByteClassLoader.java
Log:
JBREM-1000: Added two log.debug() calls.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/loading/ClassByteClassLoader.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/loading/ClassByteClassLoader.java 2008-08-01 03:07:52 UTC (rev 4453)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/loading/ClassByteClassLoader.java 2008-08-01 05:50:12 UTC (rev 4454)
@@ -389,7 +389,9 @@
{
loaderClient.connect();
}
+ log.debug("attempting to load from network: " + className);
Object obj = loaderClient.invoke(marshallerMethodName, metadata);
+ log.debug("loaded from network: " + obj);
if(obj != null)
{
16 years, 4 months
JBoss Remoting SVN: r4453 - remoting2/branches/2.x/src/main/org/jboss/remoting.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-07-31 23:07:52 -0400 (Thu, 31 Jul 2008)
New Revision: 4453
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/MicroRemoteClientInvoker.java
Log:
JBREM-1019: Syntax change to conform to jdk 1.4.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/MicroRemoteClientInvoker.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/MicroRemoteClientInvoker.java 2008-08-01 01:49:45 UTC (rev 4452)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/MicroRemoteClientInvoker.java 2008-08-01 03:07:52 UTC (rev 4453)
@@ -128,7 +128,7 @@
if (flag != null)
{
String sflag = flag.toString();
- parentFirst = Boolean.valueOf(sflag);
+ parentFirst = Boolean.valueOf(sflag).booleanValue();
}
if (unmarshaller instanceof UpdateableClassloaderUnMarshaller)
{
16 years, 4 months
JBoss Remoting SVN: r4452 - remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util.
by jboss-remoting-commits@lists.jboss.org
Author: david.lloyd(a)jboss.com
Date: 2008-07-31 21:49:45 -0400 (Thu, 31 Jul 2008)
New Revision: 4452
Modified:
remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/ServiceURI.java
Log:
Slightly stricter checking
Modified: remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/ServiceURI.java
===================================================================
--- remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/ServiceURI.java 2008-08-01 01:48:05 UTC (rev 4451)
+++ remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/ServiceURI.java 2008-08-01 01:49:45 UTC (rev 4452)
@@ -13,13 +13,13 @@
}
/**
- * Determine if this URI is for a Remoting service.
+ * Determine if this URI is a valid Remoting service URI.
*
* @param uri the URI
- * @return {@code true} if the given URI is a Remoting service URI
+ * @return {@code true} if the given URI is a valid Remoting service URI
*/
public static boolean isRemotingServiceUri(final URI uri) {
- return SCHEME.equals(uri.getScheme());
+ return SCHEME.equals(uri.getScheme()) && uri.isOpaque();
}
/**
@@ -31,7 +31,7 @@
*/
public static String getServiceType(final URI uri) throws IllegalArgumentException {
if (! isRemotingServiceUri(uri)) {
- throw new IllegalArgumentException("Not a remoting service URI");
+ throw new IllegalArgumentException("Not a valid remoting service URI");
}
final String ssp = uri.getSchemeSpecificPart();
final int firstColon = ssp.indexOf(':');
@@ -53,7 +53,7 @@
*/
public static String getGroupName(final URI uri) throws IllegalArgumentException {
if (! isRemotingServiceUri(uri)) {
- throw new IllegalArgumentException("Not a remoting service URI");
+ throw new IllegalArgumentException("Not a valid remoting service URI");
}
final String ssp = uri.getSchemeSpecificPart();
final int firstColon = ssp.indexOf(':');
@@ -79,7 +79,7 @@
*/
public static String getEndpointName(final URI uri) throws IllegalArgumentException {
if (! isRemotingServiceUri(uri)) {
- throw new IllegalArgumentException("Not a remoting service URI");
+ throw new IllegalArgumentException("Not a valid remoting service URI");
}
final String ssp = uri.getSchemeSpecificPart();
final int firstColon = ssp.indexOf(':');
16 years, 4 months
JBoss Remoting SVN: r4451 - remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util.
by jboss-remoting-commits@lists.jboss.org
Author: david.lloyd(a)jboss.com
Date: 2008-07-31 21:48:05 -0400 (Thu, 31 Jul 2008)
New Revision: 4451
Modified:
remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/ServiceURI.java
Log:
New and improved Remoting service URI utility methods - fixed
Modified: remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/ServiceURI.java
===================================================================
--- remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/ServiceURI.java 2008-08-01 01:41:51 UTC (rev 4450)
+++ remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/ServiceURI.java 2008-08-01 01:48:05 UTC (rev 4451)
@@ -115,14 +115,14 @@
if (serviceType != null && serviceType.length() > 0) {
builder.append(serviceType);
}
+ builder.append(':');
if (groupName != null && groupName.length() > 0) {
- builder.append(':').append(groupName);
- if (endpointName != null && endpointName.length() > 0) {
- builder.append(':').append(groupName);
- }
- } else if (endpointName != null && endpointName.length() > 0) {
- builder.append(':').append(':').append(groupName);
+ builder.append(groupName);
}
+ builder.append(':');
+ if (endpointName != null && endpointName.length() > 0) {
+ builder.append(endpointName);
+ }
return new URI(SCHEME, builder.toString(), null);
} catch (URISyntaxException e) {
throw new IllegalStateException("URI syntax exception should not be possible here", e);
16 years, 4 months