java.rmi.activation.UnknownObjectException Java Examples

The following examples show how to use java.rmi.activation.UnknownObjectException. 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: Activation.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example #2
Source File: Activation.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example #3
Source File: ActivationGroupImpl.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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();
    }
}
 
Example #4
Source File: Activation.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example #5
Source File: Activation.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example #6
Source File: Activation.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example #7
Source File: Activation.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example #8
Source File: ActivationGroupImpl.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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();
    }
}
 
Example #9
Source File: Activation.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example #10
Source File: ActivationGroupImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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();
    }
}
 
Example #11
Source File: Activation.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public void unregisterObject(ActivationID id)
    throws ActivationException, UnknownObjectException, RemoteException
{
    checkShutdown();
    RegistryImpl.checkAccess("ActivationSystem.unregisterObject");
    getGroupEntry(id).unregisterObject(id, true);
}
 
Example #12
Source File: Activation.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example #13
Source File: Activation.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
public void unregisterObject(ActivationID id)
    throws ActivationException, UnknownObjectException, RemoteException
{
    checkShutdown();
    // RegistryImpl.checkAccess() is done in the SameHostOnlyServerRef
    // during unmarshallCustomData and is not applicable to local access.
    getGroupEntry(id).unregisterObject(id, true);
}
 
Example #14
Source File: Activation.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
public ActivationDesc getActivationDesc(ActivationID id)
    throws ActivationException, UnknownObjectException, RemoteException
{
    checkShutdown();
    // RegistryImpl.checkAccess() is done in the SameHostOnlyServerRef
    // during unmarshallCustomData and is not applicable to local access.

    return getGroupEntry(id).getActivationDesc(id);
}
 
Example #15
Source File: ActivationGroupImpl.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
* 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 #16
Source File: Activation.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public ActivationDesc getActivationDesc(ActivationID id)
    throws ActivationException, UnknownObjectException, RemoteException
{
    checkShutdown();
    RegistryImpl.checkAccess("ActivationSystem.getActivationDesc");

    return getGroupEntry(id).getActivationDesc(id);
}
 
Example #17
Source File: Activation.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example #18
Source File: Activation.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void unregisterObject(ActivationID id)
    throws ActivationException, UnknownObjectException, RemoteException
{
    checkShutdown();
    // RegistryImpl.checkAccess() is done in the SameHostOnlyServerRef
    // during unmarshallCustomData and is not applicable to local access.
    getGroupEntry(id).unregisterObject(id, true);
}
 
Example #19
Source File: Activation.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public ActivationDesc getActivationDesc(ActivationID id)
    throws ActivationException, UnknownObjectException, RemoteException
{
    checkShutdown();
    // RegistryImpl.checkAccess() is done in the SameHostOnlyServerRef
    // during unmarshallCustomData and is not applicable to local access.

    return getGroupEntry(id).getActivationDesc(id);
}
 
Example #20
Source File: Activation.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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");
}
 
Example #21
Source File: Activation.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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");
}
 
Example #22
Source File: ActivationGroupImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
* 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 #23
Source File: Activation.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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");
}
 
Example #24
Source File: Activation.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public void inactiveObject(ActivationID id)
    throws UnknownObjectException, RemoteException
{
    try {
        checkShutdown();
    } catch (ActivationException e) {
        return;
    }
    RegistryImpl.checkAccess("Activator.inactiveObject");
    getGroupEntry(id).inactiveObject(id);
}
 
Example #25
Source File: Activation.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example #26
Source File: Activation.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example #27
Source File: Activation.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
synchronized void inactiveObject(ActivationID id)
    throws UnknownObjectException
{
    getObjectEntry(id).reset();
}
 
Example #28
Source File: Activation.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
synchronized void activeObject(ActivationID id,
                               MarshalledObject<? extends Remote> mobj)
        throws UnknownObjectException
{
    getObjectEntry(id).stub = mobj;
}
 
Example #29
Source File: Activation.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
synchronized void inactiveObject(ActivationID id)
    throws UnknownObjectException
{
    getObjectEntry(id).reset();
}
 
Example #30
Source File: Activation.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
synchronized ActivationDesc getActivationDesc(ActivationID id)
    throws UnknownObjectException, UnknownGroupException
{
    return getObjectEntry(id).desc;
}