328 * <code>Activatable.inactive</code> when it deactivates, the
329 * object will never be garbage collected since the group keeps
330 * strong references to the objects it creates. <p>
331 *
332 * The group's <code>inactiveObject</code> method
333 * unexports the remote object from the RMI runtime so that the
334 * object can no longer receive incoming RMI calls. This call will
335 * only succeed if the object has no pending/executing calls. If
336 * the object does have pending/executing RMI calls, then false
337 * will be returned.
338 *
339 * If the object has no pending/executing calls, the object is
340 * removed from the RMI runtime and the group informs its
341 * <code>ActivationMonitor</code> (via the monitor's
342 * <code>inactiveObject</code> method) that the remote object is
343 * not currently active so that the remote object will be
344 * re-activated by the activator upon a subsequent activation
345 * request.
346 *
347 * @param id the object's activation identifier
348 * @returns true if the operation succeeds (the operation will
349 * succeed if the object in currently known to be active and is
350 * either already unexported or is currently exported and has no
351 * pending/executing calls); false is returned if the object has
352 * pending/executing calls in which case it cannot be deactivated
353 * @exception UnknownObjectException if object is unknown (may already
354 * be inactive)
355 * @exception RemoteException if call informing monitor fails
356 */
357 public boolean inactiveObject(ActivationID id)
358 throws ActivationException, UnknownObjectException, RemoteException
359 {
360
361 try {
362 acquireLock(id);
363 synchronized (this) {
364 if (groupInactive == true)
365 throw new ActivationException("group is inactive");
366 }
367
368 ActiveEntry entry = active.get(id);
413 } catch (Exception ignoreDeactivateFailure) {
414 }
415
416 try {
417 UnicastRemoteObject.unexportObject(this, true);
418 } catch (NoSuchObjectException allowUnexportedGroup) {
419 }
420 }
421 }
422
423 /**
424 * The group's <code>activeObject</code> method is called when an
425 * object is exported (either by <code>Activatable</code> object
426 * construction or an explicit call to
427 * <code>Activatable.exportObject</code>. The group must inform its
428 * <code>ActivationMonitor</code> that the object is active (via
429 * the monitor's <code>activeObject</code> method) if the group
430 * hasn't already done so.
431 *
432 * @param id the object's identifier
433 * @param obj the remote object implementation
434 * @exception UnknownObjectException if object is not registered
435 * @exception RemoteException if call informing monitor fails
436 */
437 public void activeObject(ActivationID id, Remote impl)
438 throws ActivationException, UnknownObjectException, RemoteException
439 {
440
441 try {
442 acquireLock(id);
443 synchronized (this) {
444 if (groupInactive == true)
445 throw new ActivationException("group is inactive");
446 }
447 if (!active.contains(id)) {
448 ActiveEntry entry = new ActiveEntry(impl);
449 active.put(id, entry);
450 // created new entry, so inform monitor of active object
451 try {
452 super.activeObject(id, entry.mobj);
453 } catch (RemoteException e) {
|
328 * <code>Activatable.inactive</code> when it deactivates, the
329 * object will never be garbage collected since the group keeps
330 * strong references to the objects it creates. <p>
331 *
332 * The group's <code>inactiveObject</code> method
333 * unexports the remote object from the RMI runtime so that the
334 * object can no longer receive incoming RMI calls. This call will
335 * only succeed if the object has no pending/executing calls. If
336 * the object does have pending/executing RMI calls, then false
337 * will be returned.
338 *
339 * If the object has no pending/executing calls, the object is
340 * removed from the RMI runtime and the group informs its
341 * <code>ActivationMonitor</code> (via the monitor's
342 * <code>inactiveObject</code> method) that the remote object is
343 * not currently active so that the remote object will be
344 * re-activated by the activator upon a subsequent activation
345 * request.
346 *
347 * @param id the object's activation identifier
348 * @return true if the operation succeeds (the operation will
349 * succeed if the object in currently known to be active and is
350 * either already unexported or is currently exported and has no
351 * pending/executing calls); false is returned if the object has
352 * pending/executing calls in which case it cannot be deactivated
353 * @exception UnknownObjectException if object is unknown (may already
354 * be inactive)
355 * @exception RemoteException if call informing monitor fails
356 */
357 public boolean inactiveObject(ActivationID id)
358 throws ActivationException, UnknownObjectException, RemoteException
359 {
360
361 try {
362 acquireLock(id);
363 synchronized (this) {
364 if (groupInactive == true)
365 throw new ActivationException("group is inactive");
366 }
367
368 ActiveEntry entry = active.get(id);
413 } catch (Exception ignoreDeactivateFailure) {
414 }
415
416 try {
417 UnicastRemoteObject.unexportObject(this, true);
418 } catch (NoSuchObjectException allowUnexportedGroup) {
419 }
420 }
421 }
422
423 /**
424 * The group's <code>activeObject</code> method is called when an
425 * object is exported (either by <code>Activatable</code> object
426 * construction or an explicit call to
427 * <code>Activatable.exportObject</code>. The group must inform its
428 * <code>ActivationMonitor</code> that the object is active (via
429 * the monitor's <code>activeObject</code> method) if the group
430 * hasn't already done so.
431 *
432 * @param id the object's identifier
433 * @param impl the remote object implementation
434 * @exception UnknownObjectException if object is not registered
435 * @exception RemoteException if call informing monitor fails
436 */
437 public void activeObject(ActivationID id, Remote impl)
438 throws ActivationException, UnknownObjectException, RemoteException
439 {
440
441 try {
442 acquireLock(id);
443 synchronized (this) {
444 if (groupInactive == true)
445 throw new ActivationException("group is inactive");
446 }
447 if (!active.contains(id)) {
448 ActiveEntry entry = new ActiveEntry(impl);
449 active.put(id, entry);
450 // created new entry, so inform monitor of active object
451 try {
452 super.activeObject(id, entry.mobj);
453 } catch (RemoteException e) {
|