pe = new PessimisticLockException( lockException.getMessage(), lockException, pe = new PessimisticLockException( jdbcLockException.getMessage(), jdbcLockException, null );
public void printStackTrace(PrintStream out) { super.printStackTrace(out); Exceptions.printNestedThrowables(this, out); }
public void printStackTrace(PrintStream out) { super.printStackTrace(out); Exceptions.printNestedThrowables(this, out); }
private void acquireLock(EntityKey key, int timeout, Lock writeLock) { try { if ( timeout == -1 ) { writeLock.lockInterruptibly(); } else if ( timeout == 0 ) { boolean locked = writeLock.tryLock(); if ( ! locked ) { throw new PessimisticLockException( "lock on key " + key + " was not available" ); } } else { writeLock.tryLock( timeout, TimeUnit.MILLISECONDS ); } } catch ( InterruptedException e ) { throw new PessimisticLockException( "timed out waiting for lock on key " + key, e ); } acquiredLocksPerThread.get().add( writeLock ); }
public void printStackTrace(PrintStream out) { super.printStackTrace(out); Exceptions.printNestedThrowables(this, out); }
/** * Given a DatabaseException, this method will determine if we should * throw a different more specific exception like a lock timeout exception. */ protected RuntimeException getDetailedException(DatabaseException e) { // If we catch a database exception as a result of executing a // pessimistic locking query we need to ask the platform which // JPA 2.0 locking exception we should throw. It will be either // be a PessimisticLockException or a LockTimeoutException (if // the query was executed using a wait timeout value) if (this.lockMode != null && this.lockMode.name().contains(ObjectLevelReadQuery.PESSIMISTIC_)) { // ask the platform if it is a lock timeout if (getActiveSession().getPlatform().isLockTimeoutException(e)) { return new LockTimeoutException(e); } else { return new PessimisticLockException(e); } } else { setRollbackOnly(); return new PersistenceException(e); } }
public void printStackTrace(PrintWriter out) { super.printStackTrace(out); Exceptions.printNestedThrowables(this, out); }
pe = new PessimisticLockException( lockException.getMessage(), lockException, lockException.getEntity() ); pe = new PessimisticLockException( jdbcLockException.getMessage(), jdbcLockException, null );
public void printStackTrace(PrintStream out) { super.printStackTrace(out); Exceptions.printNestedThrowables(this, out); }
throw new LockTimeoutException(e); } else { throw new PessimisticLockException(e);
public void printStackTrace(PrintWriter out) { super.printStackTrace(out); Exceptions.printNestedThrowables(this, out); }
pe = new PessimisticLockException( lockException.getMessage(), lockException, pe = new PessimisticLockException( jdbcLockException.getMessage(), jdbcLockException, null );
public void printStackTrace(PrintWriter out) { super.printStackTrace(out); Exceptions.printNestedThrowables(this, out); }
@Test public void testFilteredJPAExceptions() { assertFalse(predicate.apply(new EntityExistsException())); assertFalse(predicate.apply(new EntityNotFoundException())); assertFalse(predicate.apply(new LockTimeoutException())); assertFalse(predicate.apply(new NoResultException())); assertFalse(predicate.apply(new NonUniqueResultException())); assertFalse(predicate.apply(new OptimisticLockException())); assertFalse(predicate.apply(new PessimisticLockException())); assertFalse(predicate.apply(new QueryTimeoutException())); assertFalse(predicate.apply(new TransactionRequiredException())); }
public void printStackTrace(PrintWriter out) { super.printStackTrace(out); Exceptions.printNestedThrowables(this, out); }
@Test public void testNestedFilteredJPAExceptions() { assertFalse(predicate.apply(wrapCause(new EntityExistsException()))); assertFalse(predicate.apply(wrapCause(new EntityNotFoundException()))); assertFalse(predicate.apply(wrapCause(new LockTimeoutException()))); assertFalse(predicate.apply(wrapCause(new NoResultException()))); assertFalse(predicate.apply(wrapCause(new NonUniqueResultException()))); assertFalse(predicate.apply(wrapCause(new OptimisticLockException()))); assertFalse(predicate.apply(wrapCause(new PessimisticLockException()))); assertFalse(predicate.apply(wrapCause(new QueryTimeoutException()))); assertFalse(predicate.apply(wrapCause(new TransactionRequiredException()))); }