Skip to content

Pass SessionID to MemoryStore constructor from MemoryStoreFactory #161

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

Merged
merged 4 commits into from
Jan 25, 2018
Merged
Show file tree
Hide file tree
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
7 changes: 4 additions & 3 deletions quickfixj-core/src/main/java/quickfix/MemoryStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ public MemoryStore() throws IOException {
reset();
}

public MemoryStore(SessionID sessionID) {
public MemoryStore(SessionID sessionID) throws IOException {
this.sessionID = sessionID;
reset();
}

public void get(int startSequence, int endSequence, Collection<String> messages) throws IOException {
Expand Down Expand Up @@ -111,8 +112,8 @@ public void setNextTargetMsgSeqNum(int next) throws IOException {
public void refresh() throws IOException {
// IOException is declared to maintain strict compatibility with QF JNI
final String text = "memory store does not support refresh!";
if (sessionID != null) {
Session session = Session.lookupSession(sessionID);
final Session session = sessionID != null ? Session.lookupSession(sessionID) : null;
if (session != null) {
session.getLog().onErrorEvent("ERROR: " + text);
} else {
LoggerFactory.getLogger(MemoryStore.class).error(text);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class MemoryStoreFactory implements MessageStoreFactory {

public MessageStore create(SessionID sessionID) {
try {
return new MemoryStore();
return new MemoryStore(sessionID);
} catch (IOException e) {
throw new RuntimeError(e);
}
Expand Down