Java Code Examples for java.rmi.server.RemoteStub
The following examples show how to use
java.rmi.server.RemoteStub. These examples are extracted from open source projects.
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 Project: jdk1.8-source-analysis Source File: PortableRemoteObject.java License: Apache License 2.0 | 6 votes |
/** * 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 2
Source Project: dragonwell8_jdk Source File: UnicastServerRef.java License: GNU General Public License v2.0 | 6 votes |
/** * 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 Project: TencentKona-8 Source File: PortableRemoteObject.java License: GNU General Public License v2.0 | 6 votes |
/** * 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 Project: TencentKona-8 Source File: UnicastServerRef.java License: GNU General Public License v2.0 | 6 votes |
/** * 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 Project: jdk8u60 Source File: PortableRemoteObject.java License: GNU General Public License v2.0 | 6 votes |
/** * 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 Project: jdk8u60 Source File: UnicastServerRef.java License: GNU General Public License v2.0 | 6 votes |
/** * 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 Project: JDKSourceCode1.8 Source File: PortableRemoteObject.java License: MIT License | 6 votes |
/** * 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 Project: openjdk-jdk8u Source File: PortableRemoteObject.java License: GNU General Public License v2.0 | 6 votes |
/** * 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 Project: openjdk-jdk8u Source File: UnicastServerRef.java License: GNU General Public License v2.0 | 6 votes |
/** * 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 Project: openjdk-jdk8u-backup Source File: PortableRemoteObject.java License: GNU General Public License v2.0 | 6 votes |
/** * 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 Project: openjdk-jdk8u-backup Source File: UnicastServerRef.java License: GNU General Public License v2.0 | 6 votes |
/** * 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 Project: openjdk-jdk9 Source File: PortableRemoteObject.java License: GNU General Public License v2.0 | 6 votes |
/** * 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 Project: openjdk-jdk9 Source File: UnicastServerRef.java License: GNU General Public License v2.0 | 6 votes |
/** * 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 Project: jdk8u-jdk Source File: UnicastServerRef.java License: GNU General Public License v2.0 | 6 votes |
/** * 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 15
Source Project: hottub Source File: PortableRemoteObject.java License: GNU General Public License v2.0 | 6 votes |
/** * 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 16
Source Project: hottub Source File: UnicastServerRef.java License: GNU General Public License v2.0 | 6 votes |
/** * 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 Project: openjdk-8-source Source File: PortableRemoteObject.java License: GNU General Public License v2.0 | 6 votes |
/** * 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 18
Source Project: openjdk-8-source Source File: UnicastServerRef.java License: GNU General Public License v2.0 | 6 votes |
/** * 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 19
Source Project: openjdk-8 Source File: PortableRemoteObject.java License: GNU General Public License v2.0 | 6 votes |
/** * 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 20
Source Project: openjdk-8 Source File: UnicastServerRef.java License: GNU General Public License v2.0 | 6 votes |
/** * 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 21
Source Project: jdk8u_jdk Source File: UnicastServerRef.java License: GNU General Public License v2.0 | 6 votes |
/** * 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 Project: jdk8u-jdk Source File: UnicastServerRef.java License: GNU General Public License v2.0 | 6 votes |
/** * 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 23
Source Project: jdk8u-dev-jdk Source File: UnicastServerRef.java License: GNU General Public License v2.0 | 6 votes |
/** * 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 Project: jdk1.8-source-analysis Source File: PortableRemoteObject.java License: Apache License 2.0 | 5 votes |
/** * 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 25
Source Project: dragonwell8_jdk Source File: MarshalOutputStream.java License: GNU General Public License v2.0 | 5 votes |
/** * 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 Project: TencentKona-8 Source File: PortableRemoteObject.java License: GNU General Public License v2.0 | 5 votes |
/** * 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 27
Source Project: TencentKona-8 Source File: MarshalOutputStream.java License: GNU General Public License v2.0 | 5 votes |
/** * 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 28
Source Project: jdk8u60 Source File: PortableRemoteObject.java License: GNU General Public License v2.0 | 5 votes |
/** * 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 29
Source Project: jdk8u60 Source File: MarshalOutputStream.java License: GNU General Public License v2.0 | 5 votes |
/** * 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 30
Source Project: JDKSourceCode1.8 Source File: PortableRemoteObject.java License: MIT License | 5 votes |
/** * 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; }