Search in sources :

Example 11 with ClientRequestExecutor

use of voldemort.store.socket.clientrequest.ClientRequestExecutor in project voldemort by voldemort.

the class ClientRequestExecutorPoolTest method testClosingDeactivates.

@Test
public void testClosingDeactivates() throws Exception {
    ClientRequestExecutor sas1 = pool.checkout(dest1);
    sas1.close();
    pool.checkin(dest1, sas1);
    ClientRequestExecutor sas2 = pool.checkout(dest1);
    assertTrue(sas1 != sas2);
}
Also used : ClientRequestExecutor(voldemort.store.socket.clientrequest.ClientRequestExecutor) Test(org.junit.Test)

Example 12 with ClientRequestExecutor

use of voldemort.store.socket.clientrequest.ClientRequestExecutor in project voldemort by voldemort.

the class ClientRequestExecutorPoolTest method testNonBlockingCheckoutConnectionFailure.

private void testNonBlockingCheckoutConnectionFailure(ClientRequestExecutorPool execPool, SocketDestination dest, Class<?> expectedExceptionClass) throws Exception {
    try {
        ClientRequestExecutor resource = execPool.internalGetQueuedPool().internalNonBlockingGet(dest);
        // operation and returns null most likely.
        if (resource == null) {
            Thread.sleep(execPool.getFactory().getTimeout() + 5);
            execPool.internalGetQueuedPool().internalNonBlockingGet(dest);
        }
        fail("should have thrown an connection exception");
    } catch (UnreachableStoreException e) {
        assertEquals("inner exception should be of type connect exception", expectedExceptionClass, e.getCause().getClass());
    }
}
Also used : ClientRequestExecutor(voldemort.store.socket.clientrequest.ClientRequestExecutor) UnreachableStoreException(voldemort.store.UnreachableStoreException)

Aggregations

ClientRequestExecutor (voldemort.store.socket.clientrequest.ClientRequestExecutor)12 Test (org.junit.Test)10 UnreachableStoreException (voldemort.store.UnreachableStoreException)3 ClientRequestExecutorPool (voldemort.store.socket.clientrequest.ClientRequestExecutorPool)3 ArrayList (java.util.ArrayList)2 IOException (java.io.IOException)1 AbstractSocketService (voldemort.server.AbstractSocketService)1 ClientRequestHandlerFactory (voldemort.server.protocol.ClientRequestHandlerFactory)1 TestStats (voldemort.socketpool.AbstractSocketPoolTest.TestStats)1 SocketDestination (voldemort.store.socket.SocketDestination)1 ResourcePoolConfig (voldemort.utils.pool.ResourcePoolConfig)1