common_helper/src/main/java/com/xiongyingqi/util/concurrent/ListenableFutureCallbackRegistry.java
@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;
            }
        }
    }
@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.

@param callback the callback to add