Examples of TestConnectionFactory


Examples of org.jboss.test.jca.adapter.TestConnectionFactory

    * @ejb.interface-method
    */
   public void simulateFactoryError(String failure, int count)
   {
      log.info(failure + " start");
      TestConnectionFactory cf = null;
      try
      {
         long available = getAvailableConnections();
         InitialContext ctx = new InitialContext();
         cf = (TestConnectionFactory) ctx.lookup("java:/JBossTestCF");
         cf.setFailure(failure);
         for (int i = 0; i < count; ++i)
         {
            try
            {
               TestConnection c = (TestConnection) cf.getConnection(failure);
               c.close();
            }
            catch (ResourceException expected)
            {
            }
         }
         if (available != getAvailableConnections())
            throw new EJBException("Expected " + available + " got " + getAvailableConnections() + " connections");
      }
      catch (Exception e)
      {
         log.warn("Unexpected: ", e);
         throw new EJBException(e.getMessage());
      }
      finally
      {
         sessionContext.setRollbackOnly();
         if (cf != null)
            cf.setFailure(null);
      }
   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.