public class ReferenceCountingEntityCache extends Object implements ReadyEntityCache
| Constructor and Description |
|---|
ReferenceCountingEntityCache(EntityBeanComponent component) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(Object key)
Checks whether an entity bean instance for the given primary key is cached.
|
boolean |
containsNotRemoved(Object key)
Checks whether an entity bean instance for the given primary key is cached and the entity is not marked as removed.
|
void |
create(EntityBeanComponentInstance instance)
Called after an entity bean has been created and associated with a new identity.
|
void |
discard(EntityBeanComponentInstance instance)
Discard the object, called when an exception occurs
|
EntityBeanComponentInstance |
get(Object key)
Gets an entity bean instance for the given primary key.
|
void |
release(EntityBeanComponentInstance instance,
boolean success)
Release the object from use.
|
void |
start()
Start the cache.
|
void |
stop()
Stop the cache.
|
public ReferenceCountingEntityCache(EntityBeanComponent component)
public void create(EntityBeanComponentInstance instance)
ReadyEntityCachecreate in interface ReadyEntityCacheinstance - The new instancepublic boolean contains(Object key)
ReadyEntityCachecontains in interface ReadyEntityCachekey - the identifier of the objecttrue if the object is cached.public boolean containsNotRemoved(Object key)
ReadyEntityCachecontainsNotRemoved in interface ReadyEntityCachekey - the identifier of the objecttrue if the object is cached and not marked as removed.public EntityBeanComponentInstance get(Object key) throws javax.ejb.NoSuchEntityException
ReadyEntityCacheReadyEntityCache.release(org.jboss.as.ejb3.component.entity.EntityBeanComponentInstance, boolean)
Implementors of this method must ensure that repeated calls to get within the same transaction
return the same instance for a given primary key. This must also take into account entity beans
created in the same transaction using the ReadyEntityCache.create(org.jboss.as.ejb3.component.entity.EntityBeanComponentInstance)
method.
Implementations are free to use a 1 to 1 instance -> pk mapping, or create multiple instances per
primary key.get in interface ReadyEntityCachekey - the identifier of the objectjavax.ejb.NoSuchEntityException - if the object identity association failedpublic void release(EntityBeanComponentInstance instance, boolean success)
ReadyEntityCacherelease in interface ReadyEntityCacheinstance - The entitysuccess - True if the transaction succeededpublic void discard(EntityBeanComponentInstance instance)
ReadyEntityCachediscard in interface ReadyEntityCacheinstance - The instance to discardpublic void start()
ReadyEntityCachestart in interface ReadyEntityCachepublic void stop()
ReadyEntityCachestop in interface ReadyEntityCacheCopyright © 2014 JBoss by Red Hat. All rights reserved.