|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.objectweb.perseus.persistence.lib.TransactionalPersistenceManagerImpl
This class is an implementation of the TransactionalPersistenceManager interface. It manages the persistency, the concurrency and the caching of persistent objects. To do this it uses several other components: - a cache manager, - a concurrency manager, - a storage manager, - a state manager, - a memory instance manager, - a working set manager. This implementation is compliant to fractal by implementing the BindingController interface permitting the management of bindings between components.
Field Summary | |
protected CacheManager |
cache
The cache of the persistent object. |
static java.lang.String |
CACHE_MANAGER_BINDING
|
protected ConcurrencyManager |
cm
The concurrency manager |
static java.lang.String |
CONCURRENCY_MANAGER_BINDING
|
protected Logger |
logger
|
static java.lang.String |
MEMORY_INSTANCE_MANAGER_BINDING
|
protected MemoryInstanceManager |
mim
The factory of persistent objects |
static java.lang.String |
STATE_MANAGER_BINDING
|
protected StateManager |
stateManager
The manager of state of persistent object. |
protected StorageManager |
storage
The storage manager in charge of the I/O to the data support, and the naming management. |
static java.lang.String |
STORAGE_MANAGER_BINDING
|
static java.lang.String |
UNBIND_MANAGER_BINDING
|
protected UnbindManager |
unbindManager
|
static java.lang.String |
WORKINGSET_MANAGER_BINDING
|
protected WorkingSetManager |
wsManager
The manager of working set instance. |
Constructor Summary | |
TransactionalPersistenceManagerImpl()
|
Method Summary | |
void |
accessCompletion(WorkingSet ws,
State ce)
This method can be used to mark the end of an access to a data object. |
void |
begin(TransactionalWorkingSet tx)
converts a context to a transaction |
protected void |
bindCeInWS(State state,
WorkingSet ws)
Attaches a state to a working Set and fixes the entry in the cache manager if it is not already done. |
void |
bindFc(java.lang.String s,
java.lang.Object o)
|
protected void |
checkCacheEntry(CacheEntry ce)
Check if a cache entry is already referenced in the cache. |
void |
close(WorkingSet context)
Closes and releases a context. |
void |
commit(TransactionalWorkingSet tx)
commits a transactional context. |
WorkingSet |
createWS(java.lang.Object userObject)
creates a working set |
WorkingSet |
createWS(java.lang.Object userObject,
java.lang.Object workingSetType)
creates a working set |
boolean |
evict(WorkingSet ws,
java.lang.Object oid,
boolean force)
This methods permits to force the cache eviction of a persistent object designed by its identifier. |
int |
evictAll(WorkingSet ws,
boolean force)
This methods permits to try the cache eviction of all persistent object |
State |
export(WorkingSet ws,
java.lang.Object obj)
Given an object, this method creates the corresponding copy in permanent support. |
State |
export(WorkingSet ws,
java.lang.Object obj,
java.lang.Object hints)
This method permits to given some information to build the identifier of the new persistent object. |
void |
flush(WorkingSet ws,
StateFilter statefilter)
This method permits to flush entries associated to a context. |
protected CacheEntry |
getCacheEntry(WorkingSet ws,
java.lang.Object oid)
finds or creates the CacheEntry matching to an identifier. |
java.lang.String[] |
listFc()
|
java.lang.Object |
lookupFc(java.lang.String s)
|
boolean |
prepare(TransactionalWorkingSet tx)
Prepare the transactinal context. |
State |
readIntention(WorkingSet ws,
java.lang.Object oid)
This method records an access intention to a data object in read mode. |
void |
refresh(WorkingSet ws,
java.lang.Object oid)
Forget modifications of a dirty persistent object. |
void |
rollback(TransactionalWorkingSet tx)
rollbacks a transactional context. |
void |
unbind(WorkingSet ws,
java.lang.Object oid)
Detach a persistent object from the persistent support. |
void |
unbindFc(java.lang.String s)
|
State |
unexport(WorkingSet ws,
java.lang.Object oid)
Deletes the binding between an in main-memory object, and its corresponding copy in permanent support. |
State |
writeIntention(WorkingSet ws,
java.lang.Object oid)
This method records an access intention to a data object in write mode. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String CACHE_MANAGER_BINDING
public static final java.lang.String CONCURRENCY_MANAGER_BINDING
public static final java.lang.String STORAGE_MANAGER_BINDING
public static final java.lang.String STATE_MANAGER_BINDING
public static final java.lang.String MEMORY_INSTANCE_MANAGER_BINDING
public static final java.lang.String UNBIND_MANAGER_BINDING
public static final java.lang.String WORKINGSET_MANAGER_BINDING
protected CacheManager cache
protected UnbindManager unbindManager
protected ConcurrencyManager cm
protected StorageManager storage
protected StateManager stateManager
protected WorkingSetManager wsManager
protected MemoryInstanceManager mim
protected Logger logger
Constructor Detail |
public TransactionalPersistenceManagerImpl()
Method Detail |
protected void bindCeInWS(State state, WorkingSet ws) throws PersistenceException
state
- is the state of the persistent object which must be attached
to working set.ws
- is the working set to attach the state.
RolledBackPersistenceException
- if the entry has been evicted
from the cache during the locking step (concurrency manager). It is
possible that it has been removed by another thread ==> rollback the
working set.
PersistenceException
protected CacheEntry getCacheEntry(WorkingSet ws, java.lang.Object oid) throws PersistenceException
ws
- if the WorkingSet requiring a CacheEntry.oid
- the identifier of the expected cache entry
PersistenceException
- if it is not possible to instanciate a
persistent object
RolledBackPersistenceException
- if the cache is full (case of the
entry has not been found into the cache and a new entry is bound).protected void checkCacheEntry(CacheEntry ce) throws PersistenceException
ce
- is the cache entry to check
PersistenceException
- if the cache is full or if another cache
entry has been found in the cache with the same identifier.public java.lang.String[] listFc()
public java.lang.Object lookupFc(java.lang.String s)
public void bindFc(java.lang.String s, java.lang.Object o)
public void unbindFc(java.lang.String s)
public State export(WorkingSet ws, java.lang.Object obj) throws PersistenceException
PersistenceManager
export
in interface PersistenceManager
ws
- is an identifier of the execution context. It can be a
transaction handle.obj
- The object whose state is to be copied to
PersistenceException
- Whenever the object is invalid
(e.g. NULL) or it has been previously bound to another oid.public State export(WorkingSet ws, java.lang.Object obj, java.lang.Object hints) throws PersistenceException
PersistenceManager
export
in interface PersistenceManager
ws
- is an identifier of the execution context. It can be a
transaction handle.obj
- The object whose state is to be copied tohints
- can be used to build the identifier of the object.
PersistenceException
public State unexport(WorkingSet ws, java.lang.Object oid) throws PersistenceException
PersistenceManager
unexport
in interface PersistenceManager
ws
- is an identifier of the execution context. It can be a
transaction handle.oid
- The identifier of the corresponding object to be
destroyed.
PersistenceException
public State readIntention(WorkingSet ws, java.lang.Object oid) throws PersistenceException
PersistenceManager
readIntention
in interface PersistenceManager
ws
- is an identifier of the execution context. It can be a
transaction handle.oid
- is the object identifier.
PersistenceException
public State writeIntention(WorkingSet ws, java.lang.Object oid) throws PersistenceException
PersistenceManager
writeIntention
in interface PersistenceManager
ws
- is an identifier of the execution context. It can be a
transaction handle.oid
- is the object identifier.
PersistenceException
public void accessCompletion(WorkingSet ws, State ce) throws PersistenceException
accessCompletion
in interface PersistenceManager
ws
- is an identifier of the execution context. It can be a
transaction handle.ce
- is the cache entry on which the access is finished.
PersistenceException
public void flush(WorkingSet ws, StateFilter statefilter) throws PersistenceException
flush
in interface PersistenceManager
ws
- is an identifier of the execution context. It can be a
transaction handle.statefilter
- is a filter of the state which must be flushed
PersistenceException
- if the context is not valid.public boolean evict(WorkingSet ws, java.lang.Object oid, boolean force) throws PersistenceException
PersistenceManager
evict
in interface PersistenceManager
ws
- is the working set asking the eviction.oid
- is the identifier of the persistent object to evict from the
cacheforce
- indicates if the entry MUST be evicted (true) or TRIES to be
evicted (false).
PersistenceException
- if the instance is dirty or used by other
working set.public int evictAll(WorkingSet ws, boolean force) throws PersistenceException
PersistenceManager
evictAll
in interface PersistenceManager
PersistenceException
public void unbind(WorkingSet ws, java.lang.Object oid) throws PersistenceException
PersistenceManager
unbind
in interface PersistenceManager
ws
- is the current working setoid
- is the identifier of the persistent object
PersistenceException
public void refresh(WorkingSet ws, java.lang.Object oid) throws PersistenceException
PersistenceManager
refresh
in interface PersistenceManager
ws
- is the current working setoid
- is the identifier of the persistent object
PersistenceException
public WorkingSet createWS(java.lang.Object userObject) throws PersistenceException
createWS
in interface PersistenceManager
userObject
- can be an external user depending on the
personnality.
PersistenceException
public WorkingSet createWS(java.lang.Object userObject, java.lang.Object workingSetType) throws PersistenceException
createWS
in interface PersistenceManager
userObject
- can be an external user depending on the
personnality.workingSetType
- is a type of the working set.
PersistenceException
public void close(WorkingSet context) throws PersistenceException
close
in interface PersistenceManager
context
- which must be closed
PersistenceException
- if the context is a transactional context
which has not been commited or aborted.public void begin(TransactionalWorkingSet tx) throws PersistenceException
begin
in interface TransactionalPersistenceManager
tx
- becomes transactional
PersistenceException
- if the context is already transactional.public boolean prepare(TransactionalWorkingSet tx) throws PersistenceException
prepare
in interface TransactionalPersistenceManager
tx
- the
PersistenceException
- if an error raised during the prepare
operation, or if the context is not a transactional context.public void commit(TransactionalWorkingSet tx) throws PersistenceException
commit
in interface TransactionalPersistenceManager
tx
-
PersistenceException
- if an error raised during the commit
operation, or if the context is not a transactional context.public void rollback(TransactionalWorkingSet tx) throws PersistenceException
rollback
in interface TransactionalPersistenceManager
tx
-
PersistenceException
- if an error raised during the rollback
operation, or if the context is not a transactional context.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |