Package org.nustaq.kontraktor.util
Class Hoarde<T extends Actor>
java.lang.Object
org.nustaq.kontraktor.util.Hoarde<T>
public class Hoarde<T extends Actor>
extends java.lang.Object
Created by ruedi on 07.09.14.
a utility class allowing to address/manage multiple actors of same type
-
Constructor Summary
-
Method Summary
Modifier and Type Method Description Hoarde<T>each(java.util.function.BiConsumer<T,java.lang.Integer> init)same as other each but with indexHoarde<T>each(java.util.function.Consumer<T> tocall)iterate over each actor and execute tocall.TgetActor(int i)intgetSize()<X> IPromise<T>[]map(java.util.function.BiFunction<T,java.lang.Integer,IPromise<X>> init)IPromiseordered(java.util.function.Function<T,IPromise> toCall)calls given function round robin. typical use: hoarde.ordered( actor -> actor.decode(byte[]) ).onResult( decodedObj -> businesslogic(decodedObj) ); after
-
Constructor Details
-
Method Details
-
map
-
each
iterate over each actor and execute tocall. E.g. hoarde.each( actor -> actor.init() )- Parameters:
tocall-- Returns:
-
each
same as other each but with index- Parameters:
init-- Returns:
-
ordered
calls given function round robin. typical use: hoarde.ordered( actor -> actor.decode(byte[]) ).onResult( decodedObj -> businesslogic(decodedObj) ); after- Parameters:
toCall-- Returns:
-
getSize
public int getSize() -
getActor
-