Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Journal factory work with implementations that do not use the dispatcher directly #26

Merged
merged 1 commit into from
Dec 10, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/main/java/io/vlingo/symbio/store/journal/Journal.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,22 @@ static <A extends Actor, T, RS extends State<?>> Journal<T> using(final Stage st
stage.actorFor(Journal.class, implementor, dispatcher, additional);
}

/**
* Answer a new {@code Journal<T>}
* @param stage the Stage within which the {@code Journal<T>} is created
* @param implementor the {@code Class<A>} of the implementor
* @param additional the Object[] of additional parameters
* @param <A> the concrete type of the Actor implementing the {@code Journal<T>} protocol
* @param <T> the concrete type of {@code Entry<T>} stored and read, which maybe be String, byte[], or Object
* @return {@code Journal<T>}
*/
@SuppressWarnings("unchecked")
static <A extends Actor, T> Journal<T> using(final Stage stage, final Class<A> implementor, final Object...additional) {
return additional.length == 0 ?
stage.actorFor(Journal.class, implementor) :
stage.actorFor(Journal.class, implementor, additional);
}

/**
* The means by which the {@code Journal<T>} informs the sender of the result of any given append.
*/
Expand Down