java.rmi.activation.Activatable Java Examples
The following examples show how to use
java.rmi.activation.Activatable.
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: ActivationGroupImpl.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
/** * The group's <code>inactiveObject</code> method is called * indirectly via a call to the <code>Activatable.inactive</code> * method. A remote object implementation must call * <code>Activatable</code>'s <code>inactive</code> method when * that object deactivates (the object deems that it is no longer * active). If the object does not call * <code>Activatable.inactive</code> when it deactivates, the * object will never be garbage collected since the group keeps * strong references to the objects it creates. <p> * * The group's <code>inactiveObject</code> method * unexports the remote object from the RMI runtime so that the * object can no longer receive incoming RMI calls. This call will * only succeed if the object has no pending/executing calls. If * the object does have pending/executing RMI calls, then false * will be returned. * * If the object has no pending/executing calls, the object is * removed from the RMI runtime and the group informs its * <code>ActivationMonitor</code> (via the monitor's * <code>inactiveObject</code> method) that the remote object is * not currently active so that the remote object will be * re-activated by the activator upon a subsequent activation * request. * * @param id the object's activation identifier * @returns true if the operation succeeds (the operation will * succeed if the object in currently known to be active and is * either already unexported or is currently exported and has no * pending/executing calls); false is returned if the object has * pending/executing calls in which case it cannot be deactivated * @exception UnknownObjectException if object is unknown (may already * be inactive) * @exception RemoteException if call informing monitor fails */ public boolean inactiveObject(ActivationID id) throws ActivationException, UnknownObjectException, RemoteException { try { acquireLock(id); synchronized (this) { if (groupInactive == true) throw new ActivationException("group is inactive"); } ActiveEntry entry = active.get(id); if (entry == null) { // REMIND: should this be silent? throw new UnknownObjectException("object not active"); } try { if (Activatable.unexportObject(entry.impl, false) == false) return false; } catch (NoSuchObjectException allowUnexportedObjects) { } try { super.inactiveObject(id); } catch (UnknownObjectException allowUnregisteredObjects) { } active.remove(id); } finally { releaseLock(id); checkInactiveGroup(); } return true; }
Example #2
Source File: ActivationGroupImpl.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * The group's <code>inactiveObject</code> method is called * indirectly via a call to the <code>Activatable.inactive</code> * method. A remote object implementation must call * <code>Activatable</code>'s <code>inactive</code> method when * that object deactivates (the object deems that it is no longer * active). If the object does not call * <code>Activatable.inactive</code> when it deactivates, the * object will never be garbage collected since the group keeps * strong references to the objects it creates. <p> * * The group's <code>inactiveObject</code> method * unexports the remote object from the RMI runtime so that the * object can no longer receive incoming RMI calls. This call will * only succeed if the object has no pending/executing calls. If * the object does have pending/executing RMI calls, then false * will be returned. * * If the object has no pending/executing calls, the object is * removed from the RMI runtime and the group informs its * <code>ActivationMonitor</code> (via the monitor's * <code>inactiveObject</code> method) that the remote object is * not currently active so that the remote object will be * re-activated by the activator upon a subsequent activation * request. * * @param id the object's activation identifier * @returns true if the operation succeeds (the operation will * succeed if the object in currently known to be active and is * either already unexported or is currently exported and has no * pending/executing calls); false is returned if the object has * pending/executing calls in which case it cannot be deactivated * @exception UnknownObjectException if object is unknown (may already * be inactive) * @exception RemoteException if call informing monitor fails */ public boolean inactiveObject(ActivationID id) throws ActivationException, UnknownObjectException, RemoteException { try { acquireLock(id); synchronized (this) { if (groupInactive == true) throw new ActivationException("group is inactive"); } ActiveEntry entry = active.get(id); if (entry == null) { // REMIND: should this be silent? throw new UnknownObjectException("object not active"); } try { if (Activatable.unexportObject(entry.impl, false) == false) return false; } catch (NoSuchObjectException allowUnexportedObjects) { } try { super.inactiveObject(id); } catch (UnknownObjectException allowUnregisteredObjects) { } active.remove(id); } finally { releaseLock(id); checkInactiveGroup(); } return true; }
Example #3
Source File: ActivationGroupImpl.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * The group's <code>inactiveObject</code> method is called * indirectly via a call to the <code>Activatable.inactive</code> * method. A remote object implementation must call * <code>Activatable</code>'s <code>inactive</code> method when * that object deactivates (the object deems that it is no longer * active). If the object does not call * <code>Activatable.inactive</code> when it deactivates, the * object will never be garbage collected since the group keeps * strong references to the objects it creates. <p> * * The group's <code>inactiveObject</code> method * unexports the remote object from the RMI runtime so that the * object can no longer receive incoming RMI calls. This call will * only succeed if the object has no pending/executing calls. If * the object does have pending/executing RMI calls, then false * will be returned. * * If the object has no pending/executing calls, the object is * removed from the RMI runtime and the group informs its * <code>ActivationMonitor</code> (via the monitor's * <code>inactiveObject</code> method) that the remote object is * not currently active so that the remote object will be * re-activated by the activator upon a subsequent activation * request. * * @param id the object's activation identifier * @returns true if the operation succeeds (the operation will * succeed if the object in currently known to be active and is * either already unexported or is currently exported and has no * pending/executing calls); false is returned if the object has * pending/executing calls in which case it cannot be deactivated * @exception UnknownObjectException if object is unknown (may already * be inactive) * @exception RemoteException if call informing monitor fails */ public boolean inactiveObject(ActivationID id) throws ActivationException, UnknownObjectException, RemoteException { try { acquireLock(id); synchronized (this) { if (groupInactive == true) throw new ActivationException("group is inactive"); } ActiveEntry entry = active.get(id); if (entry == null) { // REMIND: should this be silent? throw new UnknownObjectException("object not active"); } try { if (Activatable.unexportObject(entry.impl, false) == false) return false; } catch (NoSuchObjectException allowUnexportedObjects) { } try { super.inactiveObject(id); } catch (UnknownObjectException allowUnregisteredObjects) { } active.remove(id); } finally { releaseLock(id); checkInactiveGroup(); } return true; }
Example #4
Source File: ActivationGroupImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * The group's <code>inactiveObject</code> method is called * indirectly via a call to the <code>Activatable.inactive</code> * method. A remote object implementation must call * <code>Activatable</code>'s <code>inactive</code> method when * that object deactivates (the object deems that it is no longer * active). If the object does not call * <code>Activatable.inactive</code> when it deactivates, the * object will never be garbage collected since the group keeps * strong references to the objects it creates. <p> * * The group's <code>inactiveObject</code> method * unexports the remote object from the RMI runtime so that the * object can no longer receive incoming RMI calls. This call will * only succeed if the object has no pending/executing calls. If * the object does have pending/executing RMI calls, then false * will be returned. * * If the object has no pending/executing calls, the object is * removed from the RMI runtime and the group informs its * <code>ActivationMonitor</code> (via the monitor's * <code>inactiveObject</code> method) that the remote object is * not currently active so that the remote object will be * re-activated by the activator upon a subsequent activation * request. * * @param id the object's activation identifier * @returns true if the operation succeeds (the operation will * succeed if the object in currently known to be active and is * either already unexported or is currently exported and has no * pending/executing calls); false is returned if the object has * pending/executing calls in which case it cannot be deactivated * @exception UnknownObjectException if object is unknown (may already * be inactive) * @exception RemoteException if call informing monitor fails */ public boolean inactiveObject(ActivationID id) throws ActivationException, UnknownObjectException, RemoteException { try { acquireLock(id); synchronized (this) { if (groupInactive == true) throw new ActivationException("group is inactive"); } ActiveEntry entry = active.get(id); if (entry == null) { // REMIND: should this be silent? throw new UnknownObjectException("object not active"); } try { if (Activatable.unexportObject(entry.impl, false) == false) return false; } catch (NoSuchObjectException allowUnexportedObjects) { } try { super.inactiveObject(id); } catch (UnknownObjectException allowUnregisteredObjects) { } active.remove(id); } finally { releaseLock(id); checkInactiveGroup(); } return true; }
Example #5
Source File: ActivationGroupImpl.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * The group's <code>inactiveObject</code> method is called * indirectly via a call to the <code>Activatable.inactive</code> * method. A remote object implementation must call * <code>Activatable</code>'s <code>inactive</code> method when * that object deactivates (the object deems that it is no longer * active). If the object does not call * <code>Activatable.inactive</code> when it deactivates, the * object will never be garbage collected since the group keeps * strong references to the objects it creates. <p> * * The group's <code>inactiveObject</code> method * unexports the remote object from the RMI runtime so that the * object can no longer receive incoming RMI calls. This call will * only succeed if the object has no pending/executing calls. If * the object does have pending/executing RMI calls, then false * will be returned. * * If the object has no pending/executing calls, the object is * removed from the RMI runtime and the group informs its * <code>ActivationMonitor</code> (via the monitor's * <code>inactiveObject</code> method) that the remote object is * not currently active so that the remote object will be * re-activated by the activator upon a subsequent activation * request. * * @param id the object's activation identifier * @returns true if the operation succeeds (the operation will * succeed if the object in currently known to be active and is * either already unexported or is currently exported and has no * pending/executing calls); false is returned if the object has * pending/executing calls in which case it cannot be deactivated * @exception UnknownObjectException if object is unknown (may already * be inactive) * @exception RemoteException if call informing monitor fails */ public boolean inactiveObject(ActivationID id) throws ActivationException, UnknownObjectException, RemoteException { try { acquireLock(id); synchronized (this) { if (groupInactive == true) throw new ActivationException("group is inactive"); } ActiveEntry entry = active.get(id); if (entry == null) { // REMIND: should this be silent? throw new UnknownObjectException("object not active"); } try { if (Activatable.unexportObject(entry.impl, false) == false) return false; } catch (NoSuchObjectException allowUnexportedObjects) { } try { super.inactiveObject(id); } catch (UnknownObjectException allowUnregisteredObjects) { } active.remove(id); } finally { releaseLock(id); checkInactiveGroup(); } return true; }
Example #6
Source File: ActivationGroupImpl.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * The group's <code>inactiveObject</code> method is called * indirectly via a call to the <code>Activatable.inactive</code> * method. A remote object implementation must call * <code>Activatable</code>'s <code>inactive</code> method when * that object deactivates (the object deems that it is no longer * active). If the object does not call * <code>Activatable.inactive</code> when it deactivates, the * object will never be garbage collected since the group keeps * strong references to the objects it creates. <p> * * The group's <code>inactiveObject</code> method * unexports the remote object from the RMI runtime so that the * object can no longer receive incoming RMI calls. This call will * only succeed if the object has no pending/executing calls. If * the object does have pending/executing RMI calls, then false * will be returned. * * If the object has no pending/executing calls, the object is * removed from the RMI runtime and the group informs its * <code>ActivationMonitor</code> (via the monitor's * <code>inactiveObject</code> method) that the remote object is * not currently active so that the remote object will be * re-activated by the activator upon a subsequent activation * request. * * @param id the object's activation identifier * @return true if the operation succeeds (the operation will * succeed if the object in currently known to be active and is * either already unexported or is currently exported and has no * pending/executing calls); false is returned if the object has * pending/executing calls in which case it cannot be deactivated * @exception UnknownObjectException if object is unknown (may already * be inactive) * @exception RemoteException if call informing monitor fails */ public boolean inactiveObject(ActivationID id) throws ActivationException, UnknownObjectException, RemoteException { try { acquireLock(id); synchronized (this) { if (groupInactive == true) throw new ActivationException("group is inactive"); } ActiveEntry entry = active.get(id); if (entry == null) { // REMIND: should this be silent? throw new UnknownObjectException("object not active"); } try { if (Activatable.unexportObject(entry.impl, false) == false) return false; } catch (NoSuchObjectException allowUnexportedObjects) { } try { super.inactiveObject(id); } catch (UnknownObjectException allowUnregisteredObjects) { } active.remove(id); } finally { releaseLock(id); checkInactiveGroup(); } return true; }
Example #7
Source File: DownloadActivationGroup.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public DownloadActivationGroup(ActivationID id, MarshalledObject mobj) throws ActivationException, RemoteException { this.id = id; Activatable.exportObject(this, id, 0); System.err.println("object activated in group"); }
Example #8
Source File: ActivationGroupImpl.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * The group's <code>inactiveObject</code> method is called * indirectly via a call to the <code>Activatable.inactive</code> * method. A remote object implementation must call * <code>Activatable</code>'s <code>inactive</code> method when * that object deactivates (the object deems that it is no longer * active). If the object does not call * <code>Activatable.inactive</code> when it deactivates, the * object will never be garbage collected since the group keeps * strong references to the objects it creates. <p> * * The group's <code>inactiveObject</code> method * unexports the remote object from the RMI runtime so that the * object can no longer receive incoming RMI calls. This call will * only succeed if the object has no pending/executing calls. If * the object does have pending/executing RMI calls, then false * will be returned. * * If the object has no pending/executing calls, the object is * removed from the RMI runtime and the group informs its * <code>ActivationMonitor</code> (via the monitor's * <code>inactiveObject</code> method) that the remote object is * not currently active so that the remote object will be * re-activated by the activator upon a subsequent activation * request. * * @param id the object's activation identifier * @returns true if the operation succeeds (the operation will * succeed if the object in currently known to be active and is * either already unexported or is currently exported and has no * pending/executing calls); false is returned if the object has * pending/executing calls in which case it cannot be deactivated * @exception UnknownObjectException if object is unknown (may already * be inactive) * @exception RemoteException if call informing monitor fails */ public boolean inactiveObject(ActivationID id) throws ActivationException, UnknownObjectException, RemoteException { try { acquireLock(id); synchronized (this) { if (groupInactive == true) throw new ActivationException("group is inactive"); } ActiveEntry entry = active.get(id); if (entry == null) { // REMIND: should this be silent? throw new UnknownObjectException("object not active"); } try { if (Activatable.unexportObject(entry.impl, false) == false) return false; } catch (NoSuchObjectException allowUnexportedObjects) { } try { super.inactiveObject(id); } catch (UnknownObjectException allowUnregisteredObjects) { } active.remove(id); } finally { releaseLock(id); checkInactiveGroup(); } return true; }
Example #9
Source File: ActivationGroupImpl.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * The group's <code>inactiveObject</code> method is called * indirectly via a call to the <code>Activatable.inactive</code> * method. A remote object implementation must call * <code>Activatable</code>'s <code>inactive</code> method when * that object deactivates (the object deems that it is no longer * active). If the object does not call * <code>Activatable.inactive</code> when it deactivates, the * object will never be garbage collected since the group keeps * strong references to the objects it creates. <p> * * The group's <code>inactiveObject</code> method * unexports the remote object from the RMI runtime so that the * object can no longer receive incoming RMI calls. This call will * only succeed if the object has no pending/executing calls. If * the object does have pending/executing RMI calls, then false * will be returned. * * If the object has no pending/executing calls, the object is * removed from the RMI runtime and the group informs its * <code>ActivationMonitor</code> (via the monitor's * <code>inactiveObject</code> method) that the remote object is * not currently active so that the remote object will be * re-activated by the activator upon a subsequent activation * request. * * @param id the object's activation identifier * @returns true if the operation succeeds (the operation will * succeed if the object in currently known to be active and is * either already unexported or is currently exported and has no * pending/executing calls); false is returned if the object has * pending/executing calls in which case it cannot be deactivated * @exception UnknownObjectException if object is unknown (may already * be inactive) * @exception RemoteException if call informing monitor fails */ public boolean inactiveObject(ActivationID id) throws ActivationException, UnknownObjectException, RemoteException { try { acquireLock(id); synchronized (this) { if (groupInactive == true) throw new ActivationException("group is inactive"); } ActiveEntry entry = active.get(id); if (entry == null) { // REMIND: should this be silent? throw new UnknownObjectException("object not active"); } try { if (Activatable.unexportObject(entry.impl, false) == false) return false; } catch (NoSuchObjectException allowUnexportedObjects) { } try { super.inactiveObject(id); } catch (UnknownObjectException allowUnregisteredObjects) { } active.remove(id); } finally { releaseLock(id); checkInactiveGroup(); } return true; }
Example #10
Source File: ActivationGroupImpl.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * The group's <code>inactiveObject</code> method is called * indirectly via a call to the <code>Activatable.inactive</code> * method. A remote object implementation must call * <code>Activatable</code>'s <code>inactive</code> method when * that object deactivates (the object deems that it is no longer * active). If the object does not call * <code>Activatable.inactive</code> when it deactivates, the * object will never be garbage collected since the group keeps * strong references to the objects it creates. <p> * * The group's <code>inactiveObject</code> method * unexports the remote object from the RMI runtime so that the * object can no longer receive incoming RMI calls. This call will * only succeed if the object has no pending/executing calls. If * the object does have pending/executing RMI calls, then false * will be returned. * * If the object has no pending/executing calls, the object is * removed from the RMI runtime and the group informs its * <code>ActivationMonitor</code> (via the monitor's * <code>inactiveObject</code> method) that the remote object is * not currently active so that the remote object will be * re-activated by the activator upon a subsequent activation * request. * * @param id the object's activation identifier * @returns true if the operation succeeds (the operation will * succeed if the object in currently known to be active and is * either already unexported or is currently exported and has no * pending/executing calls); false is returned if the object has * pending/executing calls in which case it cannot be deactivated * @exception UnknownObjectException if object is unknown (may already * be inactive) * @exception RemoteException if call informing monitor fails */ public boolean inactiveObject(ActivationID id) throws ActivationException, UnknownObjectException, RemoteException { try { acquireLock(id); synchronized (this) { if (groupInactive == true) throw new ActivationException("group is inactive"); } ActiveEntry entry = active.get(id); if (entry == null) { // REMIND: should this be silent? throw new UnknownObjectException("object not active"); } try { if (Activatable.unexportObject(entry.impl, false) == false) return false; } catch (NoSuchObjectException allowUnexportedObjects) { } try { super.inactiveObject(id); } catch (UnknownObjectException allowUnregisteredObjects) { } active.remove(id); } finally { releaseLock(id); checkInactiveGroup(); } return true; }
Example #11
Source File: ActivationGroupImpl.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * The group's <code>inactiveObject</code> method is called * indirectly via a call to the <code>Activatable.inactive</code> * method. A remote object implementation must call * <code>Activatable</code>'s <code>inactive</code> method when * that object deactivates (the object deems that it is no longer * active). If the object does not call * <code>Activatable.inactive</code> when it deactivates, the * object will never be garbage collected since the group keeps * strong references to the objects it creates. <p> * * The group's <code>inactiveObject</code> method * unexports the remote object from the RMI runtime so that the * object can no longer receive incoming RMI calls. This call will * only succeed if the object has no pending/executing calls. If * the object does have pending/executing RMI calls, then false * will be returned. * * If the object has no pending/executing calls, the object is * removed from the RMI runtime and the group informs its * <code>ActivationMonitor</code> (via the monitor's * <code>inactiveObject</code> method) that the remote object is * not currently active so that the remote object will be * re-activated by the activator upon a subsequent activation * request. * * @param id the object's activation identifier * @returns true if the operation succeeds (the operation will * succeed if the object in currently known to be active and is * either already unexported or is currently exported and has no * pending/executing calls); false is returned if the object has * pending/executing calls in which case it cannot be deactivated * @exception UnknownObjectException if object is unknown (may already * be inactive) * @exception RemoteException if call informing monitor fails */ public boolean inactiveObject(ActivationID id) throws ActivationException, UnknownObjectException, RemoteException { try { acquireLock(id); synchronized (this) { if (groupInactive == true) throw new ActivationException("group is inactive"); } ActiveEntry entry = active.get(id); if (entry == null) { // REMIND: should this be silent? throw new UnknownObjectException("object not active"); } try { if (Activatable.unexportObject(entry.impl, false) == false) return false; } catch (NoSuchObjectException allowUnexportedObjects) { } try { super.inactiveObject(id); } catch (UnknownObjectException allowUnregisteredObjects) { } active.remove(id); } finally { releaseLock(id); checkInactiveGroup(); } return true; }
Example #12
Source File: ActivationGroupImpl.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
/** * The group's <code>inactiveObject</code> method is called * indirectly via a call to the <code>Activatable.inactive</code> * method. A remote object implementation must call * <code>Activatable</code>'s <code>inactive</code> method when * that object deactivates (the object deems that it is no longer * active). If the object does not call * <code>Activatable.inactive</code> when it deactivates, the * object will never be garbage collected since the group keeps * strong references to the objects it creates. <p> * * The group's <code>inactiveObject</code> method * unexports the remote object from the RMI runtime so that the * object can no longer receive incoming RMI calls. This call will * only succeed if the object has no pending/executing calls. If * the object does have pending/executing RMI calls, then false * will be returned. * * If the object has no pending/executing calls, the object is * removed from the RMI runtime and the group informs its * <code>ActivationMonitor</code> (via the monitor's * <code>inactiveObject</code> method) that the remote object is * not currently active so that the remote object will be * re-activated by the activator upon a subsequent activation * request. * * @param id the object's activation identifier * @returns true if the operation succeeds (the operation will * succeed if the object in currently known to be active and is * either already unexported or is currently exported and has no * pending/executing calls); false is returned if the object has * pending/executing calls in which case it cannot be deactivated * @exception UnknownObjectException if object is unknown (may already * be inactive) * @exception RemoteException if call informing monitor fails */ public boolean inactiveObject(ActivationID id) throws ActivationException, UnknownObjectException, RemoteException { try { acquireLock(id); synchronized (this) { if (groupInactive == true) throw new ActivationException("group is inactive"); } ActiveEntry entry = active.get(id); if (entry == null) { // REMIND: should this be silent? throw new UnknownObjectException("object not active"); } try { if (Activatable.unexportObject(entry.impl, false) == false) return false; } catch (NoSuchObjectException allowUnexportedObjects) { } try { super.inactiveObject(id); } catch (UnknownObjectException allowUnregisteredObjects) { } active.remove(id); } finally { releaseLock(id); checkInactiveGroup(); } return true; }
Example #13
Source File: ActivationGroupImpl.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * The group's <code>inactiveObject</code> method is called * indirectly via a call to the <code>Activatable.inactive</code> * method. A remote object implementation must call * <code>Activatable</code>'s <code>inactive</code> method when * that object deactivates (the object deems that it is no longer * active). If the object does not call * <code>Activatable.inactive</code> when it deactivates, the * object will never be garbage collected since the group keeps * strong references to the objects it creates. <p> * * The group's <code>inactiveObject</code> method * unexports the remote object from the RMI runtime so that the * object can no longer receive incoming RMI calls. This call will * only succeed if the object has no pending/executing calls. If * the object does have pending/executing RMI calls, then false * will be returned. * * If the object has no pending/executing calls, the object is * removed from the RMI runtime and the group informs its * <code>ActivationMonitor</code> (via the monitor's * <code>inactiveObject</code> method) that the remote object is * not currently active so that the remote object will be * re-activated by the activator upon a subsequent activation * request. * * @param id the object's activation identifier * @returns true if the operation succeeds (the operation will * succeed if the object in currently known to be active and is * either already unexported or is currently exported and has no * pending/executing calls); false is returned if the object has * pending/executing calls in which case it cannot be deactivated * @exception UnknownObjectException if object is unknown (may already * be inactive) * @exception RemoteException if call informing monitor fails */ public boolean inactiveObject(ActivationID id) throws ActivationException, UnknownObjectException, RemoteException { try { acquireLock(id); synchronized (this) { if (groupInactive == true) throw new ActivationException("group is inactive"); } ActiveEntry entry = active.get(id); if (entry == null) { // REMIND: should this be silent? throw new UnknownObjectException("object not active"); } try { if (Activatable.unexportObject(entry.impl, false) == false) return false; } catch (NoSuchObjectException allowUnexportedObjects) { } try { super.inactiveObject(id); } catch (UnknownObjectException allowUnregisteredObjects) { } active.remove(id); } finally { releaseLock(id); checkInactiveGroup(); } return true; }
Example #14
Source File: ActivationGroupImpl.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
/** * The group's <code>inactiveObject</code> method is called * indirectly via a call to the <code>Activatable.inactive</code> * method. A remote object implementation must call * <code>Activatable</code>'s <code>inactive</code> method when * that object deactivates (the object deems that it is no longer * active). If the object does not call * <code>Activatable.inactive</code> when it deactivates, the * object will never be garbage collected since the group keeps * strong references to the objects it creates. <p> * * The group's <code>inactiveObject</code> method * unexports the remote object from the RMI runtime so that the * object can no longer receive incoming RMI calls. This call will * only succeed if the object has no pending/executing calls. If * the object does have pending/executing RMI calls, then false * will be returned. * * If the object has no pending/executing calls, the object is * removed from the RMI runtime and the group informs its * <code>ActivationMonitor</code> (via the monitor's * <code>inactiveObject</code> method) that the remote object is * not currently active so that the remote object will be * re-activated by the activator upon a subsequent activation * request. * * @param id the object's activation identifier * @returns true if the operation succeeds (the operation will * succeed if the object in currently known to be active and is * either already unexported or is currently exported and has no * pending/executing calls); false is returned if the object has * pending/executing calls in which case it cannot be deactivated * @exception UnknownObjectException if object is unknown (may already * be inactive) * @exception RemoteException if call informing monitor fails */ public boolean inactiveObject(ActivationID id) throws ActivationException, UnknownObjectException, RemoteException { try { acquireLock(id); synchronized (this) { if (groupInactive == true) throw new ActivationException("group is inactive"); } ActiveEntry entry = active.get(id); if (entry == null) { // REMIND: should this be silent? throw new UnknownObjectException("object not active"); } try { if (Activatable.unexportObject(entry.impl, false) == false) return false; } catch (NoSuchObjectException allowUnexportedObjects) { } try { super.inactiveObject(id); } catch (UnknownObjectException allowUnregisteredObjects) { } active.remove(id); } finally { releaseLock(id); checkInactiveGroup(); } return true; }
Example #15
Source File: DownloadActivationGroup.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) { RMID rmid = null; System.out.println("\nRegression test for bug 4510355\n"); try { TestLibrary.suggestSecurityManager("java.lang.SecurityManager"); /* * Install group class file in codebase. */ System.err.println("install class file in codebase"); URL groupURL = TestLibrary.installClassInCodebase( "MyActivationGroupImpl", "group"); System.err.println("class file installed"); /* * Start rmid. */ RMID.removeLog(); rmid = RMID.createRMIDOnEphemeralPort(); String execPolicyOption = "-Dsun.rmi.activation.execPolicy=none"; rmid.addOptions(new String[] { execPolicyOption }); rmid.start(); /* * Create and register descriptors for custom group and an * activatable object in that group. */ System.err.println("register group"); Properties p = new Properties(); p.put("java.security.policy", TestParams.defaultGroupPolicy); CommandEnvironment cmd = new ActivationGroupDesc.CommandEnvironment( null, new String[] { "--add-exports=java.rmi/sun.rmi.registry=ALL-UNNAMED", "--add-exports=java.rmi/sun.rmi.server=ALL-UNNAMED", "--add-exports=java.rmi/sun.rmi.transport=ALL-UNNAMED", "--add-exports=java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED" }); ActivationGroupDesc groupDesc = new ActivationGroupDesc("MyActivationGroupImpl", groupURL.toExternalForm(), null, p, cmd); ActivationGroupID groupID = ActivationGroup.getSystem().registerGroup(groupDesc); System.err.println("register activatable object"); ActivationDesc desc = new ActivationDesc(groupID, "DownloadActivationGroup", null, null); Ping obj = (Ping) Activatable.register(desc); /* * Start group (by calling ping). */ System.err.println( "ping object (forces download of group's class)"); obj.ping(); System.err.println( "TEST PASSED: group's class downloaded successfully"); System.err.println("shutdown object"); obj.shutdown(); System.err.println("TEST PASSED"); } catch (Exception e) { TestLibrary.bomb(e); } finally { rmid.cleanup(); } }