@Test public void testInvalidBorrow() throws Exception { final ConcurrentManaged.InvalidBorrowed<Object> invalid = new ConcurrentManaged.InvalidBorrowed<>(); invalid.close(); invalid.release(); assertFalse(invalid.isValid()); try { invalid.get(); fail("should have thrown IllegalStateException"); } catch (IllegalStateException e) { assertTrue(e.getMessage().contains("invalid")); } }
void release() { final int lease = leases.decrementAndGet(); if (lease == 0) { zeroLeaseFuture.complete(null); } }
ConcurrentManaged implements Managed<T> { void release() { final int lease = leases.decrementAndGet(); if (lease == 0) { zeroLeaseFuture.complete(null); } } }
ConcurrentManaged implements Managed<T> { void release() { final int lease = leases.decrementAndGet(); if (lease == 0) { zeroLeaseFuture.complete(null); } } ConcurrentManaged(
      final Caller caller, final ManagedOptions options, final Supplier<? extends Stage<T>> setup,
      final Completable<Void> startFuture, final Completable<Void> zeroLeaseFuture,
      final Completable<T> stopReferenceFuture, final Stage<Void> stopFuture
  ); }
ConcurrentManaged implements Managed<T> { void release() { final int lease = leases.decrementAndGet(); if (lease == 0) { zeroLeaseFuture.complete(null); } } ConcurrentManaged(
      final Caller caller, final ManagedOptions options, final Supplier<? extends Stage<T>> setup,
      final Completable<Void> startFuture, final Completable<Void> zeroLeaseFuture,
      final Completable<T> stopReferenceFuture, final Stage<Void> stopFuture
  ); static ConcurrentManaged<T> newManaged(
      final Async async, final Caller caller, final ManagedOptions options,
      final Supplier<? extends Stage<T>> setup,
      final Function<? super T, ? extends Stage<Void>> teardown
  ); @Override Stage<R> doto(
      final Function<? super T, ? extends Stage<R>> action
  ); @Override Borrowed<T> borrow(); @Override boolean isReady(); @Override Stage<Void> start(); @Override Stage<Void> stop(); @Override String toString(); }
ConcurrentManaged implements Managed<T> { void release() { final int lease = leases.decrementAndGet(); if (lease == 0) { zeroLeaseFuture.complete(null); } } ConcurrentManaged(
      final Caller caller, final ManagedOptions options, final Supplier<? extends Stage<T>> setup,
      final Completable<Void> startFuture, final Completable<Void> zeroLeaseFuture,
      final Completable<T> stopReferenceFuture, final Stage<Void> stopFuture
  ); static ConcurrentManaged<T> newManaged(
      final Async async, final Caller caller, final ManagedOptions options,
      final Supplier<? extends Stage<T>> setup,
      final Function<? super T, ? extends Stage<Void>> teardown
  ); @Override Stage<R> doto(
      final Function<? super T, ? extends Stage<R>> action
  ); @Override Borrowed<T> borrow(); @Override boolean isReady(); @Override Stage<Void> start(); @Override Stage<Void> stop(); @Override String toString();  }