Java 类org.springframework.transaction.TransactionTimedOutException 实例源码

项目:jporm    文件:JdbcTemplateExceptionTranslator.java   
public static RuntimeException doTranslate(final Exception ex) {
    if (ex instanceof JpoException) {
        throw (JpoException) ex;
    }
    if (ex instanceof BadSqlGrammarException) {
        return new JpoSqlBadGrammarException(ex);
    } else if (ex instanceof DataIntegrityViolationException) {
        return new JpoSqlDataIntegrityViolationException(ex);
    } else if (ex instanceof DataAccessResourceFailureException) {
        return new JpoSqlDataAccessResourceFailureException(ex);
    } else if (ex instanceof TransientDataAccessResourceException) {
        return new JpoSqlTransientDataAccessResourceException(ex);
    } else if (ex instanceof ConcurrencyFailureException) {
        return new JpoSqlConcurrencyFailureException(ex);
    } else if (ex instanceof TransactionTimedOutException) {
        return new JpoTransactionTimedOutException(ex);
    }
    return new JpoSqlException(ex);
}
项目:molgenis    文件:JobTest.java   
@Test
public void testTransactionTimeout()
{
    TransactionException transactionException = new TransactionTimedOutException("Transaction timeout test.");
    when(transactionOperations.execute(any())).thenThrow(transactionException);
    try
    {
        job.call();
        fail("TransactionException should be thrown");
    }
    catch (TransactionException expected)
    {
        assertSame(expected, transactionException);
    }
    verify(transactionOperations).execute(any());
    verify(progress).failed(transactionException);
    verifyNoMoreInteractions(callable, progress, transactionOperations);
}
项目:lams    文件:ResourceHolderSupport.java   
/**
 * Return the time to live for this object in milliseconds.
 * @return number of millseconds until expiration
 * @throws TransactionTimedOutException if the deadline has already been reached
 */
public long getTimeToLiveInMillis() throws TransactionTimedOutException{
    if (this.deadline == null) {
        throw new IllegalStateException("No timeout specified for this resource holder");
    }
    long timeToLive = this.deadline.getTime() - System.currentTimeMillis();
    checkTransactionTimeout(timeToLive <= 0);
    return timeToLive;
}
项目:lams    文件:ResourceHolderSupport.java   
/**
 * Set the transaction rollback-only if the deadline has been reached,
 * and throw a TransactionTimedOutException.
 */
private void checkTransactionTimeout(boolean deadlineReached) throws TransactionTimedOutException {
    if (deadlineReached) {
        setRollbackOnly();
        throw new TransactionTimedOutException("Transaction timed out: deadline was " + this.deadline);
    }
}
项目:spring4-understanding    文件:ResourceHolderSupport.java   
/**
 * Return the time to live for this object in milliseconds.
 * @return number of millseconds until expiration
 * @throws TransactionTimedOutException if the deadline has already been reached
 */
public long getTimeToLiveInMillis() throws TransactionTimedOutException{
    if (this.deadline == null) {
        throw new IllegalStateException("No timeout specified for this resource holder");
    }
    long timeToLive = this.deadline.getTime() - System.currentTimeMillis();
    checkTransactionTimeout(timeToLive <= 0);
    return timeToLive;
}
项目:spring4-understanding    文件:ResourceHolderSupport.java   
/**
 * Set the transaction rollback-only if the deadline has been reached,
 * and throw a TransactionTimedOutException.
 */
private void checkTransactionTimeout(boolean deadlineReached) throws TransactionTimedOutException {
    if (deadlineReached) {
        setRollbackOnly();
        throw new TransactionTimedOutException("Transaction timed out: deadline was " + this.deadline);
    }
}
项目:xap-openspaces    文件:AbstractJiniTransactionManager.java   
protected RuntimeException convertJiniException(Exception exception) {
    if (exception instanceof LeaseException) {
        return new RemoteAccessException("Lease denied", exception);
    }

    if (exception instanceof TransactionException || exception instanceof net.jini.core.transaction.TransactionException) {
        return new TransactionSystemException(exception.getMessage(), exception);
    }

    if (exception instanceof RemoteException) {
        // Translate to Spring's unchecked remote access exception
        return new RemoteAccessException("RemoteException", exception);
    }

    if (exception instanceof UnusableEntryException) {
        return new RemoteAccessException("Unusable entry", exception);
    }

    if (exception instanceof RuntimeException) {
        return (RuntimeException) exception;
    }

    if (exception instanceof TimeoutExpiredException) {
        throw new TransactionTimedOutException("Transaction timed out (either the transaction or commit/abort)",
                exception);
    }

    return new UnexpectedTransactionException(exception);
}
项目:class-guard    文件:ResourceHolderSupport.java   
/**
 * Return the time to live for this object in milliseconds.
 * @return number of millseconds until expiration
 * @throws TransactionTimedOutException if the deadline has already been reached
 */
public long getTimeToLiveInMillis() throws TransactionTimedOutException{
    if (this.deadline == null) {
        throw new IllegalStateException("No timeout specified for this resource holder");
    }
    long timeToLive = this.deadline.getTime() - System.currentTimeMillis();
    checkTransactionTimeout(timeToLive <= 0);
    return timeToLive;
}
项目:class-guard    文件:ResourceHolderSupport.java   
/**
 * Set the transaction rollback-only if the deadline has been reached,
 * and throw a TransactionTimedOutException.
 */
private void checkTransactionTimeout(boolean deadlineReached) throws TransactionTimedOutException {
    if (deadlineReached) {
        setRollbackOnly();
        throw new TransactionTimedOutException("Transaction timed out: deadline was " + this.deadline);
    }
}