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


Java ActorSystem.actorSelection方法代码示例

本文整理汇总了Java中akka.actor.ActorSystem.actorSelection方法的典型用法代码示例。如果您正苦于以下问题:Java ActorSystem.actorSelection方法的具体用法?Java ActorSystem.actorSelection怎么用?Java ActorSystem.actorSelection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在akka.actor.ActorSystem的用法示例。


在下文中一共展示了ActorSystem.actorSelection方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createConnection

import akka.actor.ActorSystem; //导入方法依赖的package包/类
private static void createConnection() {
  try{
  ProjectLogger.log("ActorUtility createConnection method start....");
  ActorSystem system =
      ActorSystem.create("ActorApplication",ConfigFactory.load().getConfig("ActorConfig"));
  
  String path = PropertiesCache.getInstance().getProperty("remote.actor.path");
  try {
    if (!ProjectUtil.isStringNullOREmpty(System.getenv(JsonKey.SUNBIRD_ACTOR_IP))
        && !ProjectUtil.isStringNullOREmpty(System.getenv(JsonKey.SUNBIRD_ACTOR_PORT))) {
      ProjectLogger.log("value is taking from system env");
      path = MessageFormat.format(
          PropertiesCache.getInstance().getProperty("remote.actor.env.path"),
          System.getenv(JsonKey.SUNBIRD_ACTOR_IP), System.getenv(JsonKey.SUNBIRD_ACTOR_PORT));
    }
    ProjectLogger.log("Actor path is ==" + path, LoggerEnum.INFO.name());
  } catch (Exception e) {
    ProjectLogger.log(e.getMessage(), e);
  }
  selection = system.actorSelection(path);
  ProjectLogger.log("ActorUtility selection reference    : "+selection);
  }catch(Exception ex){
    ProjectLogger.log("Exception Occurred while creating remote connection in ActorUtility createConnection method "+ex);
  }
}
 
开发者ID:project-sunbird,项目名称:sunbird-utils,代码行数:26,代码来源:ActorUtility.java

示例2: createActorContextMock

import akka.actor.ActorSystem; //导入方法依赖的package包/类
private static ActorContext createActorContextMock(final ActorSystem system, final ActorRef actor) {
    final ActorContext mock = mock(ActorContext.class);
    final Promise<PrimaryShardInfo> promise = new scala.concurrent.impl.Promise.DefaultPromise<>();
    final ActorSelection selection = system.actorSelection(actor.path());
    final PrimaryShardInfo shardInfo = new PrimaryShardInfo(selection, (short) 0);
    promise.success(shardInfo);
    when(mock.findPrimaryShardAsync(SHARD)).thenReturn(promise.future());
    return mock;
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:10,代码来源:AbstractDataStoreClientBehaviorTest.java

示例3: createActorContextMock

import akka.actor.ActorSystem; //导入方法依赖的package包/类
protected static ActorContext createActorContextMock(final ActorSystem system, final ActorRef actor) {
    final ActorContext mock = mock(ActorContext.class);
    final Promise<PrimaryShardInfo> promise = new DefaultPromise<>();
    final ActorSelection selection = system.actorSelection(actor.path());
    final PrimaryShardInfo shardInfo = new PrimaryShardInfo(selection, (short) 0);
    promise.success(shardInfo);
    when(mock.findPrimaryShardAsync(any())).thenReturn(promise.future());
    return mock;
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:10,代码来源:AbstractClientHistoryTest.java

示例4: createActorContextMock

import akka.actor.ActorSystem; //导入方法依赖的package包/类
private static ActorContext createActorContextMock(final ActorSystem system, final ActorRef actor) {
    final ActorContext mock = mock(ActorContext.class);
    final Promise<PrimaryShardInfo> promise = new scala.concurrent.impl.Promise.DefaultPromise<>();
    final ActorSelection selection = system.actorSelection(actor.path());
    final PrimaryShardInfo shardInfo = new PrimaryShardInfo(selection, (short) 0);
    promise.success(shardInfo);
    when(mock.findPrimaryShardAsync(any())).thenReturn(promise.future());
    return mock;
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:10,代码来源:AbstractClientHandleTest.java

示例5: createActorContextMock

import akka.actor.ActorSystem; //导入方法依赖的package包/类
private static ActorContext createActorContextMock(final ActorSystem system, final ActorRef actor) {
    final ActorContext mock = mock(ActorContext.class);
    final Promise<PrimaryShardInfo> promise = new scala.concurrent.impl.Promise.DefaultPromise<>();
    final ActorSelection selection = system.actorSelection(actor.path());
    final PrimaryShardInfo shardInfo = new PrimaryShardInfo(selection, (short) 0);
    promise.success(shardInfo);
    when(mock.findPrimaryShardAsync("default")).thenReturn(promise.future());
    return mock;
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:10,代码来源:ModuleShardBackendResolverTest.java

示例6: createConnectionForBackgroundActors

import akka.actor.ActorSystem; //导入方法依赖的package包/类
public static void createConnectionForBackgroundActors() {
  String path = PropertiesCache.getInstance().getProperty("background.remote.actor.path");
  ActorSystem system = null;
  String bkghost = System.getenv(JsonKey.BKG_SUNBIRD_ACTOR_SERVICE_IP);
  String bkgport = System.getenv(JsonKey.BKG_SUNBIRD_ACTOR_SERVICE_PORT);
  Config con = null;
  if ("local"
      .equalsIgnoreCase(PropertiesCache.getInstance().getProperty("api_actor_provider"))) {
    con = ConfigFactory.load().getConfig(ACTOR_CONFIG_NAME);
    system = akka.actor.ActorSystem.create(REMOTE_ACTOR_SYSTEM_NAME, con);
  }else{
    system = RequestRouterActor.getSystem();
  }
  try {
    if (!ProjectUtil.isStringNullOREmpty(bkghost) && !ProjectUtil.isStringNullOREmpty(bkgport)) {
      ProjectLogger.log("value is taking from system env");
      path = MessageFormat.format(
          PropertiesCache.getInstance().getProperty("background.remote.actor.env.path"),
          System.getenv(JsonKey.BKG_SUNBIRD_ACTOR_SERVICE_IP),
          System.getenv(JsonKey.BKG_SUNBIRD_ACTOR_SERVICE_PORT));
    }
    ProjectLogger.log("Actor path is ==" + path, LoggerEnum.INFO.name());
  } catch (Exception e) {
    ProjectLogger.log(e.getMessage(), e);
  }
  selection = system.actorSelection(path);
  ProjectLogger.log("ActorUtility selection reference    : " + selection);
}
 
开发者ID:project-sunbird,项目名称:sunbird-lms-mw,代码行数:29,代码来源:RequestRouterActor.java


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