Search in sources :

Example 6 with ConcurrentAccessException

use of javax.ejb.ConcurrentAccessException in project tomee by apache.

the class StatelessPoolStatsTest method testAccessTimeouts.

/**
     * Requires an invocation against a maxed pool with all instances checked out, must be a strict pool
     * javax.management.MBeanAttributeInfo[description=, name=AccessTimeouts, type=long, read-only, descriptor={}]
     *
     * @throws Exception On error
     */
public void testAccessTimeouts() throws Exception {
    final Properties properties = new Properties();
    properties.put("MaxSize", "10");
    properties.put("AccessTimeout", "0");
    properties.put("StrictPooling", "true");
    final CounterBean bean = deploy("testAccessTimeouts", properties);
    assertAttribute("AccessTimeouts", 0l);
    final Checkout checkout = checkout(bean, 10);
    for (int i = 0; i < 7; i++) {
        try {
            bean.doSomething();
            fail("ConcurrentAccessException should have been thrown");
        } catch (final ConcurrentAccessException expected) {
        }
    }
    checkout.release();
    assertAttribute("AccessTimeouts", 7l);
}
Also used : ConcurrentAccessException(javax.ejb.ConcurrentAccessException) Properties(java.util.Properties)

Aggregations

ConcurrentAccessException (javax.ejb.ConcurrentAccessException)6 RemoteException (java.rmi.RemoteException)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 ConcurrentAccessTimeoutException (javax.ejb.ConcurrentAccessTimeoutException)2 ComponentInstance (org.jboss.as.ee.component.ComponentInstance)2 EJBComponent (org.jboss.as.ejb3.component.EJBComponent)2 Test (org.junit.Test)2 AgentUnavailableException (com.cloud.exception.AgentUnavailableException)1 InvalidParameterValueException (com.cloud.exception.InvalidParameterValueException)1 OperationTimedoutException (com.cloud.exception.OperationTimedoutException)1 PermissionDeniedException (com.cloud.exception.PermissionDeniedException)1 ResourceInUseException (com.cloud.exception.ResourceInUseException)1 Account (com.cloud.user.Account)1 TransactionCallbackWithException (com.cloud.utils.db.TransactionCallbackWithException)1 TransactionStatus (com.cloud.utils.db.TransactionStatus)1 CloudRuntimeException (com.cloud.utils.exception.CloudRuntimeException)1 XMLDecoder (java.beans.XMLDecoder)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 IOException (java.io.IOException)1