Search in sources :

Example 11 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 12 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 13 with MarshalledObject

use of java.rmi.MarshalledObject in project tomee by apache.

the class Unknown2HomeHandleTests method Xtest02_copyHandleByMarshalledObject.

public void Xtest02_copyHandleByMarshalledObject() {
    try {
        final MarshalledObject obj = new MarshalledObject(ejbHomeHandle);
        final HomeHandle copy = (HomeHandle) obj.get();
        assertNotNull("The HomeHandle copy is null", copy);
        final EJBHome home = copy.getEJBHome();
        assertNotNull("The EJBHome is null", home);
    } catch (final Exception e) {
        fail("Received Exception " + e.getClass() + " : " + e.getMessage());
    }
}
Also used : EJBHome(javax.ejb.EJBHome) MarshalledObject(java.rmi.MarshalledObject) HomeHandle(javax.ejb.HomeHandle)

Example 14 with MarshalledObject

use of java.rmi.MarshalledObject in project tomee by apache.

the class Complex2HandleTests method Xtest02_copyHandleByMarshalledObject.

public void Xtest02_copyHandleByMarshalledObject() {
    try {
        final MarshalledObject obj = new MarshalledObject(ejbHandle);
        final Handle copy = (Handle) obj.get();
        final EJBObject object = copy.getEJBObject();
        assertNotNull("The EJBObject is null", object);
        assertTrue("EJBObjects are not identical", object.isIdentical(ejbObject));
    } catch (final Exception e) {
        fail("Received Exception " + e.getClass() + " : " + e.getMessage());
    }
}
Also used : EJBObject(javax.ejb.EJBObject) MarshalledObject(java.rmi.MarshalledObject) Handle(javax.ejb.Handle)

Aggregations

MarshalledObject (java.rmi.MarshalledObject)14 IOException (java.io.IOException)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 UnmarshalException (java.rmi.UnmarshalException)2 PrivilegedActionException (java.security.PrivilegedActionException)2 JMXServerErrorException (javax.management.remote.JMXServerErrorException)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 ObjectInputStream (java.io.ObjectInputStream)1 Serializable (java.io.Serializable)1 Reference (java.lang.ref.Reference)1 ReferenceQueue (java.lang.ref.ReferenceQueue)1 WeakReference (java.lang.ref.WeakReference)1 Proxy (java.lang.reflect.Proxy)1 SocketPermission (java.net.SocketPermission)1 URLClassLoader (java.net.URLClassLoader)1 RMIClassLoader (java.rmi.server.RMIClassLoader)1