java.rmi.activation.ActivationID Java Examples

The following examples show how to use java.rmi.activation.ActivationID. 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: ActivatableImpl.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public ActivatableImpl(ActivationID id, MarshalledObject mobj)
    throws RemoteException
{
    super(id, 0);

    ClassLoader thisLoader = ActivatableImpl.class.getClassLoader();
    ClassLoader ccl = Thread.currentThread().getContextClassLoader();

    System.err.println("implLoader: " + thisLoader);
    System.err.println("ccl: " + ccl);

    /*
     * the context class loader is the ccl from when this object
     * was exported.  If the bug has been fixed, the ccl will be
     * the same as the class loader of this class.
     */
    classLoaderOk = (thisLoader == ccl);
}
 
Example #2
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 #3
Source File: Activation.java    From jdk8u-dev-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 #4
Source File: Activation.java    From jdk8u-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 #5
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 #6
Source File: Activation.java    From openjdk-jdk8u-backup 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 #7
Source File: Activation.java    From jdk8u_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 #8
Source File: Activation.java    From openjdk-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 #9
Source File: Activation.java    From jdk8u-dev-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 #10
Source File: ActivationGroupImpl.java    From jdk8u-jdk 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 jdk8u_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 #12
Source File: Activation.java    From jdk8u-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 #13
Source File: ActivationGroupImpl.java    From openjdk-8-source 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 #14
Source File: Activation.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
synchronized void registerObject(ActivationID id,
                                 ActivationDesc desc,
                                 boolean addRecord)
    throws UnknownGroupException, ActivationException
{
    checkRemoved();
    objects.put(id, new ObjectEntry(desc));
    if (desc.getRestartMode() == true) {
        restartSet.add(id);
    }

    // table insertion must take place before log update
    idTable.put(id, groupID);

    if (addRecord) {
        addLogRecord(new LogRegisterObject(id, desc));
    }
}
 
Example #15
Source File: ActivationGroupImpl.java    From jdk8u-jdk 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 jdk8u-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 #17
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 #18
Source File: Activation.java    From jdk8u-dev-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("ActivationSystem.unregisterObject");
    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
/**
 * 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 #20
Source File: Activation.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
public ActivationID registerObject(ActivationDesc desc)
    throws ActivationException, UnknownGroupException, RemoteException
{
    checkShutdown();
    // RegistryImpl.checkAccess() is done in the SameHostOnlyServerRef
    // during unmarshallCustomData and is not applicable to local access.
    ActivationGroupID groupID = desc.getGroupID();
    ActivationID id = new ActivationID(activatorStub);
    getGroupEntry(groupID).registerObject(id, desc, true);
    return id;
}
 
Example #21
Source File: Activation.java    From hottub 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: ActivatableServerRef.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Construct a Unicast server remote reference to be exported
 * on the specified port.
 */
public ActivatableServerRef(ActivationID id, int port,
                            RMIClientSocketFactory csf,
                            RMIServerSocketFactory ssf)
{
    super(new LiveRef(port, csf, ssf));
    this.id = id;
}
 
Example #23
Source File: Activation.java    From jdk8u-jdk 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 jdk8u_jdk 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 openjdk-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 #26
Source File: Activation.java    From hottub 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 #27
Source File: ActivationGroupImpl.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private void releaseLock(ActivationID id) {
    synchronized (lockedIDs) {
        id = lockedIDs.remove(lockedIDs.indexOf(id));
    }

    synchronized (id) {
        id.notifyAll();
    }
}
 
Example #28
Source File: Activation.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
void restartServices() {
    Iterator<ActivationID> iter = null;

    synchronized (this) {
        if (restartSet.isEmpty()) {
            return;
        }

        /*
         * Clone the restartSet so the set does not have to be locked
         * during iteration. Locking the restartSet could cause
         * deadlock if an object we are restarting caused another
         * object in this group to be activated.
         */
        iter = (new HashSet<ActivationID>(restartSet)).iterator();
    }

    while (iter.hasNext()) {
        ActivationID id = iter.next();
        try {
            activate(id, true);
        } catch (Exception e) {
            if (shuttingDown) {
                return;
            }
            System.err.println(
                getTextResource("rmid.restart.service.warning"));
            e.printStackTrace();
        }
    }
}
 
Example #29
Source File: Activation.java    From hottub 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 #30
Source File: Activation.java    From TencentKona-8 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);
}