com.fnklabs.draenei.orm.FutureTimerCallback Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fnklabs-draenei Show documentation
Show all versions of fnklabs-draenei Show documentation
ORM for Cassandra but with distributed cache and analytics utils from package
package com.fnklabs.draenei.orm;
import com.codahale.metrics.Timer;
import com.google.common.util.concurrent.FutureCallback;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Function for stopping timer on future completion
*
* @param Future type
*/
class FutureTimerCallback implements FutureCallback {
private static final Logger LOGGER = LoggerFactory.getLogger(FutureTimerCallback.class);
private final Timer.Context timer;
FutureTimerCallback(Timer.Context timer) {
this.timer = timer;
}
@Override
public void onSuccess(Input result) {
timer.stop();
}
@Override
public void onFailure(Throwable t) {
timer.stop();
LOGGER.warn("Cant complete operation", t);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy