Package javax.resource

Examples of javax.resource.ResourceException


      Transaction trackByTransaction = null;
      try
      {
         Transaction tx = tm.getTransaction();
         if (tx != null && TxUtils.isActive(tx) == false)
            throw new ResourceException("Transaction is not active: tx=" + tx);
         if (!interleaving)
            trackByTransaction = tx;
      }
      catch (Throwable t)
      {
View Full Code Here


               {
                  TransactionSynchronizer synchronizer = TransactionSynchronizer.getRegisteredSynchronizer(tx);
                  if (synchronization.enlisted)
                     synchronizer.removeEnlisted(synchronization);
                  if (tx.delistResource(getXAResource(), XAResource.TMSUSPEND) == false)
                     throw new ResourceException("Failure to delist resource: " + this);
               }
            }
         }
         catch (Throwable t)
         {
View Full Code Here

            catch (Throwable t)
            {
               JBossResourceException.rethrowAsResourceException("Unfinished local transaction - error getting local transaction from " + this, t);
            }
            if (local == null)
               throw new ResourceException("Unfinished local transaction but managed connection does not provide a local transaction. " + this);
            else
            {
               local.rollback();
               log.debug("Unfinished local transaction was rolled back." + this);
            }
View Full Code Here

            }
         }
         else
         {
            // we timed out
            throw new ResourceException("No ManagedConnections available within configured blocking timeout ( "
                  + poolParams.blockingTimeout + " [ms] )");
         }

      }
      catch (InterruptedException ie)
      {
         Thread.currentThread().interrupt();
         long end = System.currentTimeMillis() - startWait;
         connectionCounter.updateBlockTime(end);
         throw new ResourceException("Interrupted while requesting permit! Waited " + end + " ms");
      }
   }
View Full Code Here

         sched.scheduleJob(jobDetail, trigger);
      }
      catch (Exception e)
      {
         log.error(e);
         throw new ResourceException(e);
      }
   }
View Full Code Here

    * @exception ResourceException if an error occurs
    */
   protected ConnectionListener getManagedConnection(Transaction transaction, Subject subject, ConnectionRequestInfo cri)
         throws ResourceException
   {
      ResourceException failure = null;

      if (shutdown.get())
         throw new ResourceException("The connection manager is shutdown " + jndiName);
     
      // First attempt
      try
      {
         return poolingStrategy.getConnection(transaction, subject, cri);
      }
      catch (ResourceException e)
      {
         failure = e;
        
         // Retry?
         if (allocationRetry != 0)
         {
            for (int i = 0; i < allocationRetry; i++)
            {
               if (shutdown.get())
                  throw new ResourceException("The connection manager is shutdown " + jndiName);

               if (trace)
                  log.trace("Attempting allocation retry for cri=" + cri);

               try
               {
                  if (allocationRetryWaitMillis != 0)
                     Thread.sleep(allocationRetryWaitMillis);

                  return poolingStrategy.getConnection(transaction, subject, cri);
               }
               catch (ResourceException e1)
               {
                  failure = e1;
               }
               catch (InterruptedException e1)
               {
                  Thread.currentThread().interrupt();
                  JBossResourceException.rethrowAsResourceException("getManagedConnection retry wait was interrupted " + jndiName, e1);
               }
            }
         }
      }

      // If we get here all retries failed, throw the lastest failure
      throw new ResourceException("Unable to get managed connection for " + jndiName, failure);
   }
View Full Code Here

   // implementation of javax.resource.spi.ConnectionManager interface

   public Object allocateConnection(ManagedConnectionFactory mcf, ConnectionRequestInfo cri) throws ResourceException
   {
      if (poolingStrategy == null)
         throw new ResourceException(
               "You are trying to use a connection factory that has been shut down: ManagedConnectionFactory is null.");

      //it is an explicit spec requirement that equals be used for matching rather than ==.
      if (!poolingStrategy.getManagedConnectionFactory().equals(mcf))
         throw new ResourceException("Wrong ManagedConnectionFactory sent to allocateConnection!");

      // Pick a managed connection from the pool
      Subject subject = getSubject();
      ConnectionListener cl = getManagedConnection(subject, cri);
View Full Code Here

         newMsgsWorker.watch(activation);
      }
      catch (InterruptedException e)
      {
         Thread.currentThread().interrupt();
         throw new ResourceException("Failed to schedule new msg check", e);
      }
      activations.put(spec, activation);
   }
View Full Code Here

    HealthStatusService.updateCurrentHealthStatus(this,
                                                  HealthStatus.CRITICAL,
                                                  message);

    throw new ResourceException(L.l("Can't create overflow connection connection-max={0}",
                                    _maxConnections));
  }
View Full Code Here

    try {
      ManagedConnection mConn = mcf.createManagedConnection(subject, info);

      if (mConn == null)
        throw new ResourceException(L.l("'{0}' did not return a connection from createManagedConnection",
                                        mcf));

      poolItem = new ManagedPoolItem(this, mcf, mConn);

      UserPoolItem userPoolItem;

      // Ensure the connection is still valid
      userPoolItem = poolItem.toActive(subject, info, oldPoolItem);
     
      if (userPoolItem == null) {
        throw new ResourceException(L.l("Connection '{0}' was not valid on creation",
                                   poolItem));
      }
       
      _connectionCreateCountTotal.incrementAndGet();
View Full Code Here

TOP

Related Classes of javax.resource.ResourceException

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.