当前位置: 首页>>代码示例>>Java>>正文


Java Procedure.apply方法代码示例

本文整理汇总了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;
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:29,代码来源:ReplicatedLogImpl.java

示例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);
    }
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:9,代码来源:NonPersistentDataProvider.java

示例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);
    });
}
 
开发者ID:Tradeshift,项目名称:ts-reaktive,代码行数:15,代码来源:AbstractStatefulPersistentActor.java

示例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());
    });
}
 
开发者ID:Tradeshift,项目名称:ts-reaktive,代码行数:14,代码来源:AbstractStatefulPersistentActor.java


注:本文中的akka.japi.Procedure.apply方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。