Search in sources :

Example 1 with UnknownObjectException

use of java.rmi.activation.UnknownObjectException in project jdk8u_jdk by JetBrains.

the class ActivationGroupImpl method inactiveObject.

/**
    * 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;
}
Also used : ActivationException(java.rmi.activation.ActivationException) NoSuchObjectException(java.rmi.NoSuchObjectException) UnknownObjectException(java.rmi.activation.UnknownObjectException)

Example 2 with UnknownObjectException

use of java.rmi.activation.UnknownObjectException in project jdk8u_jdk by JetBrains.

the class PipeWriter method getGroupEntry.

/**
     * 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");
}
Also used : ActivationGroupID(java.rmi.activation.ActivationGroupID) UnknownObjectException(java.rmi.activation.UnknownObjectException)

Aggregations

UnknownObjectException (java.rmi.activation.UnknownObjectException)2 NoSuchObjectException (java.rmi.NoSuchObjectException)1 ActivationException (java.rmi.activation.ActivationException)1 ActivationGroupID (java.rmi.activation.ActivationGroupID)1