com.zipwhip.api.CopyFutureStatusToNestedFutureWithCustomResult Maven / Gradle / Ivy
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 CopyFutureStatusToNestedFutureWithCustomResult implements Observer> {
private final static Logger LOGGER = LoggerFactory.getLogger(CopyFutureStatusToNestedFutureWithCustomResult.class);
final ObservableFuture nestedFuture;
final T2 result;
public CopyFutureStatusToNestedFutureWithCustomResult(ObservableFuture nestedFuture, T2 result) {
this.nestedFuture = nestedFuture;
this.result = result;
}
@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, result);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy