本文整理汇总了Java中akka.actor.Status.Success方法的典型用法代码示例。如果您正苦于以下问题:Java Status.Success方法的具体用法?Java Status.Success怎么用?Java Status.Success使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类akka.actor.Status
的用法示例。
在下文中一共展示了Status.Success方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreateShard
import akka.actor.Status; //导入方法依赖的package包/类
@SuppressWarnings("checkstyle:IllegalCatch")
private void onCreateShard(final CreateShard createShard) {
LOG.debug("{}: onCreateShard: {}", persistenceId(), createShard);
Object reply;
try {
String shardName = createShard.getModuleShardConfig().getShardName();
if (localShards.containsKey(shardName)) {
LOG.debug("{}: Shard {} already exists", persistenceId(), shardName);
reply = new Status.Success(String.format("Shard with name %s already exists", shardName));
} else {
doCreateShard(createShard);
reply = new Status.Success(null);
}
} catch (Exception e) {
LOG.error("{}: onCreateShard failed", persistenceId(), e);
reply = new Status.Failure(e);
}
if (getSender() != null && !getContext().system().deadLetters().equals(getSender())) {
getSender().tell(reply, getSelf());
}
}
示例2: testOnCommand
import akka.actor.Status; //导入方法依赖的package包/类
@Test
public void testOnCommand() throws Exception {
final TestProbe probe = new TestProbe(system);
final GetClientRequest request = new GetClientRequest(probe.ref());
final AbstractDataStoreClientBehavior nextBehavior = behavior.onCommand(request);
final Status.Success success = probe.expectMsgClass(Status.Success.class);
Assert.assertEquals(behavior, success.status());
Assert.assertSame(behavior, nextBehavior);
}