Package org.wildfly.clustering.ejb
Interface Bean<I,T>
-
- Type Parameters:
G- the group identifier typeI- the bean identifier typeT- the bean instance type
- All Superinterfaces:
AutoCloseable
public interface Bean<I,T> extends AutoCloseable
Represents a bean and the group to which it is associated.- Author:
- Paul Ferraro
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Tacquire()Acquires a reference to the bean instance.voidclose()Closes any resources used by this bean.IgetGroupId()Returns the identifier of the group to which this bean is associated.IgetId()Returns the identifier of this bean.booleanisExpired()Indicates whether or not the specified bean is expired.booleanisValid()Indicates whether this bean was removed.booleanrelease()Releases a reference to the bean made viaacquire().voidremove(RemoveListener<T> listener)Removes this bean, notifying the specified listener.
-
-
-
Method Detail
-
getId
I getId()
Returns the identifier of this bean.- Returns:
- a unique identifier
-
getGroupId
I getGroupId()
Returns the identifier of the group to which this bean is associated.- Returns:
- a unique identifier of a group
-
acquire
T acquire()
Acquires a reference to the bean instance. Every call toacquire()should be paired with a call torelease().- Returns:
- the bean instance
-
release
boolean release()
Releases a reference to the bean made viaacquire().- Returns:
- true, if all acquisitions have been released, false otherwise.
-
isExpired
boolean isExpired()
Indicates whether or not the specified bean is expired.- Returns:
- true, if this bean has expired, false otherwise.
-
remove
void remove(RemoveListener<T> listener)
Removes this bean, notifying the specified listener.- Parameters:
listener- a remove listener
-
isValid
boolean isValid()
Indicates whether this bean was removed.- Returns:
- false, if this bean was removed, true otherwise.
-
close
void close()
Closes any resources used by this bean. A bean should only be closed when all referenced have been released, i.e.release()returned true.- Specified by:
closein interfaceAutoCloseable
-
-