@ SuppressWarnings ( "unchecked" ) public void addCallback ( ListenableFutureCallback < ? super T > callback ) { Assert . notNull ( callback , "'callback' must not be null" ) ; synchronized ( mutex ) { switch ( state ) { case NEW : callbacks . add ( callback ) ; break ; case SUCCESS : callback . onSuccess ( ( T ) result ) ; break ; case FAILURE : callback . onFailure ( ( Throwable ) result ) ; break ; } } }
Adds the given callback to this registry .