Search in sources :

Example 6 with MarshalledObject

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

the class Unknown2HandleTests 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)

Example 7 with MarshalledObject

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

the class Complex2HomeHandleTests 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 8 with MarshalledObject

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

the class Cmp2HandleTests 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)

Example 9 with MarshalledObject

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

the class Cmp2HomeHandleTests 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 10 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)

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