java.rmi.activation.ActivationException Java Examples

The following examples show how to use java.rmi.activation.ActivationException. 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 openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
synchronized void activeGroup(ActivationInstantiator inst,
                              long instIncarnation)
    throws ActivationException, UnknownGroupException
{
    if (incarnation != instIncarnation) {
        throw new ActivationException("invalid incarnation");
    }

    if (group != null) {
        if (group.equals(inst)) {
            return;
        } else {
            throw new ActivationException("group already active");
        }
    }

    if (child != null && status != CREATING) {
        throw new ActivationException("group not being created");
    }

    group = inst;
    status = NORMAL;
    notifyAll();
}
 
Example #3
Source File: Activation.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Acquire the group semaphore and return a group name.  Each
 * Pstartgroup must be followed by a Vstartgroup.  The calling thread
 * will wait until there are fewer than <code>N</code> other threads
 * holding the group semaphore.  The calling thread will then acquire
 * the semaphore and return.
 */
private synchronized String Pstartgroup() throws ActivationException {
    while (true) {
        checkShutdown();
        // Wait until positive, then decrement.
        if (groupSemaphore > 0) {
            groupSemaphore--;
            return "Group-" + groupCounter++;
        }

        try {
            wait();
        } catch (InterruptedException e) {
        }
    }
}
 
Example #4
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 #5
Source File: Activation.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public ActivationGroupID registerGroup(ActivationGroupDesc desc)
    throws ActivationException, RemoteException
{
    Thread.dumpStack();
    checkShutdown();
    // RegistryImpl.checkAccess() is done in the SameHostOnlyServerRef
    // during unmarshallCustomData and is not applicable to local access.
    checkArgs(desc, null);

    ActivationGroupID id = new ActivationGroupID(systemStub);
    GroupEntry entry = new GroupEntry(id, desc);
    // table insertion must take place before log update
    groupTable.put(id, entry);
    addLogRecord(new LogRegisterGroup(id, desc));
    return id;
}
 
Example #6
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 #7
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 #8
Source File: Activation.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
synchronized void unregisterGroup(boolean addRecord)
   throws UnknownGroupException, ActivationException
{
    checkRemoved();
    removed = true;
    for (Map.Entry<ActivationID,ObjectEntry> entry :
             objects.entrySet())
    {
        ActivationID id = entry.getKey();
        idTable.remove(id);
        ObjectEntry objEntry = entry.getValue();
        objEntry.removed = true;
    }
    objects.clear();
    restartSet.clear();
    reset();
    childGone();

    // removal should be recorded before log update
    if (addRecord) {
        addLogRecord(new LogUnregisterGroup(groupID));
    }
}
 
Example #9
Source File: Activation.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
synchronized void unregisterObject(ActivationID id, boolean addRecord)
    throws UnknownGroupException, ActivationException
{
    ObjectEntry objEntry = getObjectEntry(id);
    objEntry.removed = true;
    objects.remove(id);
    if (objEntry.desc.getRestartMode() == true) {
        restartSet.remove(id);
    }

    // table removal must take place before log update
    idTable.remove(id);
    if (addRecord) {
        addLogRecord(new LogUnregisterObject(id));
    }
}
 
Example #10
Source File: Activation.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Acquire the group semaphore and return a group name.  Each
 * Pstartgroup must be followed by a Vstartgroup.  The calling thread
 * will wait until there are fewer than <code>N</code> other threads
 * holding the group semaphore.  The calling thread will then acquire
 * the semaphore and return.
 */
private synchronized String Pstartgroup() throws ActivationException {
    while (true) {
        checkShutdown();
        // Wait until positive, then decrement.
        if (groupSemaphore > 0) {
            groupSemaphore--;
            return "Group-" + groupCounter++;
        }

        try {
            wait();
        } catch (InterruptedException e) {
        }
    }
}
 
Example #11
Source File: Activation.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
synchronized void unregisterObject(ActivationID id, boolean addRecord)
    throws UnknownGroupException, ActivationException
{
    ObjectEntry objEntry = getObjectEntry(id);
    objEntry.removed = true;
    objects.remove(id);
    if (objEntry.desc.getRestartMode() == true) {
        restartSet.remove(id);
    }

    // table removal must take place before log update
    idTable.remove(id);
    if (addRecord) {
        addLogRecord(new LogUnregisterObject(id));
    }
}
 
Example #12
Source File: Activation.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
synchronized void activeGroup(ActivationInstantiator inst,
                              long instIncarnation)
    throws ActivationException, UnknownGroupException
{
    if (incarnation != instIncarnation) {
        throw new ActivationException("invalid incarnation");
    }

    if (group != null) {
        if (group.equals(inst)) {
            return;
        } else {
            throw new ActivationException("group already active");
        }
    }

    if (child != null && status != CREATING) {
        throw new ActivationException("group not being created");
    }

    group = inst;
    status = NORMAL;
    notifyAll();
}
 
Example #13
Source File: Activation.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
synchronized void unregisterObject(ActivationID id, boolean addRecord)
    throws UnknownGroupException, ActivationException
{
    ObjectEntry objEntry = getObjectEntry(id);
    objEntry.removed = true;
    objects.remove(id);
    if (objEntry.desc.getRestartMode() == true) {
        restartSet.remove(id);
    }

    // table removal must take place before log update
    idTable.remove(id);
    if (addRecord) {
        addLogRecord(new LogUnregisterObject(id));
    }
}
 
Example #14
Source File: Activation.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
synchronized void unregisterGroup(boolean addRecord)
   throws UnknownGroupException, ActivationException
{
    checkRemoved();
    removed = true;
    for (Map.Entry<ActivationID,ObjectEntry> entry :
             objects.entrySet())
    {
        ActivationID id = entry.getKey();
        idTable.remove(id);
        ObjectEntry objEntry = entry.getValue();
        objEntry.removed = true;
    }
    objects.clear();
    restartSet.clear();
    reset();
    childGone();

    // removal should be recorded before log update
    if (addRecord) {
        addLogRecord(new LogUnregisterGroup(groupID));
    }
}
 
Example #15
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 #16
Source File: Activation.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
public ActivationGroupID registerGroup(ActivationGroupDesc desc)
    throws ActivationException, RemoteException
{
    Thread.dumpStack();
    checkShutdown();
    // RegistryImpl.checkAccess() is done in the SameHostOnlyServerRef
    // during unmarshallCustomData and is not applicable to local access.
    checkArgs(desc, null);

    ActivationGroupID id = new ActivationGroupID(systemStub);
    GroupEntry entry = new GroupEntry(id, desc);
    // table insertion must take place before log update
    groupTable.put(id, entry);
    addLogRecord(new LogRegisterGroup(id, desc));
    return id;
}
 
Example #17
Source File: Activation.java    From jdk8u60 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 #18
Source File: Activation.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Acquire the group semaphore and return a group name.  Each
 * Pstartgroup must be followed by a Vstartgroup.  The calling thread
 * will wait until there are fewer than <code>N</code> other threads
 * holding the group semaphore.  The calling thread will then acquire
 * the semaphore and return.
 */
private synchronized String Pstartgroup() throws ActivationException {
    while (true) {
        checkShutdown();
        // Wait until positive, then decrement.
        if (groupSemaphore > 0) {
            groupSemaphore--;
            return "Group-" + groupCounter++;
        }

        try {
            wait();
        } catch (InterruptedException e) {
        }
    }
}
 
Example #19
Source File: Activation.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
synchronized void unregisterObject(ActivationID id, boolean addRecord)
    throws UnknownGroupException, ActivationException
{
    ObjectEntry objEntry = getObjectEntry(id);
    objEntry.removed = true;
    objects.remove(id);
    if (objEntry.desc.getRestartMode() == true) {
        restartSet.remove(id);
    }

    // table removal must take place before log update
    idTable.remove(id);
    if (addRecord) {
        addLogRecord(new LogUnregisterObject(id));
    }
}
 
Example #20
Source File: Activation.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
synchronized void unregisterGroup(boolean addRecord)
   throws UnknownGroupException, ActivationException
{
    checkRemoved();
    removed = true;
    for (Map.Entry<ActivationID,ObjectEntry> entry :
             objects.entrySet())
    {
        ActivationID id = entry.getKey();
        idTable.remove(id);
        ObjectEntry objEntry = entry.getValue();
        objEntry.removed = true;
    }
    objects.clear();
    restartSet.clear();
    reset();
    childGone();

    // removal should be recorded before log update
    if (addRecord) {
        addLogRecord(new LogUnregisterGroup(groupID));
    }
}
 
Example #21
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 #22
Source File: Activation.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private void checkShutdown() throws ActivationException {
    // if the startup critical section is running, wait until it
    // completes/fails before continuing with the remote call.
    Object lock = startupLock;
    if (lock != null) {
        synchronized (lock) {
            // nothing
        }
    }

    if (shuttingDown == true) {
        throw new ActivationException(
            "activation system shutting down");
    }
}
 
Example #23
Source File: Activation.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public MarshalledObject<? extends Remote> activate(ActivationID id,
                                                   boolean force)
    throws ActivationException, UnknownObjectException, RemoteException
{
    checkShutdown();
    return getGroupEntry(id).activate(id, force);
}
 
Example #24
Source File: Activation.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example #25
Source File: ActivationGroupImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
ActiveEntry(Remote impl) throws ActivationException {
    this.impl =  impl;
    try {
        this.mobj = new MarshalledObject<Remote>(impl);
    } catch (IOException e) {
        throw new
            ActivationException("failed to marshal remote object", e);
    }
}
 
Example #26
Source File: Activation.java    From openjdk-jdk8u 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 #27
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 #28
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 #29
Source File: Activation.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public ActivationGroupDesc getActivationGroupDesc(ActivationGroupID id)
    throws ActivationException, UnknownGroupException, RemoteException
{
    checkShutdown();
    // RegistryImpl.checkAccess() is done in the SameHostOnlyServerRef
    // during unmarshallCustomData and is not applicable to local access.

    return getGroupEntry(id).desc;
}
 
Example #30
Source File: Activation.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
synchronized ActivationGroupDesc setActivationGroupDesc(
        ActivationGroupID id,
        ActivationGroupDesc desc,
        boolean addRecord)
    throws UnknownGroupException, ActivationException
{
    checkRemoved();
    ActivationGroupDesc oldDesc = this.desc;
    this.desc = desc;
    // state update should occur before log update
    if (addRecord) {
        addLogRecord(new LogUpdateGroupDesc(id, desc));
    }
    return oldDesc;
}