Package javax.ejb

Examples of javax.ejb.ConcurrentAccessTimeoutException


                throw new ApplicationException("Unable to get lock.", e);
            }
        }
        // Did we acquire the lock to the current execution?
        if (!lockAcquired) {
            throw new ApplicationException(new ConcurrentAccessTimeoutException("Unable to get lock."));
        }

        if (instance.getTransaction() != null) {
            if (!instance.getTransaction().equals(currentTransaction) && !instance.getLock().tryLock()) {
                throw new ApplicationException(new RemoteException("Instance is in a transaction and cannot be invoked outside that transaction.  See EJB 3.0 Section 4.4.4"));
View Full Code Here


        // TODO: per method
        AccessTimeout timeout = component.getAccessTimeout();
        boolean acquired = lock.tryLock(timeout.value(), timeout.unit());
        if(!acquired) {
            throw new ConcurrentAccessTimeoutException("EJB 3.1 FR 4.3.14.1 concurrent access timeout on " + context
                 + " - could not obtain lock within " + timeout.value() + timeout.unit());
        }

        TransactionSynchronizationRegistry transactionSynchronizationRegistry = component.getTransactionSynchronizationRegistry();
        Object currentTransactionKey = transactionSynchronizationRegistry.getTransactionKey();
View Full Code Here

            lock = instance.lock.writeLock();
        }

        try {
            if (!lock.tryLock(wait, unit)){
                throw new ConcurrentAccessTimeoutException();
            }
        } catch (InterruptedException e) {
            throw (ConcurrentAccessTimeoutException) new ConcurrentAccessTimeoutException().initCause(e);
        }
        return lock;
    }
View Full Code Here

        // TODO: per method
        AccessTimeout timeout = component.getAccessTimeout();
        boolean acquired = lock.tryLock(timeout.value(), timeout.unit());
        if(!acquired) {
            throw new ConcurrentAccessTimeoutException("EJB 3.1 FR 4.3.14.1 concurrent access timeout on " + context
                 + " - could not obtain lock within " + timeout.value() + timeout.unit());
        }

        TransactionSynchronizationRegistry transactionSynchronizationRegistry = component.getTransactionSynchronizationRegistry();
        Object currentTransactionKey = transactionSynchronizationRegistry.getTransactionKey();
View Full Code Here

         }
      }
      boolean success = lock.tryLock(time, unit);
      if(!success)
      {
         throw new ConcurrentAccessTimeoutException("EJB 3.1 PFD2 4.8.5.5.1 concurrent access timeout on " + invocation
               + " - could not obtain lock within " + time + unit.name());
      }
      try
      {
         return invocation.invokeNext();
View Full Code Here

                            lockInfo.getTimeUnit());
                    if( !acquired ) {
                        String msg = "Serialized access attempt on method " + inv.beanMethod +
                            " for ejb " + ejbDescriptor.getName() + " timed out after " +
                             + lockInfo.getTimeout() + " " + lockInfo.getTimeUnit();
                        throw new ConcurrentAccessTimeoutException(msg);
                    }

                } catch(InterruptedException ie)  {
                    String msg = "Serialized access attempt on method " + inv.beanMethod +
                            " for ejb " + ejbDescriptor.getName() + " was interrupted within " +
                             + lockInfo.getTimeout() + " " + lockInfo.getTimeUnit();
                    ConcurrentAccessException cae = new ConcurrentAccessTimeoutException(msg);
                    cae.initCause(ie);
                    throw cae;
                }
            } else {
                sc.getStatefulWriteLock().lock();
            }
View Full Code Here

                            lockInfo.getTimeUnit());
                    if( !acquired ) {
                        String msg = "Serialized access attempt on method " + inv.beanMethod +
                            " for ejb " + ejbDescriptor.getName() + " timed out after " +
                             + lockInfo.getTimeout() + " " + lockInfo.getTimeUnit();
                        throw new ConcurrentAccessTimeoutException(msg);
                    }

                } catch(InterruptedException ie)  {
                    String msg = "Serialized access attempt on method " + inv.beanMethod +
                            " for ejb " + ejbDescriptor.getName() + " was interrupted within " +
                             + lockInfo.getTimeout() + " " + lockInfo.getTimeUnit();
                    ConcurrentAccessException cae = new ConcurrentAccessTimeoutException(msg);
                    cae.initCause(ie);
                    throw cae;
                }
            } else {
                sc.getStatefulWriteLock().lock();
            }
View Full Code Here

                throw new ApplicationException("Unable to get lock.", e);
            }
        }
        // Did we acquire the lock to the current execution?
        if (!lockAcquired) {
            throw new ApplicationException(new ConcurrentAccessTimeoutException("Unable to get lock."));
        }

        if (instance.getTransaction() != null) {
            if (!instance.getTransaction().equals(currentTransaction) && !instance.getLock().tryLock()) {
                throw new ApplicationException(new RemoteException("Instance is in a transaction and cannot be invoked outside that transaction.  See EJB 3.0 Section 4.4.4"));
View Full Code Here

        } else {
            // try to get a lock within the specified period.
            try {
                lockAcquired = lock.tryLock(accessTimeout.getTime(), accessTimeout.getUnit());
            } catch (InterruptedException e) {
                throw (ConcurrentAccessTimeoutException) new ConcurrentAccessTimeoutException("Unable to get " + (read ? "read" : "write") + " lock within specified time on '" + runMethod.getName() + "' method for: " + instance.bean.getClass().getName()).initCause(e);
            }
        }

        // Did we acquire the lock to the current execution?
        if (!lockAcquired) {
            throw new ConcurrentAccessTimeoutException("Unable to get " + (read ? "read" : "write") + " lock on '" + runMethod.getName() + "' method for: " + instance.bean.getClass().getName());
        }

        return lock;
    }
View Full Code Here

                instance = entry.get();
                instance.setPoolEntry(entry);
            }
        } catch (TimeoutException e) {
            final String msg = "No instances available in Stateless Session Bean pool.  Waited " + data.accessTimeout.toString();
            final ConcurrentAccessTimeoutException timeoutException = new ConcurrentAccessTimeoutException(msg);
            timeoutException.fillInStackTrace();
            throw new ApplicationException(timeoutException);
        } catch (InterruptedException e) {
            Thread.interrupted();
            throw new OpenEJBException("Unexpected Interruption of current thread: ", e);
        }
View Full Code Here

TOP

Related Classes of javax.ejb.ConcurrentAccessTimeoutException

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.