io.vlingo.actors.Stoppable Java Examples
The following examples show how to use
io.vlingo.actors.Stoppable.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Sourced.java From vlingo-lattice with Mozilla Public License 2.0 | 6 votes |
/** * Restore the state of my concrete extender from a possibly snaptshot * and stream of events. */ @Override protected final void restore() { stowMessages(Stoppable.class); journalInfo.journal.streamReader(getClass().getSimpleName()) .andThenTo(reader -> reader.streamFor(this.streamName)) .andThenConsume(stream -> { restoreSnapshot(stream.snapshot); restoreFrom(journalInfo.entryAdapterProvider.asSources(stream.entries), stream.streamVersion); disperseStowedMessages(); }) .otherwiseConsume(stream -> { disperseStowedMessages(); }) .recoverFrom(cause -> { disperseStowedMessages(); final String message = "Stream not recovered for: " + type() + "(" + this.streamName + ") because: " + cause.getMessage(); throw new StorageException(Result.Failure, message, cause); }); }
Example #2
Source File: CalculatorActor.java From vlingo-examples with Mozilla Public License 2.0 | 5 votes |
@Override public void informCalculation(final double result) { state.pi += result; if (++state.resultsCount >= state.totalMessages) { state.completes.with(state.pi); selfAs(Stoppable.class).stop(); } }
Example #3
Source File: FileStabilityBySizeCheckerActor.java From vlingo-examples with Mozilla Public License 2.0 | 4 votes |
private void completed() { completed = true; selfAs(Stoppable.class).conclude(); }