public class Actors extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
CONT
use value as error to indicate more messages are to come (else remoting will close channel).
|
static int |
DEFAULT_TIMOUT |
static java.util.function.Supplier<Scheduler> |
defaultScheduler |
static Timer |
delayedCalls |
static ThreadPoolExecutor |
exec |
static String |
FIN
use this value to signal no more messages.
|
static String |
FINSILENT
use value to signal no more messages.
|
static ActorsImpl |
instance |
static int |
MAX_EXTERNAL_THREADS_POOL_SIZE |
| Constructor and Description |
|---|
Actors() |
| Modifier and Type | Method and Description |
|---|---|
static void |
AddDeadLetter(String s) |
static <T> IPromise<IPromise<T>[]> |
all(IPromise<T>... futures)
similar to es6 Promise.all method, however non-IPromise objects are not allowed
returns a future which is settled once all promises provided are settled
|
static <T> IPromise<List<IPromise<T>>> |
all(List<IPromise<T>> futures)
similar to es6 Promise.all method, however non-IPromise objects are not allowed
returns a future which is settled once all promises provided are settled
|
static <T extends Actor> |
AsActor(Class<T> actorClazz)
create an new actor.
|
static <T extends Actor> |
AsActor(Class<T> actorClazz,
int qSize)
create an new actor.
|
static <T extends Actor> |
AsActor(Class<T> actorClazz,
Scheduler scheduler)
create an new actor dispatched in the given DispatcherThread
|
static <T extends Actor> |
AsActor(Class<T> actorClazz,
Scheduler scheduler,
int qsize)
create an new actor dispatched in the given DispatcherThread
|
static <T> java.util.stream.Stream<T> |
awaitAll(IPromise<T>... futures)
await until all futures are settled and stream their results.
|
static <T> java.util.stream.Stream<T> |
awaitAll(List<IPromise<T>> futures) |
static <T> java.util.stream.Stream<T> |
awaitAll(long timeoutMS,
IPromise<T>... futures)
await until all futures are settled and stream their results
|
static <T> java.util.stream.Stream<T> |
awaitAll(long timeoutMS,
List<IPromise<T>> futures) |
static IPromise |
complete()
abbreviation for Promise creation to make code more concise
|
static <T> IPromise<T> |
complete(T res,
Object err)
abbreviation for Promise creation to make code more concise
|
static ConcurrentLinkedQueue<String> |
DeadLetters()
messages that have been dropped or have been sent to stopped actors
|
static <T> T |
InThread(T anInterface)
in case called from an actor, wraps the given interface instance into a proxy such that
all calls on the interface get scheduled on the calling actors thread (avoids accidental multithreading
when handing out callback/listener interfaces from an actor)
if called from outside an actor thread, NOP
|
static boolean |
isCont(Object o)
helper to check for "special" error objects.
|
static boolean |
isError(Object o)
helper to check for "special" error objects.
|
static boolean |
isFinal(Object error)
return if given error Object signals end of callback stream
|
static boolean |
isResult(Object error) |
static boolean |
isSilentFinal(Object o)
helper to check for "special" error objects.
|
static <T> IPromise<T> |
race(Collection<IPromise<T>> futures)
similar to es6 Promise.race method, however non-IPromise objects are not allowed
returns a future which is settled once one of the futures provided gets settled
|
static <T> IPromise<T> |
race(IPromise<T>... futures)
similar to es6 Promise.race method, however non-IPromise objects are not allowed
returns a future which is settled once one of the futures provided gets settled
|
static <T> IPromise<T> |
reject(Object err)
abbreviation for Promise creation to make code more concise
|
static IPromise |
resolve()
abbreviation for Promise creation to make code more concise
|
static <T> IPromise<T> |
resolve(T res)
abbreviation for Promise creation to make code more concise
|
static <T> java.util.stream.Stream<T> |
stream(T... t)
utility addition to java 8 streams
|
static void |
SubmitDelayed(long millis,
Runnable task)
utility function.
|
static void |
yield()
processes messages from mailbox / callbackqueue until no messages are left
NOP if called from non actor thread.
|
static void |
yield(long timeout)
process messages on the mailbox/callback queue until timeout is reached.
|
public static int MAX_EXTERNAL_THREADS_POOL_SIZE
public static int DEFAULT_TIMOUT
public static ThreadPoolExecutor exec
public static ActorsImpl instance
public static Timer delayedCalls
public static java.util.function.Supplier<Scheduler> defaultScheduler
public static final String FINSILENT
public static final String CONT
public static final String FIN
public static boolean isFinal(Object error)
error - public static boolean isSilentFinal(Object o)
o - public static boolean isCont(Object o)
o - public static boolean isResult(Object error)
public static boolean isError(Object o)
o - public static void SubmitDelayed(long millis,
Runnable task)
public static void AddDeadLetter(String s)
public static <T> T InThread(T anInterface)
T - anInterface - public static ConcurrentLinkedQueue<String> DeadLetters()
public static <T extends Actor> T AsActor(Class<T> actorClazz)
T - actorClazz - public static <T extends Actor> T AsActor(Class<T> actorClazz, int qSize)
T - actorClazz - public static <T extends Actor> T AsActor(Class<T> actorClazz, Scheduler scheduler)
T - actorClazz - public static <T extends Actor> T AsActor(Class<T> actorClazz, Scheduler scheduler, int qsize)
T - actorClazz - public static <T> IPromise<IPromise<T>[]> all(IPromise<T>... futures)
public static <T> IPromise<List<IPromise<T>>> all(List<IPromise<T>> futures)
public static <T> java.util.stream.Stream<T> awaitAll(long timeoutMS, IPromise<T>... futures)
public static <T> java.util.stream.Stream<T> awaitAll(IPromise<T>... futures)
public static <T> java.util.stream.Stream<T> awaitAll(List<IPromise<T>> futures)
public static <T> java.util.stream.Stream<T> awaitAll(long timeoutMS, List<IPromise<T>> futures)
public static <T> IPromise<T> race(IPromise<T>... futures)
public static <T> IPromise<T> race(Collection<IPromise<T>> futures)
public static <T> java.util.stream.Stream<T> stream(T... t)
T - t - public static <T> IPromise<T> resolve(T res)
T - res - public static <T> IPromise<T> reject(Object err)
public static <T> IPromise<T> complete(T res, Object err)
public static IPromise complete()
public static IPromise resolve()
public static void yield()
public static void yield(long timeout)
timeout - Copyright © 2015. All rights reserved.