Package org.nustaq.kontraktor
Class Spore<I,O>
java.lang.Object
org.nustaq.kontraktor.Spore<I,O>
- All Implemented Interfaces:
Serializable,Cloneable
A Spore is sent to a foreign actor executes on its data and sends results back to caller.
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()voidto called from remote site. directly send stuff to remote site via callback.voidfinish()to be called at remote side when using streaming to deliver multiple results, call this in order to signal no further results are expected.booleanto be read at remote side in order to decide wether to stop e.g. iteration.abstract voidimplements code to be executed at receiver sidevoidsetExpectedFinishCount(int count) setForEach(Callback<O> cb) use local (sender side).protected voidprotected voidstreamError(Object err) note that sending an error implicitely will close the backstream.
-
Field Details
-
cb
-
finished
protected transient volatile boolean finished
-
-
Constructor Details
-
Spore
public Spore()
-
-
Method Details
-
setExpectedFinishCount
public void setExpectedFinishCount(int count) -
remote
implements code to be executed at receiver side- Parameters:
input-
-
setForEach
use local (sender side). Register and receive data streamed back from remote spore execution.- Parameters:
cb-
-
onFinish
-
finish
public void finish()to be called at remote side when using streaming to deliver multiple results, call this in order to signal no further results are expected. -
streamError
note that sending an error implicitely will close the backstream.- Parameters:
err-
-
stream
-
complete
to called from remote site. directly send stuff to remote site via callback. Warning: prefer stream(), streamError() and finish(). this can be used for generic exception catching etc. Take care to not accidentally introduce multithreading .. Any error != 'CONT' will shut down the backchannel to remote callee afterwards.- Parameters:
res-err-
-
isFinished
public boolean isFinished()to be read at remote side in order to decide wether to stop e.g. iteration.- Returns:
-
clone
-