use of java.rmi.MarshalledObject in project jdk8u_jdk by JetBrains.
the class Chaining method test.
static void test(Throwable t, String msg, Throwable cause) throws Exception {
check(t, msg, cause);
Throwable[] pair = new Throwable[] { t, cause };
pair = (Throwable[]) new MarshalledObject(pair).get();
check(pair[0], msg, pair[1]);
}
use of java.rmi.MarshalledObject in project jdk8u_jdk by JetBrains.
the class LoadProxyClasses method unmarshalProxyClass.
private static Proxy unmarshalProxyClass(Proxy proxy, ClassLoader fnnLoader, ClassLoader expectedLoader, int n, LoadChecker checker) throws ClassNotFoundException, IOException, InstantiationException, IllegalAccessException {
FnnUnmarshal fnnUnmarshal = (FnnUnmarshal) fnnLoader.loadClass("FnnClass").newInstance();
Proxy unmarshalled = (Proxy) fnnUnmarshal.unmarshal(new MarshalledObject(proxy));
ClassLoader unmarshalledLoader = unmarshalled.getClass().getClassLoader();
if (checker != null) {
checker.checkLoad(unmarshalled, expectedLoader);
} else {
if (unmarshalledLoader != expectedLoader) {
TestLibrary.bomb("case" + n + ": proxy class not " + "placed into incorrect loader: " + unmarshalledLoader);
} else {
System.err.println("\ncase" + n + ": proxy class correctly" + " placed into expected loader: " + expectedLoader);
}
}
return proxy;
}
use of java.rmi.MarshalledObject in project jdk8u_jdk by JetBrains.
the class RMIConnectionImpl method removeNotificationListener.
// MarshalledObject
@SuppressWarnings("rawtypes")
public void removeNotificationListener(ObjectName name, ObjectName listener, MarshalledObject filter, MarshalledObject handback, Subject delegationSubject) throws InstanceNotFoundException, ListenerNotFoundException, IOException {
checkNonNull("Target MBean name", name);
checkNonNull("Listener MBean name", listener);
final NotificationFilter filterValue;
final Object handbackValue;
final boolean debug = logger.debugOn();
final ClassLoader targetCl = getClassLoaderFor(name);
if (debug)
logger.debug("removeNotificationListener" + "(ObjectName,ObjectName,NotificationFilter,Object)", "connectionId=" + connectionId + " unwrapping filter with target extended ClassLoader.");
filterValue = unwrap(filter, targetCl, defaultClassLoader, NotificationFilter.class, delegationSubject);
if (debug)
logger.debug("removeNotificationListener" + "(ObjectName,ObjectName,NotificationFilter,Object)", "connectionId=" + connectionId + " unwrapping handback with target extended ClassLoader.");
handbackValue = unwrap(handback, targetCl, defaultClassLoader, Object.class, delegationSubject);
try {
final Object[] params = new Object[] { name, listener, filterValue, handbackValue };
if (debug)
logger.debug("removeNotificationListener" + "(ObjectName,ObjectName,NotificationFilter,Object)", "connectionId=" + connectionId + ", name=" + name + ", listenerName=" + listener + ", filter=" + filterValue + ", handback=" + handbackValue);
doPrivilegedOperation(REMOVE_NOTIFICATION_LISTENER_OBJECTNAME_FILTER_HANDBACK, params, delegationSubject);
} catch (PrivilegedActionException pe) {
Exception e = extractException(pe);
if (e instanceof InstanceNotFoundException)
throw (InstanceNotFoundException) e;
if (e instanceof ListenerNotFoundException)
throw (ListenerNotFoundException) e;
if (e instanceof IOException)
throw (IOException) e;
throw newIOException("Got unexpected server exception: " + e, e);
}
}
use of java.rmi.MarshalledObject in project felix by apache.
the class ClientInvoker method removeNotificationListener.
public void removeNotificationListener(ObjectName observed, ObjectName listener, NotificationFilter filter, Object handback) throws InstanceNotFoundException, ListenerNotFoundException, IOException {
MarshalledObject f = RMIMarshaller.marshal(filter);
MarshalledObject h = RMIMarshaller.marshal(handback);
connection.removeNotificationListener(observed, listener, f, h, delegate);
}
use of java.rmi.MarshalledObject in project felix by apache.
the class ClientInvoker method addNotificationListener.
public void addNotificationListener(ObjectName observed, ObjectName listener, NotificationFilter filter, Object handback) throws InstanceNotFoundException, IOException {
MarshalledObject f = RMIMarshaller.marshal(filter);
MarshalledObject h = RMIMarshaller.marshal(handback);
connection.addNotificationListener(observed, listener, f, h, delegate);
}
Aggregations