本文整理汇总了Java中org.springframework.transaction.support.TransactionSynchronization.STATUS_COMMITTED属性的典型用法代码示例。如果您正苦于以下问题:Java TransactionSynchronization.STATUS_COMMITTED属性的具体用法?Java TransactionSynchronization.STATUS_COMMITTED怎么用?Java TransactionSynchronization.STATUS_COMMITTED使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.springframework.transaction.support.TransactionSynchronization
的用法示例。
在下文中一共展示了TransactionSynchronization.STATUS_COMMITTED属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleStatus
private void handleStatus(int status, String type, Serializable... ids) {
Message<?> callmess;
if (TransactionSynchronization.STATUS_COMMITTED == status) {
// TODO make CommitSuccess handle type/ids combo
callmess = MessageBuilder.withPayload(new CommitSuccessEvent(ids))
.setHeader(Operative.DESTINATION_NAME, "server.queue").build();
} else {
CompensateEvent compensateEvent = new CompensateEvent(status);
compensateEvent.setIds(ids);
compensateEvent.setType(type);
callmess = MessageBuilder.withPayload(compensateEvent)
.setHeader(Operative.DESTINATION_NAME, "server.queue").build();
LOG.debug("Compensating for " + type + ":" + Arrays.toString(ids));
}
asyncChannel.send(callmess);
}
示例2: afterCompletion
@Override
public void afterCompletion(int status) {
if (sessionActive) {
boolean success = status == TransactionSynchronization.STATUS_COMMITTED;
// Commit the locks/discard changes on rollback
try {
session.afterCompletion(success);
} finally {
session.releaseResources();
StorageSessionHolder.removeSession();
}
}
if (log.isDebugEnabled()) {
log.debug("Session completed: '{}' in {}",
sessionName, TimeUnitFormat.getTimeString(System.nanoTime() - startTime));
}
}
示例3: afterCompletion
@Override
public void afterCompletion(int status) {
if (TransactionSynchronization.STATUS_COMMITTED == status) {
startNewThreadDeffered(runner);
} else if (TransactionSynchronization.STATUS_ROLLED_BACK == status) {
removeRunning(runner.getActivityId());
} else {
Assert.fail("Impossible.");
}
}
示例4: beforeCommit
@Override
public void beforeCommit(boolean readOnly) {
if (this.status != TransactionSynchronization.STATUS_COMMITTED) {
fail("Should never be called");
}
assertFalse(this.beforeCommitCalled);
this.beforeCommitCalled = true;
}
示例5: afterCommit
@Override
public void afterCommit() {
if (this.status != TransactionSynchronization.STATUS_COMMITTED) {
fail("Should never be called");
}
assertFalse(this.afterCommitCalled);
this.afterCommitCalled = true;
}
示例6: afterCompletion
@Override
public void afterCompletion(int status) {
try {
Collection<Entity> instances = container.getAllInstances();
if (log.isTraceEnabled())
log.trace("ContainerResourceSynchronization.afterCompletion: instances = " + instances);
for (Object instance : instances) {
if (instance instanceof BaseGenericIdEntity) {
BaseGenericIdEntity baseGenericIdEntity = (BaseGenericIdEntity) instance;
BaseEntityInternalAccess.setManaged(baseGenericIdEntity, false);
if (BaseEntityInternalAccess.isNew(baseGenericIdEntity)) {
// new instances become not new and detached only if the transaction was committed
if (status == TransactionSynchronization.STATUS_COMMITTED) {
BaseEntityInternalAccess.setNew(baseGenericIdEntity, false);
BaseEntityInternalAccess.setDetached(baseGenericIdEntity, true);
}
} else {
BaseEntityInternalAccess.setDetached(baseGenericIdEntity, true);
}
}
if (instance instanceof FetchGroupTracker) {
((FetchGroupTracker) instance)._persistence_setSession(null);
}
if (instance instanceof ChangeTracker) {
((ChangeTracker) instance)._persistence_setPropertyChangeListener(null);
}
}
for (AfterCompleteTransactionListener listener : afterCompleteTxListeners) {
listener.afterComplete(status == TransactionSynchronization.STATUS_COMMITTED, instances);
}
} finally {
super.afterCompletion(status);
}
}
示例7: afterCompletion
@Override
public void afterCompletion(int status) {
if (TransactionSynchronization.STATUS_COMMITTED == status) {
consumer.addCommand(command);
}
}
示例8: afterCompletion
@Override
public void afterCompletion(int status)
{
String statusStr = "unknown";
switch (status)
{
case TransactionSynchronization.STATUS_COMMITTED:
statusStr = "committed";
break;
case TransactionSynchronization.STATUS_ROLLED_BACK:
statusStr = "rolled-back";
break;
default:
}
if (logger.isDebugEnabled())
{
logger.debug("After completion (" + statusStr + "): " + this);
}
// Force any queries for read-write state to return TXN_READ_ONLY
// This will be cleared with the synchronization, so we don't need to clear it out
TransactionSupportUtil.bindResource(RESOURCE_KEY_TXN_COMPLETING, Boolean.TRUE);
Set<Integer> priorities = priorityLookup.keySet();
SortedSet<Integer> sortedPriorities = new ConcurrentSkipListSet<Integer>(REVERSE_INTEGER_ORDER);
sortedPriorities.addAll(priorities);
// Need to run these in reverse order cache,lucene,listeners
for(Integer priority : sortedPriorities)
{
Set<TransactionListener> listeners = new HashSet<TransactionListener>(priorityLookup.get(priority));
for(TransactionListener listener : listeners)
{
try
{
if (status == TransactionSynchronization.STATUS_COMMITTED)
{
listener.afterCommit();
}
else
{
listener.afterRollback();
}
}
catch (RuntimeException e)
{
logger.error("After completion (" + statusStr + ") TransactionalCache exception", e);
}
}
}
if(logger.isDebugEnabled())
{
logger.debug("After Completion: DONE");
}
// clear the thread's registrations and synchronizations
TransactionSupportUtil.clearSynchronization();
}