@Test public void TimestampOverflow() { Callable<Resource> task = () -> { TestPool pool = new TestPool(DynamicResourcePool.Options.defaultOptions().setMaxCapacity(1)); pool.acquire(Long.MAX_VALUE, TimeUnit.MILLISECONDS); return pool.acquire(Long.MAX_VALUE, TimeUnit.MILLISECONDS); }; ExecutorService executor = Executors.newFixedThreadPool(1); Future<Resource> future = executor.submit(task); boolean timeout = false; try { future.get(5000, TimeUnit.MILLISECONDS); } catch (Exception ex) { timeout = true; } assertTrue(timeout); assertFalse(future.isDone()); future.cancel(true); }
@Override public T acquire() throws IOException { try { return acquire(100 , TimeUnit.DAYS); } catch (TimeoutException e) { throw new RuntimeException(e); } }
DynamicResourcePool implements Pool<T> { @Override public T acquire() throws IOException { try { return acquire(100 , TimeUnit.DAYS); } catch (TimeoutException e) { throw new RuntimeException(e); } } }
DynamicResourcePool implements Pool<T> { @Override public T acquire() throws IOException { try { return acquire(100 , TimeUnit.DAYS); } catch (TimeoutException e) { throw new RuntimeException(e); } } DynamicResourcePool(Options options); }
DynamicResourcePool implements Pool<T> { @Override public T acquire() throws IOException { try { return acquire(100 , TimeUnit.DAYS); } catch (TimeoutException e) { throw new RuntimeException(e); } } DynamicResourcePool(Options options); @Override T acquire(); @Override T acquire(long time, TimeUnit unit); @Override void release(T resource); @Override void close(); @Override int size(); }
DynamicResourcePool implements Pool<T> { @Override public T acquire() throws IOException { try { return acquire(100 , TimeUnit.DAYS); } catch (TimeoutException e) { throw new RuntimeException(e); } } DynamicResourcePool(Options options); @Override T acquire(); @Override T acquire(long time, TimeUnit unit); @Override void release(T resource); @Override void close(); @Override int size();  }