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 Supplier<Scheduler> |
defaultScheduler |
static Timer |
delayedCalls |
static ThreadPoolExecutor |
exec |
static ActorsImpl |
instance |
static int |
MAX_EXTERNAL_THREADS_POOL_SIZE |
static String |
version |
| Constructor and Description |
|---|
Actors() |
| Modifier and Type | Method and Description |
|---|---|
static void |
AddDeadLetter(String s) |
static <T> IPromise<IPromise<T>[]> |
all(int count,
Function<Integer,IPromise<T>> loop) |
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> IPromise<List<T>> |
allMapped(List<IPromise<T>> futures)
similar all but map promises to their content
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 Actor |
AsUntypedActor(Actor instance) |
static <T> Stream<T> |
awaitAll(IPromise<T>... futures)
await until all futures are settled and stream their results.
|
static <T> Stream<T> |
awaitAll(List<IPromise<T>> futures) |
static <T> Stream<T> |
awaitAll(long timeoutMS,
IPromise<T>... futures)
await until all futures are settled and stream their results
|
static <T> 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 Queue<String> |
DeadLetters()
messages that have been dropped or have been sent to stopped actors
|
static <T> KFlow<T> |
flow() |
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 |
isComplete(Object error) |
static boolean |
isCont(Object o)
helper to check for "special" error object "CONT". cont signals further callback results might be
sent (important for remoting as channels need to get cleaned up)
|
static boolean |
isError(Object err)
helper to check for "special" error objects.
|
static boolean |
isErrorOrComplete(Object error)
return if given error Object signals an error or a 'complete' signal
|
static boolean |
isResult(Object error) |
static boolean |
isTimeout(Object error) |
static <T> Promise<T> |
promise()
shorthand constructor
|
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> 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.
|
static void |
yieldCallbacks(long timeout)
only process callbacks until timeout or cbQ is empty.
|
public static int MAX_EXTERNAL_THREADS_POOL_SIZE
public static int DEFAULT_TIMOUT
public static ThreadPoolExecutor exec
public static final String version
public static ActorsImpl instance
public static Timer delayedCalls
public static final String CONT
public static boolean isErrorOrComplete(Object error)
error - public static boolean isTimeout(Object error)
public static boolean isComplete(Object error)
public static boolean isCont(Object o)
o - public static boolean isResult(Object error)
public static boolean isError(Object err)
err - 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 Queue<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> IPromise<List<T>> allMapped(List<IPromise<T>> futures)
public static <T> Stream<T> awaitAll(long timeoutMS, IPromise<T>... futures)
public static <T> Stream<T> awaitAll(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> Stream<T> stream(T... t)
T - t - public static <T> KFlow<T> flow()
public static <T> IPromise<T> resolve(T res)
T - res - public static <T> IPromise<T> reject(Object err)
public static <T> Promise<T> promise()
T - 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 - public static void yieldCallbacks(long timeout)
timeout - Copyright © 2019. All rights reserved.