use of hudson.remoting.RemoteInvocationHandler.RPCRequest in project hudson-2.x by hudson.
the class TrafficAnalyzer method main.
public static void main(String[] args) throws Exception {
File f = new File("/home/kohsuke/ws/hudson/investigations/javafx-windows-hang/out.log");
DataInputStream fin = new DataInputStream(new FileInputStream(f));
// skip preamble
fin.readFully(new byte[4]);
ObjectInputStream ois = new ObjectInputStream(fin);
for (int n = 0; ; n++) {
Command o = (Command) ois.readObject();
System.out.println("#" + n + " : " + o);
if (o instanceof RPCRequest) {
RPCRequest request = (RPCRequest) o;
System.out.print(" (");
boolean first = true;
for (Object argument : request.getArguments()) {
if (first)
first = false;
else
System.out.print(",");
System.out.print(argument);
}
System.out.println(")");
}
if (o.createdAt != null)
o.createdAt.printStackTrace(System.out);
}
}
use of hudson.remoting.RemoteInvocationHandler.RPCRequest in project hudson-2.x by hudson.
the class UserResponse method perform.
protected UserResponse<RSP, EXC> perform(Channel channel) throws EXC {
try {
ClassLoader cl = channel.importedClassLoaders.get(classLoaderProxy);
RSP r = null;
Channel oldc = Channel.setCurrent(channel);
try {
Object o;
try {
o = deserialize(channel, request, cl);
} catch (ClassNotFoundException e) {
throw new ClassNotFoundException("Failed to deserialize the Callable object. Perhaps you needed to implement DelegatingCallable?", e);
}
Callable<RSP, EXC> callable = (Callable<RSP, EXC>) o;
if (channel.isRestricted && !(callable instanceof RPCRequest))
// OTOH, we need to allow RPCRequest so that method invocations on exported objects will go through.
throw new SecurityException("Execution of " + callable.toString() + " is prohibited because the channel is restricted");
ClassLoader old = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(cl);
// execute the service
try {
r = callable.call();
} finally {
Thread.currentThread().setContextClassLoader(old);
}
} finally {
Channel.setCurrent(oldc);
}
return new UserResponse<RSP, EXC>(serialize(r, channel), false);
} catch (Throwable e) {
// propagate this to the calling process
try {
byte[] response;
try {
response = _serialize(e, channel);
} catch (NotSerializableException x) {
// perhaps the thrown runtime exception is of type we can't handle
response = serialize(new ProxyException(e), channel);
}
return new UserResponse<RSP, EXC>(response, true);
} catch (IOException x) {
// throw it as a lower-level exception
throw (EXC) x;
}
}
}
Aggregations