All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.zipwhip.api.CopyFutureStatusToNestedFuture Maven / Gradle / Ivy

The newest version!
package com.zipwhip.api;

import com.zipwhip.concurrent.ObservableFuture;
import com.zipwhip.events.Observer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * When the future finishes, if it's the current "connectFuture" clean up the references.
 */
public class CopyFutureStatusToNestedFuture implements Observer> {

    private final static Logger LOGGER = LoggerFactory.getLogger(CopyFutureStatusToNestedFuture.class);

    final ObservableFuture nestedFuture;

    public CopyFutureStatusToNestedFuture(ObservableFuture nestedFuture) {
        this.nestedFuture = nestedFuture;
    }

    @Override
    public void notify(Object sender, ObservableFuture future) {
        LOGGER.trace(String.format("Cloning the state from %s to %s", future, nestedFuture));
        // notify people that care.
        NestedObservableFuture.syncState(future, nestedFuture);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy