java.rmi.server.RemoteStub Java Examples

The following examples show how to use java.rmi.server.RemoteStub. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: UnicastServerRef.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #2
Source File: UnicastServerRef.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #3
Source File: PortableRemoteObject.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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.");
        }
    }
}
 
Example #4
Source File: UnicastServerRef.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #5
Source File: PortableRemoteObject.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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.");
        }
    }
}
 
Example #6
Source File: UnicastServerRef.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #7
Source File: PortableRemoteObject.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
 * 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.");
        }
    }
}
 
Example #8
Source File: PortableRemoteObject.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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.");
        }
    }
}
 
Example #9
Source File: UnicastServerRef.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #10
Source File: PortableRemoteObject.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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.");
        }
    }
}
 
Example #11
Source File: UnicastServerRef.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #12
Source File: PortableRemoteObject.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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.");
        }
    }
}
 
Example #13
Source File: UnicastServerRef.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #14
Source File: PortableRemoteObject.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * 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.");
        }
    }
}
 
Example #15
Source File: UnicastServerRef.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #16
Source File: UnicastServerRef.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #17
Source File: UnicastServerRef.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #18
Source File: PortableRemoteObject.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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.");
        }
    }
}
 
Example #19
Source File: UnicastServerRef.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #20
Source File: PortableRemoteObject.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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.");
        }
    }
}
 
Example #21
Source File: UnicastServerRef.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #22
Source File: PortableRemoteObject.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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.");
        }
    }
}
 
Example #23
Source File: UnicastServerRef.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #24
Source File: MarshalOutputStream.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example #25
Source File: MarshalOutputStream.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example #26
Source File: MarshalOutputStream.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example #27
Source File: PortableRemoteObject.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example #28
Source File: MarshalOutputStream.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example #29
Source File: PortableRemoteObject.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example #30
Source File: PortableRemoteObject.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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;
}