Search in sources :

Example 21 with MarshalledObject

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]);
}
Also used : MarshalledObject(java.rmi.MarshalledObject)

Example 22 with MarshalledObject

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;
}
Also used : Proxy(java.lang.reflect.Proxy) MarshalledObject(java.rmi.MarshalledObject) URLClassLoader(java.net.URLClassLoader) RMIClassLoader(java.rmi.server.RMIClassLoader)

Example 23 with MarshalledObject

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);
    }
}
Also used : PrivilegedActionException(java.security.PrivilegedActionException) MarshalledObject(java.rmi.MarshalledObject) IOException(java.io.IOException) UnmarshalException(java.rmi.UnmarshalException) JMXServerErrorException(javax.management.remote.JMXServerErrorException) PrivilegedActionException(java.security.PrivilegedActionException) IOException(java.io.IOException)

Example 24 with MarshalledObject

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);
}
Also used : MarshalledObject(java.rmi.MarshalledObject)

Example 25 with MarshalledObject

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);
}
Also used : MarshalledObject(java.rmi.MarshalledObject)

Aggregations

MarshalledObject (java.rmi.MarshalledObject)32 IOException (java.io.IOException)6 ArrayList (java.util.ArrayList)5 List (java.util.List)4 Graph (edu.cmu.tetrad.graph.Graph)3 Node (edu.cmu.tetrad.graph.Node)3 Remote (java.rmi.Remote)3 EJBHome (javax.ejb.EJBHome)3 EJBObject (javax.ejb.EJBObject)3 Handle (javax.ejb.Handle)3 HomeHandle (javax.ejb.HomeHandle)3 NotificationFilter (javax.management.NotificationFilter)3 TestType (edu.cmu.tetrad.search.TestType)2 UnmarshalException (java.rmi.UnmarshalException)2 PrivilegedActionException (java.security.PrivilegedActionException)2 ObjectName (javax.management.ObjectName)2 JMXServerErrorException (javax.management.remote.JMXServerErrorException)2 NotificationTuple (org.apache.felix.mosgi.jmx.rmiconnector.mx4j.remote.NotificationTuple)2 FindOneFactorClusters (edu.cmu.tetrad.search.FindOneFactorClusters)1 FindTwoFactorClusters (edu.cmu.tetrad.search.FindTwoFactorClusters)1