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


Java RemoteStub类代码示例

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


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

示例1: unexportObject

import java.rmi.server.RemoteStub; //导入依赖的package包/类
/**
 * Deregisters a server object from the runtime, allowing the object to become
 * available for garbage collection.
 * @param obj the object to unexport.
 * @exception NoSuchObjectException if the remote object is not
 * currently exported.
 */
public void unexportObject(Remote obj)
    throws NoSuchObjectException {

    if (obj == null) {
        throw new NullPointerException("invalid argument");
    }

    if (StubAdapter.isStub(obj) ||
        obj instanceof java.rmi.server.RemoteStub) {
        throw new NoSuchObjectException(
            "Can only unexport a server object.");
    }

    Tie theTie = Util.getTie(obj);
    if (theTie != null) {
        Util.unexportObject(obj);
    } else {
        if (Utility.loadTie(obj) == null) {
            UnicastRemoteObject.unexportObject(obj,true);
        } else {
            throw new NoSuchObjectException("Object not exported.");
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:32,代码来源:PortableRemoteObject.java

示例2: exportObject

import java.rmi.server.RemoteStub; //导入依赖的package包/类
/**
 * Export this object, create the skeleton and stubs for this
 * dispatcher.  Create a stub based on the type of the impl,
 * initialize it with the appropriate remote reference. Create the
 * target defined by the impl, dispatcher (this) and stub.
 * Export that target via the Ref.
 */
public Remote exportObject(Remote impl, Object data,
                           boolean permanent)
    throws RemoteException
{
    Class<?> implClass = impl.getClass();
    Remote stub;

    try {
        stub = Util.createProxy(implClass, getClientRef(), forceStubUse);
    } catch (IllegalArgumentException e) {
        throw new ExportException(
            "remote object implements illegal remote interface", e);
    }
    if (stub instanceof RemoteStub) {
        setSkeleton(impl);
    }

    Target target =
        new Target(impl, this, stub, ref.getObjID(), permanent);
    ref.exportObject(target);
    hashToMethod_Map = hashToMethod_Maps.get(implClass);
    return stub;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:31,代码来源:UnicastServerRef.java

示例3: exportObject

import java.rmi.server.RemoteStub; //导入依赖的package包/类
/**
 * Export this object, create the skeleton and stubs for this
 * dispatcher.  Create a stub based on the type of the impl,
 * initialize it with the appropriate remote reference. Create the
 * target defined by the impl, dispatcher (this) and stub.
 * Export that target via the Ref.
 */
public Remote exportObject(Remote impl, Object data,
                           boolean permanent)
    throws RemoteException
{
    Class implClass = impl.getClass();
    Remote stub;

    try {
        stub = Util.createProxy(implClass, getClientRef(), forceStubUse);
    } catch (IllegalArgumentException e) {
        throw new ExportException(
            "remote object implements illegal remote interface", e);
    }
    if (stub instanceof RemoteStub) {
        setSkeleton(impl);
    }

    Target target =
        new Target(impl, this, stub, ref.getObjID(), permanent);
    ref.exportObject(target);
    hashToMethod_Map = hashToMethod_Maps.get(implClass);
    return stub;
}
 
开发者ID:openjdk,项目名称:jdk7-jdk,代码行数:31,代码来源:UnicastServerRef.java

示例4: getStub

import java.rmi.server.RemoteStub; //导入依赖的package包/类
/**
 * Returns the Remote Stub for the given activatable class.
 */
public static RemoteStub getStub(ActivationDesc desc, ActivationID aid)
        throws StubNotFoundException {

    String cn = desc.getClassName();
    String stubName = ""; //$NON-NLS-1$

    try {
        Class cl = RMIClassLoader.loadClass(desc.getLocation(), cn);
        Class rcl = RMIUtil.getRemoteClass(cl);
        stubName = rcl.getName() + "_Stub"; //$NON-NLS-1$
        Class stubClass = RMIClassLoader.loadClass((String) null, stubName);
        Constructor constructor = stubClass.getConstructor(new Class[] { RemoteRef.class });
        RemoteStub stub = (RemoteStub) constructor.newInstance(new Object[] {
                new ActivatableRef(aid, null)
        });
        return stub;

    } catch (Exception ex) {
        // rmi.68=Stub {0} not found.
        throw new StubNotFoundException(Messages.getString("rmi.68", stubName), //$NON-NLS-1$ //$NON-NLS-2$
                ex);
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:27,代码来源:ActivatableRef.java

示例5: replaceObject

import java.rmi.server.RemoteStub; //导入依赖的package包/类
/**
 * Returns a stub if the object to be serialized is a
 * {@link java.rmi.Remote} instance.
 * 
 * @param obj
 *            the object to be replaced if needed be.
 * @return if the argument was a {@link java.rmi.Remote} object locally
 *         exported a stub for that object is returned, in case it is not a
 *         {@link java.rmi.Remote} the object is returned
 * @throws IOException
 *             if the I/O operation fails
 */
@Override
protected final Object replaceObject(Object obj) throws IOException {

    if (obj instanceof Remote) {
        RemoteReferenceManager rrm = RemoteReferenceManager
                .getRemoteReferenceManager();
        if (rrm.isExported((Remote) obj)) {
            writesRemote = true;
            return RemoteObject.toStub((Remote) obj);
        }
        if (obj instanceof RemoteStub) {
            writesRemote = true;
            return obj;
        }
        if (Proxy.isProxyClass(obj.getClass())) {
            InvocationHandler ih = Proxy.getInvocationHandler(obj);
            if (ih instanceof RemoteObjectInvocationHandler) {
                writesRemote = true;
            }
        }
    }
    return obj;
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:36,代码来源:RMIObjectOutputStream.java

示例6: replaceObject

import java.rmi.server.RemoteStub; //导入依赖的package包/类
/**
 * replaceObject is extended to check for instances of Remote
 * that need to be serialized as proxy objects.  RemoteProxy.getProxy
 * is called to check for and find the stub.
 */
@Override
protected Object replaceObject(Object obj) throws IOException {
    System.out.println(" */*/*/*/*/*/*/* /*/*/**//**/ Inside replaceObject /*/**/*//*/**//*/*/**//*/*");
    if ((obj instanceof Remote) && !(obj instanceof RemoteStub)) {
        System.out.println(" */*/*/*/*/*/*/* /*/*/**//**/ found a Remote object " + obj +
            " /*/**/*//*/**//*/*/**//*/*");
        Remote target = RemoteObject.toStub((Remote) obj);
        if (target != null) {
            return target;
        }
    }
    System.out
            .println(" */*/*/*/*/*/*/* /*/*/**//**/ Normal obj : " + obj + "/*/**/*//*/**//*/*/**//*/*");
    return obj;
}
 
开发者ID:mnip91,项目名称:proactive-component-monitoring,代码行数:21,代码来源:SecurityOutputStream.java

示例7: toStub

import java.rmi.server.RemoteStub; //导入依赖的package包/类
/**
 * Returns a stub for the given server object.
 * @param obj the server object for which a stub is required. Must either be a subclass
 * of PortableRemoteObject or have been previously the target of a call to
 * {@link #exportObject}.
 * @return the most derived stub for the object.
 * @exception NoSuchObjectException if a stub cannot be located for the given server object.
 */
public Remote toStub (Remote obj)
    throws NoSuchObjectException
{
    Remote result = null;
    if (obj == null) {
        throw new NullPointerException("invalid argument");
    }

    // If the class is already an IIOP stub then return it.
    if (StubAdapter.isStub( obj )) {
        return obj;
    }

    // If the class is already a JRMP stub then return it.
    if (obj instanceof java.rmi.server.RemoteStub) {
        return obj;
    }

    // Has it been exported to IIOP?
    Tie theTie = Util.getTie(obj);

    if (theTie != null) {
        result = Utility.loadStub(theTie,null,null,true);
    } else {
        if (Utility.loadTie(obj) == null) {
            result = java.rmi.server.RemoteObject.toStub(obj);
        }
    }

    if (result == null) {
        throw new NoSuchObjectException("object not exported");
    }

    return result;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:44,代码来源:PortableRemoteObject.java

示例8: replaceObject

import java.rmi.server.RemoteStub; //导入依赖的package包/类
/**
 * Checks for objects that are instances of java.rmi.Remote
 * that need to be serialized as proxy objects.
 */
protected final Object replaceObject(Object obj) throws IOException {
    if ((obj instanceof Remote) && !(obj instanceof RemoteStub)) {
        Target target = ObjectTable.getTarget((Remote) obj);
        if (target != null) {
            return target.getStub();
        }
    }
    return obj;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:14,代码来源:MarshalOutputStream.java

示例9: replaceObject

import java.rmi.server.RemoteStub; //导入依赖的package包/类
/**
 * Checks for objects that are instances of java.rmi.Remote
 * that need to be serialized as proxy objects.
 */
@SuppressWarnings("deprecation")
protected final Object replaceObject(Object obj) throws IOException {
    if ((obj instanceof Remote) && !(obj instanceof RemoteStub)) {
        Target target = ObjectTable.getTarget((Remote) obj);
        if (target != null) {
            return target.getStub();
        }
    }
    return obj;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:15,代码来源:MarshalOutputStream.java


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