Java 类java.rmi.MarshalledObject 实例源码

项目:OpenJSharp    文件:Activation.java   
synchronized MarshalledObject<? extends Remote>
    activate(ActivationID id,
             boolean force,
             ActivationInstantiator inst)
    throws RemoteException, ActivationException
{
    MarshalledObject<? extends Remote> nstub = stub;
    if (removed) {
        throw new UnknownObjectException("object removed");
    } else if (!force && nstub != null) {
        return nstub;
    }

    nstub = inst.newInstance(id, desc);
    stub = nstub;
    /*
     * stub could be set to null by a group reset, so return
     * the newstub here to prevent returning null.
     */
    return nstub;
}
项目:jdk8u-jdk    文件:ActivatableImpl.java   
public ActivatableImpl(ActivationID id, MarshalledObject mobj)
    throws RemoteException
{
    super(id, 0);

    ClassLoader thisLoader = ActivatableImpl.class.getClassLoader();
    ClassLoader ccl = Thread.currentThread().getContextClassLoader();

    System.err.println("implLoader: " + thisLoader);
    System.err.println("ccl: " + ccl);

    /*
     * the context class loader is the ccl from when this object
     * was exported.  If the bug has been fixed, the ccl will be
     * the same as the class loader of this class.
     */
    classLoaderOk = (thisLoader == ccl);
}
项目:openjdk-jdk10    文件:RMIConnector.java   
public void addNotificationListener(ObjectName name,
        NotificationListener listener,
        NotificationFilter filter,
        Object handback)
        throws InstanceNotFoundException,
        IOException {

    final boolean debug = logger.debugOn();

    if (debug)
        logger.debug("addNotificationListener" +
                "(ObjectName,NotificationListener,"+
                "NotificationFilter,Object)",
                "name=" + name
                + ", listener=" + listener
                + ", filter=" + filter
                + ", handback=" + handback);

    final Integer listenerID =
            addListenerWithSubject(name,
            new MarshalledObject<NotificationFilter>(filter),
            delegationSubject,true);
    rmiNotifClient.addNotificationListener(listenerID, name, listener,
            filter, handback,
            delegationSubject);
}
项目:OpenJSharp    文件:RMIConnector.java   
public Set<ObjectName> queryNames(ObjectName name,
        QueryExp query)
        throws IOException {
    if (logger.debugOn()) logger.debug("queryNames",
            "name=" + name + ", query=" + query);

    final MarshalledObject<QueryExp> sQuery =
            new MarshalledObject<QueryExp>(query);
    final ClassLoader old = pushDefaultClassLoader();
    try {
        return connection.queryNames(name, sQuery, delegationSubject);
    } catch (IOException ioe) {
        communicatorAdmin.gotIOException(ioe);

        return connection.queryNames(name, sQuery, delegationSubject);
    } finally {
        popDefaultClassLoader(old);
    }
}
项目:jdk8u-jdk    文件:RMIConnector.java   
public void setAttribute(ObjectName name,
        Attribute attribute)
        throws InstanceNotFoundException,
        AttributeNotFoundException,
        InvalidAttributeValueException,
        MBeanException,
        ReflectionException,
        IOException {

    if (logger.debugOn()) logger.debug("setAttribute",
            "name=" + name + ", attribute name="
            + attribute.getName());

    final MarshalledObject<Attribute> sAttribute =
            new MarshalledObject<Attribute>(attribute);
    final ClassLoader old = pushDefaultClassLoader();
    try {
        connection.setAttribute(name, sAttribute, delegationSubject);
    } catch (IOException ioe) {
        communicatorAdmin.gotIOException(ioe);

        connection.setAttribute(name, sAttribute, delegationSubject);
    } finally {
        popDefaultClassLoader(old);
    }
}
项目:openjdk-jdk10    文件:RMIConnector.java   
public void setAttribute(ObjectName name,
        Attribute attribute)
        throws InstanceNotFoundException,
        AttributeNotFoundException,
        InvalidAttributeValueException,
        MBeanException,
        ReflectionException,
        IOException {

    if (logger.debugOn()) logger.debug("setAttribute",
            "name=" + name + ", attribute name="
            + attribute.getName());

    final MarshalledObject<Attribute> sAttribute =
            new MarshalledObject<Attribute>(attribute);
    final ClassLoader old = pushDefaultClassLoader();
    try {
        connection.setAttribute(name, sAttribute, delegationSubject);
    } catch (IOException ioe) {
        communicatorAdmin.gotIOException(ioe);

        connection.setAttribute(name, sAttribute, delegationSubject);
    } finally {
        popDefaultClassLoader(old);
    }
}
项目:openjdk-jdk10    文件:RMIConnector.java   
public Set<ObjectInstance> queryMBeans(ObjectName name,
        QueryExp query)
        throws IOException {
    if (logger.debugOn()) logger.debug("queryMBeans",
            "name=" + name + ", query=" + query);

    final MarshalledObject<QueryExp> sQuery =
            new MarshalledObject<QueryExp>(query);
    final ClassLoader old = pushDefaultClassLoader();
    try {
        return connection.queryMBeans(name, sQuery, delegationSubject);
    } catch (IOException ioe) {
        communicatorAdmin.gotIOException(ioe);

        return connection.queryMBeans(name, sQuery, delegationSubject);
    } finally {
        popDefaultClassLoader(old);
    }
}
项目:OpenJSharp    文件:RMIConnector.java   
public void addNotificationListener(ObjectName name,
        NotificationListener listener,
        NotificationFilter filter,
        Object handback)
        throws InstanceNotFoundException,
        IOException {

    final boolean debug = logger.debugOn();

    if (debug)
        logger.debug("addNotificationListener" +
                "(ObjectName,NotificationListener,"+
                "NotificationFilter,Object)",
                "name=" + name
                + ", listener=" + listener
                + ", filter=" + filter
                + ", handback=" + handback);

    final Integer listenerID =
            addListenerWithSubject(name,
            new MarshalledObject<NotificationFilter>(filter),
            delegationSubject,true);
    rmiNotifClient.addNotificationListener(listenerID, name, listener,
            filter, handback,
            delegationSubject);
}
项目:jdk8u-jdk    文件:ActivationGroupImpl.java   
/**
 * Creates a default activation group implementation.
 *
 * @param id the group's identifier
 * @param data ignored
 */
public ActivationGroupImpl(ActivationGroupID id, MarshalledObject<?> data)
    throws RemoteException
{
    super(id);
    groupID = id;

    /*
     * Unexport activation group impl and attempt to export it on
     * an unshared anonymous port.  See 4692286.
     */
    unexportObject(this, true);
    RMIServerSocketFactory ssf = new ServerSocketFactoryImpl();
    UnicastRemoteObject.exportObject(this, 0, null, ssf);

    if (System.getSecurityManager() == null) {
        try {
            // Provide a default security manager.
            System.setSecurityManager(new SecurityManager());

        } catch (Exception e) {
            throw new RemoteException("unable to set security manager", e);
        }
    }
}
项目:jdk8u-jdk    文件:RMIConnector.java   
public void addNotificationListener(ObjectName name,
        NotificationListener listener,
        NotificationFilter filter,
        Object handback)
        throws InstanceNotFoundException,
        IOException {

    final boolean debug = logger.debugOn();

    if (debug)
        logger.debug("addNotificationListener" +
                "(ObjectName,NotificationListener,"+
                "NotificationFilter,Object)",
                "name=" + name
                + ", listener=" + listener
                + ", filter=" + filter
                + ", handback=" + handback);

    final Integer listenerID =
            addListenerWithSubject(name,
            new MarshalledObject<NotificationFilter>(filter),
            delegationSubject,true);
    rmiNotifClient.addNotificationListener(listenerID, name, listener,
            filter, handback,
            delegationSubject);
}
项目:openjdk-jdk10    文件:Activation.java   
synchronized MarshalledObject<? extends Remote>
    activate(ActivationID id,
             boolean force,
             ActivationInstantiator inst)
    throws RemoteException, ActivationException
{
    MarshalledObject<? extends Remote> nstub = stub;
    if (removed) {
        throw new UnknownObjectException("object removed");
    } else if (!force && nstub != null) {
        return nstub;
    }

    nstub = inst.newInstance(id, desc);
    stub = nstub;
    /*
     * stub could be set to null by a group reset, so return
     * the newstub here to prevent returning null.
     */
    return nstub;
}
项目:incubator-netbeans    文件:TransformHistoryTest.java   
private boolean checkHistory (TransformHistory history, int xi, int ti, String xml, String xsl, String output) {
    // modify history
    history.setOverwriteOutput (!history.isOverwriteOutput()); // negate
    history.setProcessOutput ((history.getProcessOutput()+1)%3); // rotate
    if ( xml != null ) {
        history.addXML (xml, output);
    }
    if ( xsl != null ) {
        history.addXSL (xsl, output);
    }

    // test number of XMLs
    if ( history.getXMLs().length != xi ) {
        System.out.println("    history.getXMLs().length: " + history.getXMLs().length);
        return false;
    }
    // test number of XSLs
    if ( history.getXSLs().length != ti ) {
        System.out.println("    history.getXSLs().length: " + history.getXSLs().length);
        return false;
    }

    // (de)marshal
    TransformHistory newHistory = null;
    try {
        MarshalledObject marshalled = new MarshalledObject (history);
        newHistory = (TransformHistory) marshalled.get();
    } catch (Exception exc) {
        System.err.println("!!! " + exc);
        return false;
    }

    // test if equals
    return (history.equals (newHistory));
}
项目:jdk8u-jdk    文件:PrimitiveClasses.java   
public static void main(String[] args) throws Exception {
    Class[] primClasses = {
        boolean.class, byte.class, char.class, short.class,
        int.class, long.class, float.class, double.class
    };
    for (int i = 0; i < primClasses.length; i++) {
        Class pc = primClasses[i];
        if (new MarshalledObject(pc).get() != pc) {
            throw new Error();
        }
    }
}
项目:openjdk-jdk10    文件:RMIConnectionImpl.java   
@SuppressWarnings("rawtypes")  // MarshalledObject
public Set<ObjectInstance>
    queryMBeans(ObjectName name,
                MarshalledObject query,
                Subject delegationSubject)
    throws IOException {
    final QueryExp queryValue;
    final boolean debug=logger.debugOn();

    if (debug) logger.debug("queryMBeans",
             "connectionId=" + connectionId
             +" unwrapping query with defaultClassLoader.");

    queryValue = unwrap(query, defaultContextClassLoader, QueryExp.class, delegationSubject);

    try {
        final Object params[] = new Object[] { name, queryValue };

        if (debug) logger.debug("queryMBeans",
             "connectionId=" + connectionId
             +", name="+name +", query="+query);

        return cast(
            doPrivilegedOperation(
              QUERY_MBEANS,
              params,
              delegationSubject));
    } catch (PrivilegedActionException pe) {
        Exception e = extractException(pe);
        if (e instanceof IOException)
            throw (IOException) e;
        throw newIOException("Got unexpected server exception: " + e, e);
    }
}
项目:openjdk-jdk10    文件:ActivationGroupImpl.java   
ActiveEntry(Remote impl) throws ActivationException {
    this.impl =  impl;
    try {
        this.mobj = new MarshalledObject<Remote>(impl);
    } catch (IOException e) {
        throw new
            ActivationException("failed to marshal remote object", e);
    }
}
项目:OpenJSharp    文件:Activation.java   
public MarshalledObject<? extends Remote> activate(ActivationID id,
                                                   boolean force)
    throws ActivationException, UnknownObjectException, RemoteException
{
    checkShutdown();
    return getGroupEntry(id).activate(id, force);
}
项目:openjdk-jdk10    文件:RMIConnectionImpl.java   
private <T> T unwrap(final MarshalledObject<?> mo,
                            final ClassLoader cl1,
                            final ClassLoader cl2,
                            final Class<T> wrappedClass,
                            Subject delegationSubject)
    throws IOException {
    if (mo == null) {
        return null;
    }
    try {
        ClassLoader orderCL = AccessController.doPrivileged(
            new PrivilegedExceptionAction<ClassLoader>() {
                public ClassLoader run() throws Exception {
                    return new CombinedClassLoader(Thread.currentThread().getContextClassLoader(),
                            new OrderClassLoaders(cl1, cl2));
                }
            }
        );
        return unwrap(mo, orderCL, wrappedClass,delegationSubject);
    } catch (PrivilegedActionException pe) {
        Exception e = extractException(pe);
        if (e instanceof IOException) {
            throw (IOException) e;
        }
        if (e instanceof ClassNotFoundException) {
            throw new UnmarshalException(e.toString(), e);
        }
        logger.warning("unwrap", "Failed to unmarshall object: " + e);
        logger.debug("unwrap", e);
    }
    return null;
}
项目:jdk8u-jdk    文件:RMIConnector.java   
public void addNotificationListener(ObjectName name,
        ObjectName listener,
        NotificationFilter filter,
        Object handback)
        throws InstanceNotFoundException,
        IOException {

    if (logger.debugOn())
        logger.debug("addNotificationListener" +
                "(ObjectName,ObjectName,NotificationFilter,Object)",
                "name=" + name + ", listener=" + listener
                + ", filter=" + filter + ", handback=" + handback);

    final MarshalledObject<NotificationFilter> sFilter =
            new MarshalledObject<NotificationFilter>(filter);
    final MarshalledObject<Object> sHandback =
            new MarshalledObject<Object>(handback);
    final ClassLoader old = pushDefaultClassLoader();
    try {
        connection.addNotificationListener(name,
                listener,
                sFilter,
                sHandback,
                delegationSubject);
    } catch (IOException ioe) {
        communicatorAdmin.gotIOException(ioe);

        connection.addNotificationListener(name,
                listener,
                sFilter,
                sHandback,
                delegationSubject);
    } finally {
        popDefaultClassLoader(old);
    }
}
项目:jdk8u-jdk    文件:MOFilterTest.java   
/**
 * Test that MarshalledObject inherits the ObjectInputFilter from
 * the stream it was deserialized from.
 */
@Test(dataProvider="FilterCases")
static void delegatesToMO(boolean withFilter) {
    try {
        Serializable testobj = Integer.valueOf(5);
        MarshalledObject<Serializable> mo = new MarshalledObject<>(testobj);
        Assert.assertEquals(mo.get(), testobj, "MarshalledObject.get returned a non-equals test object");

        byte[] bytes = writeObjects(mo);

        try (ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
             ObjectInputStream ois = new ObjectInputStream(bais)) {

            CountingFilter filter1 = new CountingFilter();
            ObjectInputFilter.Config.setObjectInputFilter(ois, withFilter ? filter1 : null);
            MarshalledObject<?> actualMO = (MarshalledObject<?>)ois.readObject();
            int count = filter1.getCount();

            actualMO.get();
            int expectedCount = withFilter ? count + 2 : count;
            int actualCount = filter1.getCount();
            Assert.assertEquals(actualCount, expectedCount, "filter called wrong number of times during get()");
        }
    } catch (IOException ioe) {
        Assert.fail("Unexpected IOException", ioe);
    } catch (ClassNotFoundException cnf) {
        Assert.fail("Deserializing", cnf);
    }
}
项目:openjdk-jdk10    文件:RMIConnector.java   
protected Integer addListenerForMBeanRemovedNotif()
throws IOException, InstanceNotFoundException {
    NotificationFilterSupport clientFilter =
            new NotificationFilterSupport();
    clientFilter.enableType(
            MBeanServerNotification.UNREGISTRATION_NOTIFICATION);
    MarshalledObject<NotificationFilter> sFilter =
        new MarshalledObject<NotificationFilter>(clientFilter);

    Integer[] listenerIDs;
    final ObjectName[] names =
        new ObjectName[] {MBeanServerDelegate.DELEGATE_NAME};
    final MarshalledObject<NotificationFilter>[] filters =
        Util.cast(new MarshalledObject<?>[] {sFilter});
    final Subject[] subjects = new Subject[] {null};
    try {
        listenerIDs =
                connection.addNotificationListeners(names,
                filters,
                subjects);

    } catch (IOException ioe) {
        communicatorAdmin.gotIOException(ioe);

        listenerIDs =
                connection.addNotificationListeners(names,
                filters,
                subjects);
    }
    return listenerIDs[0];
}
项目:OpenJSharp    文件:RMIConnectionImpl.java   
@SuppressWarnings("rawtypes")  // MarshalledObject
public Set<ObjectInstance>
    queryMBeans(ObjectName name,
                MarshalledObject query,
                Subject delegationSubject)
    throws IOException {
    final QueryExp queryValue;
    final boolean debug=logger.debugOn();

    if (debug) logger.debug("queryMBeans",
             "connectionId=" + connectionId
             +" unwrapping query with defaultClassLoader.");

    queryValue = unwrap(query, defaultContextClassLoader, QueryExp.class);

    try {
        final Object params[] = new Object[] { name, queryValue };

        if (debug) logger.debug("queryMBeans",
             "connectionId=" + connectionId
             +", name="+name +", query="+query);

        return cast(
            doPrivilegedOperation(
              QUERY_MBEANS,
              params,
              delegationSubject));
    } catch (PrivilegedActionException pe) {
        Exception e = extractException(pe);
        if (e instanceof IOException)
            throw (IOException) e;
        throw newIOException("Got unexpected server exception: " + e, e);
    }
}
项目:openjdk-jdk10    文件:RMIConnector.java   
public ObjectInstance createMBean(String className,
        ObjectName name,
        Object params[],
        String signature[])
        throws ReflectionException,
        InstanceAlreadyExistsException,
        MBeanRegistrationException,
        MBeanException,
        NotCompliantMBeanException,
        IOException {
    if (logger.debugOn())
        logger.debug("createMBean(String,ObjectName,Object[],String[])",
                "className=" + className + ", name="
                + name + ", signature=" + strings(signature));

    final MarshalledObject<Object[]> sParams =
            new MarshalledObject<Object[]>(params);
    final ClassLoader old = pushDefaultClassLoader();
    try {
        return connection.createMBean(className,
                name,
                sParams,
                signature,
                delegationSubject);
    } catch (IOException ioe) {
        communicatorAdmin.gotIOException(ioe);

        return connection.createMBean(className,
                name,
                sParams,
                signature,
                delegationSubject);
    } finally {
        popDefaultClassLoader(old);
    }
}
项目:OpenJSharp    文件:RMIConnectionImpl.java   
private static <T> T unwrap(final MarshalledObject<?> mo,
                            final ClassLoader cl1,
                            final ClassLoader cl2,
                            final Class<T> wrappedClass)
    throws IOException {
    if (mo == null) {
        return null;
    }
    try {
        ClassLoader orderCL = AccessController.doPrivileged(
            new PrivilegedExceptionAction<ClassLoader>() {
                public ClassLoader run() throws Exception {
                    return new CombinedClassLoader(Thread.currentThread().getContextClassLoader(),
                            new OrderClassLoaders(cl1, cl2));
                }
            }
        );
        return unwrap(mo, orderCL, wrappedClass);
    } catch (PrivilegedActionException pe) {
        Exception e = extractException(pe);
        if (e instanceof IOException) {
            throw (IOException) e;
        }
        if (e instanceof ClassNotFoundException) {
            throw new UnmarshalException(e.toString(), e);
        }
        logger.warning("unwrap", "Failed to unmarshall object: " + e);
        logger.debug("unwrap", e);
    }
    return null;
}
项目:openjdk-jdk10    文件:DownloadActivationGroup.java   
public DownloadActivationGroup(ActivationID id, MarshalledObject mobj)
    throws ActivationException, RemoteException
{
    this.id = id;
    Activatable.exportObject(this, id, 0);
    System.err.println("object activated in group");
}
项目:openjdk-jdk10    文件:MarshalAfterUnexport2.java   
public static void main(String[] args) throws Exception {

        System.err.println("\nRegression test for bug 4513223\n");

        Remote impl2 = null;
        try {
            Remote impl = new MarshalAfterUnexport2();
            System.err.println(
                "created impl extending URO (with a UnicastServerRef2): " +
                impl);

            Receiver stub = (Receiver) RemoteObject.toStub(impl);
            System.err.println("stub for impl: " + stub);

            UnicastRemoteObject.unexportObject(impl, true);
            System.err.println("unexported impl");

            impl2 = new MarshalAfterUnexport2();
            Receiver stub2 = (Receiver) RemoteObject.toStub(impl2);

            System.err.println("marshalling unexported object:");
            MarshalledObject mobj = new MarshalledObject(impl);

            System.err.println("passing unexported object via RMI-JRMP:");
            stub2.receive(stub);

            System.err.println("TEST PASSED");
        } finally {
            if (impl2 != null) {
                try {
                    UnicastRemoteObject.unexportObject(impl2, true);
                } catch (Throwable t) {
                }
            }
        }
    }
项目:OpenJSharp    文件:RMIConnector.java   
public void addNotificationListener(ObjectName name,
        ObjectName listener,
        NotificationFilter filter,
        Object handback)
        throws InstanceNotFoundException,
        IOException {

    if (logger.debugOn())
        logger.debug("addNotificationListener" +
                "(ObjectName,ObjectName,NotificationFilter,Object)",
                "name=" + name + ", listener=" + listener
                + ", filter=" + filter + ", handback=" + handback);

    final MarshalledObject<NotificationFilter> sFilter =
            new MarshalledObject<NotificationFilter>(filter);
    final MarshalledObject<Object> sHandback =
            new MarshalledObject<Object>(handback);
    final ClassLoader old = pushDefaultClassLoader();
    try {
        connection.addNotificationListener(name,
                listener,
                sFilter,
                sHandback,
                delegationSubject);
    } catch (IOException ioe) {
        communicatorAdmin.gotIOException(ioe);

        connection.addNotificationListener(name,
                listener,
                sFilter,
                sHandback,
                delegationSubject);
    } finally {
        popDefaultClassLoader(old);
    }
}
项目:openjdk-jdk10    文件:RMIConnector.java   
public AttributeList setAttributes(ObjectName name,
        AttributeList attributes)
        throws InstanceNotFoundException,
        ReflectionException,
        IOException {

    if (logger.debugOn()) {
        logger.debug("setAttributes",
            "name=" + name + ", attribute names="
            + getAttributesNames(attributes));
    }

    final MarshalledObject<AttributeList> sAttributes =
            new MarshalledObject<AttributeList>(attributes);
    final ClassLoader old = pushDefaultClassLoader();
    try {
        return connection.setAttributes(name,
                sAttributes,
                delegationSubject);
    } catch (IOException ioe) {
        communicatorAdmin.gotIOException(ioe);

        return connection.setAttributes(name,
                sAttributes,
                delegationSubject);
    } finally {
        popDefaultClassLoader(old);
    }
}
项目:OpenJSharp    文件:RMIConnector.java   
protected Integer addListenerForMBeanRemovedNotif()
throws IOException, InstanceNotFoundException {
    NotificationFilterSupport clientFilter =
            new NotificationFilterSupport();
    clientFilter.enableType(
            MBeanServerNotification.UNREGISTRATION_NOTIFICATION);
    MarshalledObject<NotificationFilter> sFilter =
        new MarshalledObject<NotificationFilter>(clientFilter);

    Integer[] listenerIDs;
    final ObjectName[] names =
        new ObjectName[] {MBeanServerDelegate.DELEGATE_NAME};
    final MarshalledObject<NotificationFilter>[] filters =
        Util.cast(new MarshalledObject<?>[] {sFilter});
    final Subject[] subjects = new Subject[] {null};
    try {
        listenerIDs =
                connection.addNotificationListeners(names,
                filters,
                subjects);

    } catch (IOException ioe) {
        communicatorAdmin.gotIOException(ioe);

        listenerIDs =
                connection.addNotificationListeners(names,
                filters,
                subjects);
    }
    return listenerIDs[0];
}
项目:jdk8u-jdk    文件:RegistryFilterTest.java   
static XX createMarshalledObject() {
    try {
        return new XX(new MarshalledObject<>(null));
    } catch (IOException ioe) {
        return new XX(ioe);
    }
}
项目:jdk8u-jdk    文件:RMIConnector.java   
public void removeNotificationListener(ObjectName name,
        ObjectName listener,
        NotificationFilter filter,
        Object handback)
        throws InstanceNotFoundException,
        ListenerNotFoundException,
        IOException {
    if (logger.debugOn())
        logger.debug("removeNotificationListener" +
                "(ObjectName,ObjectName,NotificationFilter,Object)",
                "name=" + name
                + ", listener=" + listener
                + ", filter=" + filter
                + ", handback=" + handback);

    final MarshalledObject<NotificationFilter> sFilter =
            new MarshalledObject<NotificationFilter>(filter);
    final MarshalledObject<Object> sHandback =
            new MarshalledObject<Object>(handback);
    final ClassLoader old = pushDefaultClassLoader();
    try {
        connection.removeNotificationListener(name,
                listener,
                sFilter,
                sHandback,
                delegationSubject);
    } catch (IOException ioe) {
        communicatorAdmin.gotIOException(ioe);

        connection.removeNotificationListener(name,
                listener,
                sFilter,
                sHandback,
                delegationSubject);
    } finally {
        popDefaultClassLoader(old);
    }
}
项目:jdk8u-jdk    文件:Activation.java   
public MarshalledObject<? extends Remote> activate(ActivationID id,
                                                   boolean force)
    throws ActivationException, UnknownObjectException, RemoteException
{
    checkShutdown();
    return getGroupEntry(id).activate(id, force);
}
项目:openjdk-jdk10    文件:RMIConnector.java   
public void removeNotificationListener(ObjectName name,
        ObjectName listener,
        NotificationFilter filter,
        Object handback)
        throws InstanceNotFoundException,
        ListenerNotFoundException,
        IOException {
    if (logger.debugOn())
        logger.debug("removeNotificationListener" +
                "(ObjectName,ObjectName,NotificationFilter,Object)",
                "name=" + name
                + ", listener=" + listener
                + ", filter=" + filter
                + ", handback=" + handback);

    final MarshalledObject<NotificationFilter> sFilter =
            new MarshalledObject<NotificationFilter>(filter);
    final MarshalledObject<Object> sHandback =
            new MarshalledObject<Object>(handback);
    final ClassLoader old = pushDefaultClassLoader();
    try {
        connection.removeNotificationListener(name,
                listener,
                sFilter,
                sHandback,
                delegationSubject);
    } catch (IOException ioe) {
        communicatorAdmin.gotIOException(ioe);

        connection.removeNotificationListener(name,
                listener,
                sFilter,
                sHandback,
                delegationSubject);
    } finally {
        popDefaultClassLoader(old);
    }
}
项目:jdk8u-jdk    文件:Compare.java   
static MarshalledObject marshalledList(int length) throws Throwable {
    Node head = null;
    Node cur = null;
    for (int i = 0; i < length; i++) {
        if (head == null)
            cur = head = new Node();
        else
            cur = cur.next = new Node();
    }
    System.err.println("head = " + head);
    return new MarshalledObject(head);
}
项目:openjdk-jdk10    文件:RMIConnector.java   
public ObjectInstance createMBean(String className,
        ObjectName name,
        ObjectName loaderName,
        Object params[],
        String signature[])
        throws ReflectionException,
        InstanceAlreadyExistsException,
        MBeanRegistrationException,
        MBeanException,
        NotCompliantMBeanException,
        InstanceNotFoundException,
        IOException {
    if (logger.debugOn()) logger.debug(
            "createMBean(String,ObjectName,ObjectName,Object[],String[])",
            "className=" + className + ", name=" + name + ", loaderName="
            + loaderName + ", signature=" + strings(signature));

    final MarshalledObject<Object[]> sParams =
            new MarshalledObject<Object[]>(params);
    final ClassLoader old = pushDefaultClassLoader();
    try {
        return connection.createMBean(className,
                name,
                loaderName,
                sParams,
                signature,
                delegationSubject);
    } catch (IOException ioe) {
        communicatorAdmin.gotIOException(ioe);

        return connection.createMBean(className,
                name,
                loaderName,
                sParams,
                signature,
                delegationSubject);
    } finally {
        popDefaultClassLoader(old);
    }
}
项目:jdk8u-jdk    文件:RMIConnectionImpl.java   
@SuppressWarnings("rawtypes")  // MarshalledObject
public Set<ObjectName>
    queryNames(ObjectName name,
               MarshalledObject query,
               Subject delegationSubject)
    throws IOException {
    final QueryExp queryValue;
    final boolean debug=logger.debugOn();

    if (debug) logger.debug("queryNames",
             "connectionId=" + connectionId
             +" unwrapping query with defaultClassLoader.");

    queryValue = unwrap(query, defaultContextClassLoader, QueryExp.class, delegationSubject);

    try {
        final Object params[] = new Object[] { name, queryValue };

        if (debug) logger.debug("queryNames",
             "connectionId=" + connectionId
             +", name="+name +", query="+query);

        return cast(
            doPrivilegedOperation(
              QUERY_NAMES,
              params,
              delegationSubject));
    } catch (PrivilegedActionException pe) {
        Exception e = extractException(pe);
        if (e instanceof IOException)
            throw (IOException) e;
        throw newIOException("Got unexpected server exception: " + e, e);
    }
}
项目:jdk8u-jdk    文件:Compare.java   
static MarshalledObject setupObjects(String lengthStr, File file)
    throws Throwable
{
    int listLength = Integer.parseInt(lengthStr);
    made = marshalledList(listLength);
    ObjectInputStream in = new ObjectInputStream(new FileInputStream(file));
    read = (MarshalledObject) in.readObject();
    in.close();
    return read;
}
项目:jdk8u-jdk    文件:RMIConnector.java   
public ObjectInstance createMBean(String className,
        ObjectName name,
        Object params[],
        String signature[])
        throws ReflectionException,
        InstanceAlreadyExistsException,
        MBeanRegistrationException,
        MBeanException,
        NotCompliantMBeanException,
        IOException {
    if (logger.debugOn())
        logger.debug("createMBean(String,ObjectName,Object[],String[])",
                "className=" + className + ", name="
                + name + ", signature=" + strings(signature));

    final MarshalledObject<Object[]> sParams =
            new MarshalledObject<Object[]>(params);
    final ClassLoader old = pushDefaultClassLoader();
    try {
        return connection.createMBean(className,
                name,
                sParams,
                signature,
                delegationSubject);
    } catch (IOException ioe) {
        communicatorAdmin.gotIOException(ioe);

        return connection.createMBean(className,
                name,
                sParams,
                signature,
                delegationSubject);
    } finally {
        popDefaultClassLoader(old);
    }
}
项目:openjdk-jdk10    文件:Activation.java   
synchronized void activeObject(ActivationID id,
                               MarshalledObject<? extends Remote> mobj)
        throws UnknownObjectException
{
    getObjectEntry(id).stub = mobj;
}
项目:openjdk-jdk10    文件:RMIConnector.java   
private Integer[] addListenersWithSubjects(ObjectName[]       names,
                         MarshalledObject<NotificationFilter>[] filters,
                         Subject[]          delegationSubjects,
                         boolean            reconnect)
    throws InstanceNotFoundException, IOException {

    final boolean debug = logger.debugOn();
    if (debug)
        logger.debug("addListenersWithSubjects",
                "(ObjectName[],MarshalledObject[],Subject[])");

    final ClassLoader old = pushDefaultClassLoader();
    Integer[] listenerIDs = null;

    try {
        listenerIDs = connection.addNotificationListeners(names,
                filters,
                delegationSubjects);
    } catch (NoSuchObjectException noe) {
        // maybe reconnect
        if (reconnect) {
            communicatorAdmin.gotIOException(noe);

            listenerIDs = connection.addNotificationListeners(names,
                    filters,
                    delegationSubjects);
        } else {
            throw noe;
        }
    } catch (IOException ioe) {
        // send a failed notif if necessary
        communicatorAdmin.gotIOException(ioe);
    } finally {
        popDefaultClassLoader(old);
    }

    if (debug) logger.debug("addListenersWithSubjects","registered "
            + ((listenerIDs==null)?0:listenerIDs.length)
            + " listener(s)");
    return listenerIDs;
}
项目:OpenJSharp    文件:Activation.java   
synchronized void activeObject(ActivationID id,
                               MarshalledObject<? extends Remote> mobj)
        throws UnknownObjectException
{
    getObjectEntry(id).stub = mobj;
}