Java Code Examples for org.springframework.transaction.support.TransactionSynchronizationManager#getCurrentTransactionIsolationLevel()

The following examples show how to use org.springframework.transaction.support.TransactionSynchronizationManager#getCurrentTransactionIsolationLevel() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IsolationLevelDataSourceAdapter.java    From spring-analysis-note with MIT License 5 votes vote down vote up
/**
 * Determine the current isolation level: either the transaction's
 * isolation level or a statically defined isolation level.
 * @return the current isolation level, or {@code null} if none
 * @see org.springframework.transaction.support.TransactionSynchronizationManager#getCurrentTransactionIsolationLevel()
 * @see #setIsolationLevel
 */
@Nullable
protected Integer getCurrentIsolationLevel() {
	Integer isolationLevelToUse = TransactionSynchronizationManager.getCurrentTransactionIsolationLevel();
	if (isolationLevelToUse == null) {
		isolationLevelToUse = getIsolationLevel();
	}
	return isolationLevelToUse;
}
 
Example 2
Source File: IsolationLevelDataSourceAdapter.java    From java-technology-stack with MIT License 5 votes vote down vote up
/**
 * Determine the current isolation level: either the transaction's
 * isolation level or a statically defined isolation level.
 * @return the current isolation level, or {@code null} if none
 * @see org.springframework.transaction.support.TransactionSynchronizationManager#getCurrentTransactionIsolationLevel()
 * @see #setIsolationLevel
 */
@Nullable
protected Integer getCurrentIsolationLevel() {
	Integer isolationLevelToUse = TransactionSynchronizationManager.getCurrentTransactionIsolationLevel();
	if (isolationLevelToUse == null) {
		isolationLevelToUse = getIsolationLevel();
	}
	return isolationLevelToUse;
}
 
Example 3
Source File: IsolationLevelDataSourceAdapter.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Determine the current isolation level: either the transaction's
 * isolation level or a statically defined isolation level.
 * @return the current isolation level, or {@code null} if none
 * @see org.springframework.transaction.support.TransactionSynchronizationManager#getCurrentTransactionIsolationLevel()
 * @see #setIsolationLevel
 */
protected Integer getCurrentIsolationLevel() {
	Integer isolationLevelToUse = TransactionSynchronizationManager.getCurrentTransactionIsolationLevel();
	if (isolationLevelToUse == null) {
		isolationLevelToUse = getIsolationLevel();
	}
	return isolationLevelToUse;
}
 
Example 4
Source File: IsolationLevelDataSourceAdapter.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
/**
 * Determine the current isolation level: either the transaction's
 * isolation level or a statically defined isolation level.
 * @return the current isolation level, or {@code null} if none
 * @see org.springframework.transaction.support.TransactionSynchronizationManager#getCurrentTransactionIsolationLevel()
 * @see #setIsolationLevel
 */
protected Integer getCurrentIsolationLevel() {
	Integer isolationLevelToUse = TransactionSynchronizationManager.getCurrentTransactionIsolationLevel();
	if (isolationLevelToUse == null) {
		isolationLevelToUse = getIsolationLevel();
	}
	return isolationLevelToUse;
}
 
Example 5
Source File: IsolationLevelDataSourceAdapter.java    From effectivejava with Apache License 2.0 5 votes vote down vote up
/**
 * Determine the current isolation level: either the transaction's
 * isolation level or a statically defined isolation level.
 * @return the current isolation level, or {@code null} if none
 * @see org.springframework.transaction.support.TransactionSynchronizationManager#getCurrentTransactionIsolationLevel()
 * @see #setIsolationLevel
 */
protected Integer getCurrentIsolationLevel() {
	Integer isolationLevelToUse = TransactionSynchronizationManager.getCurrentTransactionIsolationLevel();
	if (isolationLevelToUse == null) {
		isolationLevelToUse = getIsolationLevel();
	}
	return isolationLevelToUse;
}
 
Example 6
Source File: IsolationLevelDataSourceRouter.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Override
@Nullable
protected Object determineCurrentLookupKey() {
	return TransactionSynchronizationManager.getCurrentTransactionIsolationLevel();
}
 
Example 7
Source File: IsolationLevelDataSourceRouter.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Override
@Nullable
protected Object determineCurrentLookupKey() {
	return TransactionSynchronizationManager.getCurrentTransactionIsolationLevel();
}
 
Example 8
Source File: IsolationLevelDataSourceRouter.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected Object determineCurrentLookupKey() {
	return TransactionSynchronizationManager.getCurrentTransactionIsolationLevel();
}
 
Example 9
Source File: IsolationLevelDataSourceRouter.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Override
protected Object determineCurrentLookupKey() {
	return TransactionSynchronizationManager.getCurrentTransactionIsolationLevel();
}
 
Example 10
Source File: IsolationLevelDataSourceRouter.java    From effectivejava with Apache License 2.0 4 votes vote down vote up
@Override
protected Object determineCurrentLookupKey() {
	return TransactionSynchronizationManager.getCurrentTransactionIsolationLevel();
}
 
Example 11
Source File: JtaUtil.java    From iaf with Apache License 2.0 4 votes vote down vote up
public static String displayTransactionStatus(TransactionStatus txStatus) {
	String result;
	result="txName ["+TransactionSynchronizationManager.getCurrentTransactionName()+"]";
	if (txStatus!=null) {
		result+=" status new ["+txStatus.isNewTransaction()+"]";
		result+=" status completeted ["+txStatus.isCompleted()+"]";
		result+=" status rollbackOnly ["+txStatus.isRollbackOnly()+"]";
		result+=" status hasSavepoint ["+txStatus.hasSavepoint()+"]";
	} else {
		result+=" currently not in a transaction";
	}
	result+=" isolation ["+TransactionSynchronizationManager.getCurrentTransactionIsolationLevel()+"]";
	result+=" active ["+TransactionSynchronizationManager.isActualTransactionActive()+"]";
	boolean syncActive=TransactionSynchronizationManager.isSynchronizationActive();
	result+=" synchronization active ["+syncActive+"]";
	result+="\n";
	Map<Object, Object> resources = TransactionSynchronizationManager.getResourceMap();
	result += "resources:\n";
	if (resources==null) {
		result+="  map is null\n";
	} else {
		for (Iterator<Object> it=resources.keySet().iterator(); it.hasNext();) {
			Object key = it.next();
			Object resource = resources.get(key);
			result += ClassUtils.nameOf(key)+"("+key+"): "+ClassUtils.nameOf(resource)+"("+resource+")\n";
			if (resource instanceof JmsResourceHolder) {
				JmsResourceHolder jrh = (JmsResourceHolder)resource; 
				result+="  connection: "+jrh.getConnection()+", session: "+jrh.getSession()+"\n";
			}
		}
	}
	if (syncActive) {
		List<TransactionSynchronization> synchronizations = TransactionSynchronizationManager.getSynchronizations();
		result += "synchronizations:\n";
		for (int i=0; i<synchronizations.size(); i++) {
			TransactionSynchronization synchronization = synchronizations.get(i);
			result += ClassUtils.nameOf(synchronization)+"("+synchronization+")\n"; 
		}
	}
	return result;
}