Package javax.persistence

Examples of javax.persistence.PessimisticLockException


      if ( lockOptions != null && lockOptions.getTimeOut() > -1 ) {
        // assume lock timeout occurred if a timeout or NO WAIT was specified
        return new LockTimeoutException( ple.getMessage(), ple );
      }
      else {
        return new PessimisticLockException( ple.getMessage(), ple );
      }
    }
    else {
      return new OptimisticLockException( e.getMessage(), e );
    }
View Full Code Here


      if ( lockOptions != null && lockOptions.getTimeOut() > -1 ) {
        // assume lock timeout occurred if a timeout or NO WAIT was specified
        pe = new LockTimeoutException( lockException.getMessage(), lockException, lockException.getEntity() );
      }
      else {
        pe = new PessimisticLockException( lockException.getMessage(), lockException, lockException.getEntity() );
      }
    }
    else if ( e instanceof org.hibernate.PessimisticLockException ) {
      org.hibernate.PessimisticLockException jdbcLockException = ( org.hibernate.PessimisticLockException ) e;
      if ( lockOptions != null && lockOptions.getTimeOut() > -1 ) {
        // assume lock timeout occurred if a timeout or NO WAIT was specified
        pe = new LockTimeoutException( jdbcLockException.getMessage(), jdbcLockException, null );
      }
      else {
        pe = new PessimisticLockException( jdbcLockException.getMessage(), jdbcLockException, null );
      }
    }
    else {
      pe = new OptimisticLockException( e );
    }
View Full Code Here

        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 );
  }
View Full Code Here

      if ( lockOptions != null && lockOptions.getTimeOut() > -1 ) {
        // assume lock timeout occurred if a timeout or NO WAIT was specified
        pe = new LockTimeoutException( ple.getMessage(), ple, ple.getEntity() );
      }
      else {
        pe = new PessimisticLockException( ple.getMessage(), ple, ple.getEntity() );
      }
    }
    else {
      pe = new OptimisticLockException( e );
    }
View Full Code Here

        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 );
  }
View Full Code Here

      if ( lockOptions != null && lockOptions.getTimeOut() > -1 ) {
        // assume lock timeout occurred if a timeout or NO WAIT was specified
        pe = new LockTimeoutException( ple.getMessage(), ple, ple.getEntity() );
      }
      else {
        pe = new PessimisticLockException( ple.getMessage(), ple, ple.getEntity() );
      }
    }
    else {
      pe = new OptimisticLockException( e );
    }
View Full Code Here

      if ( lockOptions != null && lockOptions.getTimeOut() > -1 ) {
        // assume lock timeout occurred if a timeout or NO WAIT was specified
        pe = new LockTimeoutException( lockException.getMessage(), lockException, lockException.getEntity() );
      }
      else {
        pe = new PessimisticLockException( lockException.getMessage(), lockException, lockException.getEntity() );
      }
    }
    else if ( e instanceof org.hibernate.PessimisticLockException ) {
      org.hibernate.PessimisticLockException jdbcLockException = ( org.hibernate.PessimisticLockException ) e;
      if ( lockOptions != null && lockOptions.getTimeOut() > -1 ) {
        // assume lock timeout occurred if a timeout or NO WAIT was specified
        pe = new LockTimeoutException( jdbcLockException.getMessage(), jdbcLockException, null );
      }
      else {
        pe = new PessimisticLockException( jdbcLockException.getMessage(), jdbcLockException, null );
      }
    }
    else {
      pe = new OptimisticLockException( e );
    }
View Full Code Here

      if ( lockOptions != null && lockOptions.getTimeOut() > -1 ) {
        // assume lock timeout occurred if a timeout or NO WAIT was specified
        pe = new LockTimeoutException( ple.getMessage(), ple, ple.getEntity() );
      }
      else {
        pe = new PessimisticLockException( ple.getMessage(), ple, ple.getEntity() );
      }
    }
    else {
      pe = new OptimisticLockException( e );
    }
View Full Code Here

      if ( lockOptions != null && lockOptions.getTimeOut() > -1 ) {
        // assume lock timeout occurred if a timeout or NO WAIT was specified
        pe = new LockTimeoutException( ple.getMessage(), ple, ple.getEntity() );
      }
      else {
        pe = new PessimisticLockException( ple.getMessage(), ple, ple.getEntity() );
      }
    }
    else {
      pe = new OptimisticLockException( e );
    }
View Full Code Here

      if ( lockOptions != null && lockOptions.getTimeOut() > -1 ) {
        // assume lock timeout occurred if a timeout or NO WAIT was specified
        return new LockTimeoutException( ple.getMessage(), ple );
      }
      else {
        return new PessimisticLockException( ple.getMessage(), ple );
      }
    }
    else {
      return new OptimisticLockException( e.getMessage(), e );
    }
View Full Code Here

TOP

Related Classes of javax.persistence.PessimisticLockException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.