synchronized ActivationDesc setActivationDesc(ActivationID id, ActivationDesc desc, boolean addRecord) throws UnknownObjectException, UnknownGroupException, ActivationException { ObjectEntry objEntry = getObjectEntry(id); ActivationDesc oldDesc = objEntry.desc; objEntry.desc = desc; if (desc.getRestartMode() == true) { restartSet.add(id); } else { restartSet.remove(id); } // restart information should be recorded before log update if (addRecord) { addLogRecord(new LogUpdateDesc(id, desc)); } return oldDesc; }
synchronized MarshalledObject<? extends Remote> activate(ActivationID id, boolean force, ActivationInstantiator inst) throws RemoteException, ActivationException { MarshalledObject<? extends Remote> nstub = stub; if (removed) { throw new UnknownObjectException("object removed"); } else if (!force && nstub != null) { return nstub; } nstub = inst.newInstance(id, desc); stub = nstub; /* * stub could be set to null by a group reset, so return * the newstub here to prevent returning null. */ return nstub; }
/** * The group's <code>activeObject</code> method is called when an * object is exported (either by <code>Activatable</code> object * construction or an explicit call to * <code>Activatable.exportObject</code>. The group must inform its * <code>ActivationMonitor</code> that the object is active (via * the monitor's <code>activeObject</code> method) if the group * hasn't already done so. * * @param id the object's identifier * @param obj the remote object implementation * @exception UnknownObjectException if object is not registered * @exception RemoteException if call informing monitor fails */ public void activeObject(ActivationID id, Remote impl) throws ActivationException, UnknownObjectException, RemoteException { try { acquireLock(id); synchronized (this) { if (groupInactive == true) throw new ActivationException("group is inactive"); } if (!active.contains(id)) { ActiveEntry entry = new ActiveEntry(impl); active.put(id, entry); // created new entry, so inform monitor of active object try { super.activeObject(id, entry.mobj); } catch (RemoteException e) { // daemon can still find it by calling newInstance } } } finally { releaseLock(id); checkInactiveGroup(); } }
/** * The group's <code>activeObject</code> method is called when an * object is exported (either by <code>Activatable</code> object * construction or an explicit call to * <code>Activatable.exportObject</code>. The group must inform its * <code>ActivationMonitor</code> that the object is active (via * the monitor's <code>activeObject</code> method) if the group * hasn't already done so. * * @param id the object's identifier * @param impl the remote object implementation * @exception UnknownObjectException if object is not registered * @exception RemoteException if call informing monitor fails */ public void activeObject(ActivationID id, Remote impl) throws ActivationException, UnknownObjectException, RemoteException { try { acquireLock(id); synchronized (this) { if (groupInactive == true) throw new ActivationException("group is inactive"); } if (!active.contains(id)) { ActiveEntry entry = new ActiveEntry(impl); active.put(id, entry); // created new entry, so inform monitor of active object try { super.activeObject(id, entry.mobj); } catch (RemoteException e) { // daemon can still find it by calling newInstance } } } finally { releaseLock(id); checkInactiveGroup(); } }
public MarshalledObject<? extends Remote> activate(ActivationID id, boolean force) throws ActivationException, UnknownObjectException, RemoteException { checkShutdown(); return getGroupEntry(id).activate(id, force); }
public void inactiveObject(ActivationID id) throws UnknownObjectException, RemoteException { try { checkShutdown(); } catch (ActivationException e) { return; } RegistryImpl.checkAccess("Activator.inactiveObject"); getGroupEntry(id).inactiveObject(id); }
public void activeObject(ActivationID id, MarshalledObject<? extends Remote> mobj) throws UnknownObjectException, RemoteException { try { checkShutdown(); } catch (ActivationException e) { return; } RegistryImpl.checkAccess("ActivationSystem.activeObject"); getGroupEntry(id).activeObject(id, mobj); }
public void unregisterObject(ActivationID id) throws ActivationException, UnknownObjectException, RemoteException { checkShutdown(); RegistryImpl.checkAccess("ActivationSystem.unregisterObject"); getGroupEntry(id).unregisterObject(id, true); }
public ActivationDesc setActivationDesc(ActivationID id, ActivationDesc desc) throws ActivationException, UnknownObjectException, RemoteException { checkShutdown(); RegistryImpl.checkAccess("ActivationSystem.setActivationDesc"); if (!getGroupID(id).equals(desc.getGroupID())) { throw new ActivationException( "ActivationDesc contains wrong group"); } return getGroupEntry(id).setActivationDesc(id, desc, true); }
public ActivationDesc getActivationDesc(ActivationID id) throws ActivationException, UnknownObjectException, RemoteException { checkShutdown(); RegistryImpl.checkAccess("ActivationSystem.getActivationDesc"); return getGroupEntry(id).getActivationDesc(id); }
/** * Returns the groupID for a given id of an object in the group. * Throws UnknownObjectException if the object is not registered. */ private ActivationGroupID getGroupID(ActivationID id) throws UnknownObjectException { ActivationGroupID groupID = idTable.get(id); if (groupID != null) { return groupID; } throw new UnknownObjectException("unknown object: " + id); }
/** * Returns the group entry for the object's id. Throws * UnknownObjectException if the object is not registered or the * object's group is not registered. */ private GroupEntry getGroupEntry(ActivationID id) throws UnknownObjectException { ActivationGroupID gid = getGroupID(id); GroupEntry entry = groupTable.get(gid); if (entry != null && !entry.removed) { return entry; } throw new UnknownObjectException("object's group removed"); }
private ObjectEntry getObjectEntry(ActivationID id) throws UnknownObjectException { if (removed) { throw new UnknownObjectException("object's group removed"); } ObjectEntry objEntry = objects.get(id); if (objEntry == null) { throw new UnknownObjectException("object unknown"); } return objEntry; }
/** * 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; }