private static class PersistenceManagerFactoryUtils.PersistenceManagerSynchronization extends ResourceHolderSynchronization<PersistenceManagerHolder,PersistenceManagerFactory> implements Ordered
JtaTransactionManager
Modifier and Type | Field and Description |
---|---|
private boolean |
newPersistenceManager |
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
STATUS_COMMITTED, STATUS_ROLLED_BACK, STATUS_UNKNOWN
Constructor and Description |
---|
PersistenceManagerFactoryUtils.PersistenceManagerSynchronization(PersistenceManagerHolder pmHolder,
PersistenceManagerFactory pmf,
boolean newPersistenceManager) |
Modifier and Type | Method and Description |
---|---|
void |
flushResource(PersistenceManagerHolder resourceHolder)
Flush callback for the given resource holder.
|
int |
getOrder()
Return the order value of this object, with a
higher value meaning greater in terms of sorting.
|
protected void |
releaseResource(PersistenceManagerHolder resourceHolder,
PersistenceManagerFactory resourceKey)
Release the given resource (after it has been unbound from the thread).
|
protected boolean |
shouldReleaseAfterCompletion(PersistenceManagerHolder resourceHolder)
Return whether this holder's resource should be released after
transaction completion (
true ). |
protected boolean |
shouldUnbindAtCompletion()
Return whether this holder should be unbound at completion
(or should rather be left bound to the thread after the transaction).
|
afterCommit, afterCompletion, beforeCommit, beforeCompletion, cleanupResource, flush, processResourceAfterCommit, resume, shouldReleaseBeforeCompletion, suspend
public PersistenceManagerFactoryUtils.PersistenceManagerSynchronization(PersistenceManagerHolder pmHolder, PersistenceManagerFactory pmf, boolean newPersistenceManager)
public int getOrder()
Ordered
Normally starting with 0, with Integer.MAX_VALUE
indicating the greatest value. Same order values will result
in arbitrary positions for the affected objects.
Higher values can be interpreted as lower priority. As a consequence, the object with the lowest value has highest priority (somewhat analogous to Servlet "load-on-startup" values).
public void flushResource(PersistenceManagerHolder resourceHolder)
ResourceHolderSynchronization
flushResource
in class ResourceHolderSynchronization<PersistenceManagerHolder,PersistenceManagerFactory>
resourceHolder
- the resource holder to flushprotected boolean shouldUnbindAtCompletion()
ResourceHolderSynchronization
The default implementation returns true
.
shouldUnbindAtCompletion
in class ResourceHolderSynchronization<PersistenceManagerHolder,PersistenceManagerFactory>
protected boolean shouldReleaseAfterCompletion(PersistenceManagerHolder resourceHolder)
ResourceHolderSynchronization
true
).
The default implementation returns !shouldReleaseBeforeCompletion()
,
releasing after completion if no attempt was made before completion.
shouldReleaseAfterCompletion
in class ResourceHolderSynchronization<PersistenceManagerHolder,PersistenceManagerFactory>
ResourceHolderSynchronization.releaseResource(H, K)
protected void releaseResource(PersistenceManagerHolder resourceHolder, PersistenceManagerFactory resourceKey)
ResourceHolderSynchronization
releaseResource
in class ResourceHolderSynchronization<PersistenceManagerHolder,PersistenceManagerFactory>
resourceHolder
- the resource holder to processresourceKey
- the key that the ResourceHolder was bound for