當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。