本文整理汇总了Java中akka.japi.Procedure.apply方法的典型用法代码示例。如果您正苦于以下问题:Java Procedure.apply方法的具体用法?Java Procedure.apply怎么用?Java Procedure.apply使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类akka.japi.Procedure
的用法示例。
在下文中一共展示了Procedure.apply方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: appendAndPersist
import akka.japi.Procedure; //导入方法依赖的package包/类
@Override
public boolean appendAndPersist(@Nonnull final ReplicatedLogEntry replicatedLogEntry,
@Nullable final Procedure<ReplicatedLogEntry> callback, boolean doAsync) {
context.getLogger().debug("{}: Append log entry and persist {} ", context.getId(), replicatedLogEntry);
if (!append(replicatedLogEntry)) {
return false;
}
Procedure<ReplicatedLogEntry> persistCallback = persistedLogEntry -> {
context.getLogger().debug("{}: persist complete {}", context.getId(), persistedLogEntry);
dataSizeSinceLastSnapshot += persistedLogEntry.size();
if (callback != null) {
callback.apply(persistedLogEntry);
}
};
if (doAsync) {
context.getPersistenceProvider().persistAsync(replicatedLogEntry, persistCallback);
} else {
context.getPersistenceProvider().persist(replicatedLogEntry, persistCallback);
}
return true;
}
示例2: invokeProcedure
import akka.japi.Procedure; //导入方法依赖的package包/类
@SuppressWarnings("checkstyle:IllegalCatch")
static <T> void invokeProcedure(final Procedure<T> procedure, final T argument) {
try {
procedure.apply(argument);
} catch (Exception e) {
LOG.error("An unexpected error occurred", e);
}
}
示例3: persist
import akka.japi.Procedure; //导入方法依赖的package包/类
/**
* Saves an event, updates actor state after the event was successfully saved, and then invokes the callback.
* @deprecated Use the type-safe persistEvent() variant instead.
*/
@Override
@Deprecated
public <A> void persist(A event, Procedure<A> callback) {
@SuppressWarnings("unchecked")
E e = (E) event;
super.persist(tagged(e), persisted -> {
updateState(e);
callback.apply(event);
});
}
示例4: persistAll
import akka.japi.Procedure; //导入方法依赖的package包/类
/**
* Saves multiple events, updates actor state and invoking the callback after each event is successfully saved.
* @deprecated Use the type-safe persistEvent() variant instead.
*/
@SuppressWarnings("unchecked")
@Override
@Deprecated
public <A> void persistAll(Iterable<A> events, Procedure<A> callback) {
super.persistAll(tagged((Iterable<E>) events), persisted -> {
updateState((E) persisted.payload());
callback.apply((A) persisted.payload());
});
}