use of com.uber.m3.util.Duration in project cadence-client by uber-java.
the class NoopScope method getInstance.
public static synchronized Scope getInstance() {
if (noopScope == null) {
noopCounter = delta -> {
};
noopGauge = value -> {
};
noopTimer = new Timer() {
@Override
public void record(Duration interval) {
}
@Override
public Stopwatch start() {
return new Stopwatch(0, stopwatchStart -> {
});
}
};
noopHistogram = new Histogram() {
@Override
public void recordValue(double value) {
}
@Override
public void recordDuration(Duration value) {
}
@Override
public Stopwatch start() {
return new Stopwatch(0, stopwatchStart -> {
});
}
};
noopScope = new NoopScope();
}
return noopScope;
}
use of com.uber.m3.util.Duration in project sdk-java by temporalio.
the class ReplayWorkflowContextImpl method newTimer.
@Override
public Functions.Proc1<RuntimeException> newTimer(Duration delay, Functions.Proc1<RuntimeException> callback) {
if (delay.compareTo(Duration.ZERO) <= 0) {
callback.apply(null);
return (e) -> {
};
}
StartTimerCommandAttributes attributes = StartTimerCommandAttributes.newBuilder().setStartToFireTimeout(ProtobufTimeUtils.toProtoDuration(delay)).setTimerId(workflowStateMachines.randomUUID().toString()).build();
Functions.Proc cancellationHandler = workflowStateMachines.newTimer(attributes, (event) -> handleTimerCallback(callback, event));
return (e) -> cancellationHandler.apply();
}
Aggregations