Author: david.lloyd(a)jboss.com
Date: 2010-04-12 11:43:18 -0400 (Mon, 12 Apr 2010)
New Revision: 5848
Modified:
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/InboundReplyExceptionTask.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/InboundReplyTask.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/InboundRequestTask.java
Log:
Use the right classloader
Modified:
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/InboundReplyExceptionTask.java
===================================================================
---
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/InboundReplyExceptionTask.java 2010-04-09
13:37:42 UTC (rev 5847)
+++
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/InboundReplyExceptionTask.java 2010-04-12
15:43:18 UTC (rev 5848)
@@ -23,7 +23,9 @@
package org.jboss.remoting3.remote;
import java.io.IOException;
+import org.jboss.marshalling.MarshallingConfiguration;
import org.jboss.marshalling.NioByteInput;
+import org.jboss.marshalling.SimpleClassResolver;
import org.jboss.marshalling.Unmarshaller;
import org.jboss.remoting3.RemoteReplyException;
import org.jboss.remoting3.RemoteRequestException;
@@ -49,11 +51,15 @@
oldByteInput = outboundRequest.getByteInput();
}
final RemoteConnectionHandler connectionHandler = remoteConnectionHandler;
+ final ClassLoader replyClassLoader =
outboundRequest.getInboundReplyHandler().getClassLoader();
connectionHandler.getConnectionContext().beginContext();
try {
final Object exception;
try {
- final Unmarshaller unmarshaller =
connectionHandler.getMarshallerFactory().createUnmarshaller(connectionHandler.getMarshallingConfiguration());
+ final MarshallingConfiguration configuration =
connectionHandler.getMarshallingConfiguration();
+ final MarshallingConfiguration newConfig = configuration.clone();
+ newConfig.setClassResolver(new SimpleClassResolver(replyClassLoader));
+ final Unmarshaller unmarshaller =
connectionHandler.getMarshallerFactory().createUnmarshaller(configuration);
unmarshaller.start(outboundRequest.getByteInput());
exception = unmarshaller.readObject();
} catch (IOException e) {
Modified:
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/InboundReplyTask.java
===================================================================
---
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/InboundReplyTask.java 2010-04-09
13:37:42 UTC (rev 5847)
+++
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/InboundReplyTask.java 2010-04-12
15:43:18 UTC (rev 5848)
@@ -23,6 +23,8 @@
package org.jboss.remoting3.remote;
import java.io.IOException;
+import org.jboss.marshalling.MarshallingConfiguration;
+import org.jboss.marshalling.SimpleClassResolver;
import org.jboss.marshalling.Unmarshaller;
import org.jboss.remoting3.RemoteRequestException;
import org.jboss.remoting3.spi.LocalReplyHandler;
@@ -48,12 +50,16 @@
synchronized (outboundRequest) {
replyHandler = outboundRequest.getInboundReplyHandler();
}
+ final ClassLoader replyClassLoader =
outboundRequest.getInboundReplyHandler().getClassLoader();
final Object reply;
try {
final RemoteConnectionHandler connectionHandler = remoteConnectionHandler;
connectionHandler.getConnectionContext().beginContext();
try {
- final Unmarshaller unmarshaller =
connectionHandler.getMarshallerFactory().createUnmarshaller(connectionHandler.getMarshallingConfiguration());
+ final MarshallingConfiguration configuration =
connectionHandler.getMarshallingConfiguration();
+ final MarshallingConfiguration newConfig = configuration.clone();
+ newConfig.setClassResolver(new SimpleClassResolver(replyClassLoader));
+ final Unmarshaller unmarshaller =
connectionHandler.getMarshallerFactory().createUnmarshaller(configuration);
try {
log.trace("Unmarshalling inbound reply");
unmarshaller.start(outboundRequest.getByteInput());
Modified:
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/InboundRequestTask.java
===================================================================
---
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/InboundRequestTask.java 2010-04-09
13:37:42 UTC (rev 5847)
+++
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/InboundRequestTask.java 2010-04-12
15:43:18 UTC (rev 5848)
@@ -23,6 +23,8 @@
package org.jboss.remoting3.remote;
import java.io.IOException;
+import org.jboss.marshalling.MarshallingConfiguration;
+import org.jboss.marshalling.SimpleClassResolver;
import org.jboss.marshalling.Unmarshaller;
import org.jboss.marshalling.util.IntKeyMap;
import org.jboss.remoting3.RemoteRequestException;
@@ -52,12 +54,21 @@
synchronized (inboundRequest) {
inboundRequest.setReplyHandler(replyHandler = new
OutboundReplyHandler(inboundRequest, rid));
}
+ final RemoteConnectionHandler connectionHandler = remoteConnectionHandler;
+ final IntKeyMap<InboundClient> inboundClients =
connectionHandler.getInboundClients();
+ final InboundClient inboundClient;
+ synchronized (inboundClients) {
+ inboundClient = inboundClients.get(cid);
+ }
+ final ClassLoader requestClassLoader =
inboundClient.getHandler().getClassLoader();
final Object request;
- final RemoteConnectionHandler connectionHandler = remoteConnectionHandler;
try {
connectionHandler.getConnectionContext().beginContext();
try {
- final Unmarshaller unmarshaller =
connectionHandler.getMarshallerFactory().createUnmarshaller(connectionHandler.getMarshallingConfiguration());
+ final MarshallingConfiguration config =
connectionHandler.getMarshallingConfiguration();
+ final MarshallingConfiguration newConfig = config.clone();
+ newConfig.setClassResolver(new SimpleClassResolver(requestClassLoader));
+ final Unmarshaller unmarshaller =
connectionHandler.getMarshallerFactory().createUnmarshaller(newConfig);
try {
log.trace("Unmarshalling inbound request");
unmarshaller.start(inboundRequest.getByteInput());
@@ -88,11 +99,6 @@
SpiUtils.safeHandleException(replyHandler, new RemoteRequestException(e));
throw e;
}
- final InboundClient inboundClient;
- final IntKeyMap<InboundClient> inboundClients =
connectionHandler.getInboundClients();
- synchronized (inboundClients) {
- inboundClient = inboundClients.get(cid);
- }
synchronized (inboundRequest) {
inboundRequest.setCancellable(inboundClient.getHandler().receiveRequest(request,
replyHandler));
}
Show replies by date