Interface StatefulSessionBean<K,V extends StatefulSessionBeanInstance<K>>
- Type Parameters:
K- the bean identifier typeV- the bean instance type
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
DistributableStatefulSessionBean,SimpleStatefulSessionBean
public interface StatefulSessionBean<K,V extends StatefulSessionBeanInstance<K>>
extends AutoCloseable
A cached stateful session bean.
- Author:
- Paul Ferraro
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes any resources associated with this bean.voiddiscard()Removes this bean from the cache without triggering any events.default KgetId()Returns the bean identifier.Returns the bean instance.booleanisClosed()Indicates whether or not this bean was closed, i.e.booleanIndicates whether or not this bean was discarded, i.e.booleanIndicates whether or not this bean was removed, i.e.voidremove()Removes this bean from the cache, triggering requisitePreDestroyevents.
-
Method Details
-
getId
Returns the bean identifier.- Returns:
- the bean identifier.
-
getInstance
V getInstance()Returns the bean instance.- Returns:
- a bean instance.
-
isClosed
boolean isClosed()Indicates whether or not this bean was closed, i.e.close()was invoked.- Returns:
- true, if this bean is valid, false otherwise.
-
isDiscarded
boolean isDiscarded()Indicates whether or not this bean was discarded, i.e.discard()was invoked.- Returns:
- true, if this bean was discarded, false otherwise.
-
isRemoved
boolean isRemoved()Indicates whether or not this bean was removed, i.e.remove()was invoked.- Returns:
- true, if this bean was removed, false otherwise.
-
discard
void discard()Removes this bean from the cache without triggering any events. A discarded bean does not need to be closed. -
remove
void remove()Removes this bean from the cache, triggering requisitePreDestroyevents. A removed bean does not need to be closed. -
close
void close()Closes any resources associated with this bean. If bean has an associated timeout, it will schedule its expiration.- Specified by:
closein interfaceAutoCloseable
-