@Test public void testWhenPoolExhaustedPoolBlocksUntilTimeout() throws UnavailableException { assertEquals(endpoint1.getMock(), endpointPool.getEndpoint()); assertEquals(endpoint2.getMock(), endpointPool.getEndpoint()); assertNextCallBlocksUntilTimeout(); }
public SocketMessageEndpoint getEndpoint() throws UnavailableException { SocketMessageEndpoint messageEndpoint = endpoints.poll(); if (messageEndpoint == null) { messageEndpoint = addIfUnderMaximumPoolSize(); } if (messageEndpoint == null) { try { messageEndpoint = endpoints.poll(timeout, timeUnit); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } if ( messageEndpoint == null ){ throw new UnavailableException( "No more endpoints available, maxEnpoints=" + maxEndpoints); } return messageEndpoint; }
EndpointPool implements WorkListener { public SocketMessageEndpoint getEndpoint() throws UnavailableException { SocketMessageEndpoint messageEndpoint = endpoints.poll(); if (messageEndpoint == null) { messageEndpoint = addIfUnderMaximumPoolSize(); } if (messageEndpoint == null) { try { messageEndpoint = endpoints.poll(timeout, timeUnit); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } if ( messageEndpoint == null ){ throw new UnavailableException( "No more endpoints available, maxEnpoints=" + maxEndpoints); } return messageEndpoint; } }
EndpointPool implements WorkListener { public SocketMessageEndpoint getEndpoint() throws UnavailableException { SocketMessageEndpoint messageEndpoint = endpoints.poll(); if (messageEndpoint == null) { messageEndpoint = addIfUnderMaximumPoolSize(); } if (messageEndpoint == null) { try { messageEndpoint = endpoints.poll(timeout, timeUnit); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } if ( messageEndpoint == null ){ throw new UnavailableException( "No more endpoints available, maxEnpoints=" + maxEndpoints); } return messageEndpoint; } EndpointPool(MessageEndpointFactory endpointFactory, int maxEndpoints, long timeout, TimeUnit timeUnit); }
EndpointPool implements WorkListener { public SocketMessageEndpoint getEndpoint() throws UnavailableException { SocketMessageEndpoint messageEndpoint = endpoints.poll(); if (messageEndpoint == null) { messageEndpoint = addIfUnderMaximumPoolSize(); } if (messageEndpoint == null) { try { messageEndpoint = endpoints.poll(timeout, timeUnit); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } if ( messageEndpoint == null ){ throw new UnavailableException( "No more endpoints available, maxEnpoints=" + maxEndpoints); } return messageEndpoint; } EndpointPool(MessageEndpointFactory endpointFactory, int maxEndpoints, long timeout, TimeUnit timeUnit); SocketMessageEndpoint getEndpoint(); void release(SocketMessageEndpoint socketMessageEndpoint); void workAccepted(WorkEvent workEvent); void workCompleted(WorkEvent workEvent); void workRejected(WorkEvent workEvent); void workStarted(WorkEvent workEvent); }
EndpointPool implements WorkListener { public SocketMessageEndpoint getEndpoint() throws UnavailableException { SocketMessageEndpoint messageEndpoint = endpoints.poll(); if (messageEndpoint == null) { messageEndpoint = addIfUnderMaximumPoolSize(); } if (messageEndpoint == null) { try { messageEndpoint = endpoints.poll(timeout, timeUnit); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } if ( messageEndpoint == null ){ throw new UnavailableException( "No more endpoints available, maxEnpoints=" + maxEndpoints); } return messageEndpoint; } EndpointPool(MessageEndpointFactory endpointFactory, int maxEndpoints, long timeout, TimeUnit timeUnit); SocketMessageEndpoint getEndpoint(); void release(SocketMessageEndpoint socketMessageEndpoint); void workAccepted(WorkEvent workEvent); void workCompleted(WorkEvent workEvent); void workRejected(WorkEvent workEvent); void workStarted(WorkEvent workEvent);  }