本文整理汇总了Java中java.rmi.activation.Activatable.unexportObject方法的典型用法代码示例。如果您正苦于以下问题:Java Activatable.unexportObject方法的具体用法?Java Activatable.unexportObject怎么用?Java Activatable.unexportObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.rmi.activation.Activatable
的用法示例。
在下文中一共展示了Activatable.unexportObject方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: inactiveObject
import java.rmi.activation.Activatable; //导入方法依赖的package包/类
/**
* 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;
}
示例2: inactiveObject
import java.rmi.activation.Activatable; //导入方法依赖的package包/类
/**
* 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
* @return 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;
}
示例3: inactiveObject
import java.rmi.activation.Activatable; //导入方法依赖的package包/类
public boolean inactiveObject(ActivationID id) throws ActivationException,
UnknownObjectException, RemoteException {
ActiveObject ao = (ActiveObject) active_objects.get(id);
if (ao == null) {
// rmi.93=Object was not registered or already deactivated.
throw new UnknownObjectException(Messages.getString("rmi.93")); //$NON-NLS-1$
}
Activatable.unexportObject(ao.getImpl(), false);
super.inactiveObject(id);
active_objects.remove(id);
return true;
}