akka.japi.Util类的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(7.0k)|赞(0)|评价(0)|浏览(146)

本文整理了Java中akka.japi.Util类的一些代码示例,展示了Util类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util类的具体详情如下:
包路径:akka.japi.Util
类名称:Util

Util介绍

暂无

代码示例

代码示例来源:origin: com.typesafe.akka/akka-testkit_2.11

/**
 * Same as <code>expectMsgAllOf(remainingOrDefault(), obj...)</code>, but correctly treating the
 * timeFactor.
 */
public Object[] expectMsgAllOf(Object... msgs) {
 return (Object[])
   p.expectMsgAllOf(Util.immutableSeq(msgs)).toArray(Util.classTag(Object.class));
}

代码示例来源:origin: com.typesafe.akka/akka-testkit_2.10

/**
 * Same as <code>receiveN(n, remaining())</code>, but correctly treating the
 * timeFactor.
 */
public Object[] receiveN(int n) {
 return (Object[]) p.receiveN(n).toArray(Util.classTag(Object.class));
}

代码示例来源:origin: com.typesafe.akka/akka-testkit_2.11

/**
 * Same as <code>expectMsgAnyClassOf(remainingOrDefault(), obj...)</code>, but correctly treating
 * the timeFactor.
 */
@SuppressWarnings("unchecked")
public <T> T expectMsgAnyClassOf(Class<? extends T>... classes) {
 final Object result = p.expectMsgAnyClassOf(Util.immutableSeq(classes));
 return (T) result;
}

代码示例来源:origin: com.typesafe.akka/akka-testkit_2.11

/**
 * Receive one message from the test actor and assert that it equals one of the given objects.
 * Wait time is bounded by the given duration, with an AssertionFailure being thrown in case of
 * timeout.
 *
 * @return the received object
 */
public Object expectMsgAnyOf(FiniteDuration max, Object... msgs) {
 return p.expectMsgAnyOf(max, Util.immutableSeq(msgs));
}

代码示例来源:origin: com.typesafe.akka/akka-testkit_2.10

@SuppressWarnings("unchecked")
public ReceiveWhile(Class<T> clazz, Duration max, Duration idle, int messages) {
 results = p.receiveWhile(max, idle, messages, new CachingPartialFunction<Object, T>() {
  public T match(Object msg) throws Exception {
   return ReceiveWhile.this.match(msg);
  }
 }).toArray(Util.classTag(clazz));
}

代码示例来源:origin: com.typesafe.akka/akka-http-core_2.11

public static MediaType.WithOpenCharset customWithOpenCharset(String mainType, String subType, java.util.Map<String, String> params, boolean allowArbitrarySubtypes, String... fileExtensions) {
  scala.collection.immutable.List<String> fileEx = akka.japi.Util.<String>immutableSeq(java.util.Arrays.asList(fileExtensions)).toList();
  scala.collection.immutable.Map<String, String> p = Util.convertMapToScala(params);
  return akka.http.scaladsl.model.MediaType.customWithOpenCharset(mainType, subType, fileEx, p, allowArbitrarySubtypes);
}

代码示例来源:origin: com.typesafe.akka/akka-actor_2.10

public static <T> Seq<T> seq(T... ts) {
 return Util.immutableSeq(ts);
}

代码示例来源:origin: eclipse/ditto

/**
 * Converts Scala Seq to Java array.
 *
 * @see akka.testkit.JavaTestKit#expectMsgAllOf(Object...)
 */
private static <T> T[] toJavaArray(final Class<T> clazz, final Seq<T> seq) {
  return (T[]) seq.toArray(Util.classTag(clazz));
}

代码示例来源:origin: com.typesafe.akka/akka-testkit_2.10

/**
 * Receive N messages in a row before the given deadline.
 */
public Object[] receiveN(int n, FiniteDuration max) {
 return (Object[]) p.receiveN(n, max).toArray(Util.classTag(Object.class));
}

代码示例来源:origin: com.typesafe.akka/akka-testkit_2.10

/**
 * Receive one message from the test actor and assert that it conforms to one
 * of the given classes. Wait time is bounded by the given duration, with an
 * AssertionFailure being thrown in case of timeout.
 * 
 * @return the received object
 */
public Object expectMsgAnyClassOf(FiniteDuration max, Class<?>... classes) {
 return p.expectMsgAnyClassOf(max, Util.immutableSeq(classes));
}

代码示例来源:origin: com.typesafe.akka/akka-testkit_2.10

/**
 * Same as <code>expectMsgAnyOf(remaining(), obj...)</code>, but correctly
 * treating the timeFactor.
 */
public Object expectMsgAnyOf(Object... msgs) {
 return p.expectMsgAnyOf(Util.immutableSeq(msgs));
}

代码示例来源:origin: com.typesafe.akka/akka-testkit_2.11

@SuppressWarnings("all")
public ReceiveWhile(Class<T> clazz, Duration max, Duration idle, int messages) {
 results =
   p.receiveWhile(
       max,
       idle,
       messages,
       new CachingPartialFunction<Object, T>() {
        public T match(Object msg) throws Exception {
         return ReceiveWhile.this.match(msg);
        }
       })
     .toArray(Util.classTag(clazz));
}

代码示例来源:origin: com.typesafe.akka/akka-http-core_2.12

public static MediaType.Binary customBinary(String mainType, String subType, MediaType.Compressibility compressibility, java.util.Map<String, String> params, boolean allowArbitrarySubtypes, String... fileExtensions) {
  akka.http.scaladsl.model.MediaType.Compressibility comp = (akka.http.scaladsl.model.MediaType.Compressibility) compressibility;
  scala.collection.immutable.List<String> fileEx = akka.japi.Util.<String>immutableSeq(java.util.Arrays.asList(fileExtensions)).toList();
  scala.collection.immutable.Map<String, String> p = Util.convertMapToScala(params);
  return akka.http.scaladsl.model.MediaType.customBinary(mainType, subType, comp, fileEx, p, allowArbitrarySubtypes);
}

代码示例来源:origin: com.typesafe.akka/akka-actor_2.12

@SafeVarargs
 public static <T> Seq<T> seq(T... ts) {
  return Util.immutableSeq(ts);
 }
}

代码示例来源:origin: wxyyxc1992/Backend-Boilerplates

public static void main(String[] args) throws Exception {
  ActorSystem system = ActorSystem.create("calculator-system");
  ActorRef calculatorService =
   system.actorOf(Props.create(ArithmeticService.class), "arithmetic-service");

  // (3 + 5) / (2 * (1 + 1))
  Expression task = new Divide(
   new Add(new Const(3), new Const(5)),
   new Multiply(
    new Const(2),
    new Add(new Const(1), new Const(1))
   )
  );

  FiniteDuration duration = Duration.create(1, TimeUnit.SECONDS);
  Integer result = Await.result(ask(calculatorService, task, new Timeout(duration)).mapTo(classTag(Integer.class)), duration);
  System.out.println("Got result: " + result);

  Await.ready(system.terminate(), Duration.Inf());
 }
}

代码示例来源:origin: com.typesafe.akka/akka-testkit_2.12

/**
 * Same as <code>expectMsgAllOf(remainingOrDefault(), obj...)</code>, but correctly treating the
 * timeFactor.
 */
public Object[] expectMsgAllOf(Object... msgs) {
 return (Object[])
   p.expectMsgAllOf(Util.immutableSeq(msgs)).toArray(Util.classTag(Object.class));
}

代码示例来源:origin: com.typesafe.akka/akka-testkit_2.11

/** Same as <code>receiveN(n, remaining())</code>, but correctly treating the timeFactor. */
public Object[] receiveN(int n) {
 return (Object[]) p.receiveN(n).toArray(Util.classTag(Object.class));
}

代码示例来源:origin: com.typesafe.akka/akka-testkit_2.11

/**
 * Receive one message from the test actor and assert that it conforms to one of the given
 * classes. Wait time is bounded by the given duration, with an AssertionFailure being thrown in
 * case of timeout.
 *
 * @return the received object
 */
public Object expectMsgAnyClassOf(FiniteDuration max, Class<?>... classes) {
 return p.expectMsgAnyClassOf(max, Util.immutableSeq(classes));
}

代码示例来源:origin: com.typesafe.akka/akka-testkit_2.12

/**
 * Same as <code>expectMsgAnyOf(remainingOrDefault(), obj...)</code>, but correctly treating the
 * timeFactor.
 */
public Object expectMsgAnyOf(Object... msgs) {
 return p.expectMsgAnyOf(Util.immutableSeq(msgs));
}

代码示例来源:origin: com.typesafe.akka/akka-testkit_2.12

@SuppressWarnings("all")
public ReceiveWhile(Class<T> clazz, Duration max, Duration idle, int messages) {
 results =
   p.receiveWhile(
       max,
       idle,
       messages,
       new CachingPartialFunction<Object, T>() {
        public T match(Object msg) throws Exception {
         return ReceiveWhile.this.match(msg);
        }
       })
     .toArray(Util.classTag(clazz));
}

相关文章