@Test(timeout = 10000) public void testOnSuccess() { ProviderFuture future = futuresFactory.createFuture(); future.onSuccess(); try { future.sync(); } catch (Exception cause) { fail("Should throw an error"); } }
@Override public void onSuccess() { if (STATE_FIELD_UPDATER.compareAndSet(this, INCOMPLETE, COMPLETING)) { if (synchronization != null) { synchronization.onPendingSuccess(); } STATE_FIELD_UPDATER.lazySet(this, SUCCESS); synchronized(this) { if (waiting > 0) { notifyAll(); } } } }
ProviderFuture implements AsyncResult { @Override public void onSuccess() { if (STATE_FIELD_UPDATER.compareAndSet(this, INCOMPLETE, COMPLETING)) { if (synchronization != null) { synchronization.onPendingSuccess(); } STATE_FIELD_UPDATER.lazySet(this, SUCCESS); synchronized(this) { if (waiting > 0) { notifyAll(); } } } } }
ProviderFuture implements AsyncResult { @Override public void onSuccess() { if (STATE_FIELD_UPDATER.compareAndSet(this, INCOMPLETE, COMPLETING)) { if (synchronization != null) { synchronization.onPendingSuccess(); } STATE_FIELD_UPDATER.lazySet(this, SUCCESS); synchronized(this) { if (waiting > 0) { notifyAll(); } } } } ProviderFuture();  ProviderFuture(ProviderSynchronization synchronization); }
ProviderFuture implements AsyncResult { @Override public void onSuccess() { if (STATE_FIELD_UPDATER.compareAndSet(this, INCOMPLETE, COMPLETING)) { if (synchronization != null) { synchronization.onPendingSuccess(); } STATE_FIELD_UPDATER.lazySet(this, SUCCESS); synchronized(this) { if (waiting > 0) { notifyAll(); } } } } ProviderFuture();  ProviderFuture(ProviderSynchronization synchronization); @Override boolean isComplete(); @Override void onFailure(ProviderException result); @Override void onSuccess(); abstract void sync(); abstract boolean sync(long amount, TimeUnit unit); }
ProviderFuture implements AsyncResult { @Override public void onSuccess() { if (STATE_FIELD_UPDATER.compareAndSet(this, INCOMPLETE, COMPLETING)) { if (synchronization != null) { synchronization.onPendingSuccess(); } STATE_FIELD_UPDATER.lazySet(this, SUCCESS); synchronized(this) { if (waiting > 0) { notifyAll(); } } } } ProviderFuture();  ProviderFuture(ProviderSynchronization synchronization); @Override boolean isComplete(); @Override void onFailure(ProviderException result); @Override void onSuccess(); abstract void sync(); abstract boolean sync(long amount, TimeUnit unit);  }