当前位置: 首页>>代码示例>>Java>>正文


Java MarshalledObject类代码示例

本文整理汇总了Java中java.rmi.MarshalledObject的典型用法代码示例。如果您正苦于以下问题:Java MarshalledObject类的具体用法?Java MarshalledObject怎么用?Java MarshalledObject使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MarshalledObject类属于java.rmi包,在下文中一共展示了MarshalledObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: activate

import java.rmi.MarshalledObject; //导入依赖的package包/类
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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:22,代码来源:Activation.java

示例2: ActivatableImpl

import java.rmi.MarshalledObject; //导入依赖的package包/类
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);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:19,代码来源:ActivatableImpl.java

示例3: addNotificationListener

import java.rmi.MarshalledObject; //导入依赖的package包/类
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);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:27,代码来源:RMIConnector.java

示例4: queryNames

import java.rmi.MarshalledObject; //导入依赖的package包/类
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);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:20,代码来源:RMIConnector.java

示例5: setAttribute

import java.rmi.MarshalledObject; //导入依赖的package包/类
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);
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:27,代码来源:RMIConnector.java

示例6: queryMBeans

import java.rmi.MarshalledObject; //导入依赖的package包/类
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);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:RMIConnector.java

示例7: ActivationGroupImpl

import java.rmi.MarshalledObject; //导入依赖的package包/类
/**
 * 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);
        }
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:31,代码来源:ActivationGroupImpl.java

示例8: checkHistory

import java.rmi.MarshalledObject; //导入依赖的package包/类
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));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:36,代码来源:TransformHistoryTest.java

示例9: main

import java.rmi.MarshalledObject; //导入依赖的package包/类
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();
        }
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:13,代码来源:PrimitiveClasses.java

示例10: queryMBeans

import java.rmi.MarshalledObject; //导入依赖的package包/类
@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);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:35,代码来源:RMIConnectionImpl.java

示例11: ActiveEntry

import java.rmi.MarshalledObject; //导入依赖的package包/类
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);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:10,代码来源:ActivationGroupImpl.java

示例12: unwrap

import java.rmi.MarshalledObject; //导入依赖的package包/类
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;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:33,代码来源:RMIConnectionImpl.java

示例13: delegatesToMO

import java.rmi.MarshalledObject; //导入依赖的package包/类
/**
 * 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);
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:33,代码来源:MOFilterTest.java

示例14: addListenerForMBeanRemovedNotif

import java.rmi.MarshalledObject; //导入依赖的package包/类
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];
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:32,代码来源:RMIConnector.java

示例15: queryMBeans

import java.rmi.MarshalledObject; //导入依赖的package包/类
@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);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:35,代码来源:RMIConnectionImpl.java


注:本文中的java.rmi.MarshalledObject类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。