当前位置: 首页>>代码示例>>Java>>正文


Java TransactionSynchronization.STATUS_COMMITTED属性代码示例

本文整理汇总了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);
}
 
开发者ID:cucina,项目名称:opencucina,代码行数:19,代码来源:TransactionHandlerImpl.java

示例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));
    }
}
 
开发者ID:alancnet,项目名称:artifactory,代码行数:17,代码来源:SessionSynchronization.java

示例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.");
    }
}
 
开发者ID:shared-vd,项目名称:tipi-engine,代码行数:10,代码来源:TopProcessGroupLauncher.java

示例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;
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:8,代码来源:DataSourceTransactionManagerTests.java

示例5: afterCommit

@Override
public void afterCommit() {
	if (this.status != TransactionSynchronization.STATUS_COMMITTED) {
		fail("Should never be called");
	}
	assertFalse(this.afterCommitCalled);
	this.afterCommitCalled = true;
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:8,代码来源:DataSourceTransactionManagerTests.java

示例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);
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:36,代码来源:PersistenceImplSupport.java

示例7: afterCompletion

@Override
public void afterCompletion(int status) {
    if (TransactionSynchronization.STATUS_COMMITTED == status) {
        consumer.addCommand(command);
    }
}
 
开发者ID:shared-vd,项目名称:tipi-engine,代码行数:6,代码来源:CommandServiceImpl.java

示例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();
}
 
开发者ID:Alfresco,项目名称:alfresco-core,代码行数:61,代码来源:TransactionSupportUtil.java


注:本文中的org.springframework.transaction.support.TransactionSynchronization.STATUS_COMMITTED属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。