[QFJ-698] Not possible to restart a stopped SocketInitiator using FileLog Created: 09/Aug/12 Updated: 11/Sep/12 Resolved: 11/Sep/12 |
|
Status: | Resolved |
Project: | QuickFIX/J |
Component/s: | Engine |
Affects Version/s: | 1.5.2 |
Fix Version/s: | 1.5.3 |
Type: | Bug | Priority: | Major |
Reporter: | Mate Varga | Assignee: | Christoph John |
Resolution: | Fixed | Votes: | 0 |
Labels: | None |
Description |
This bug is NOT present in the case of Acceptors as they recreate sessions when they start up. |
Comments |
Comment by Mate Varga [ 09/Aug/12 ] |
A simple solution would be to recreate the sessions in SocketInitiator instead of re-registering them. I.e. in SocketInitiator.java: [Sorry for not giving you a diff, this is probably easier to understand for people and also this is not a patch as I haven't verified that it works properly, but should be more or less correct.] // Replace this: private synchronized void initialize() throws ConfigError { for (Session session : getSessionMap().values()) { Session.registerSession(session); } } startInitiators(); } // with this: private synchronized void initialize() throws ConfigError { if (!isInitialized) { createSessionInitiators(); isInitialized = true; } else { createSessions(); } } |
Comment by Mate Varga [ 24/Aug/12 ] |
I've seen your patch, and in SocketInitiator.java 77 finally { ... I don't really understand |
Comment by Christoph John [ 24/Aug/12 ] |
Hi, Regarding a): this evolved from another patch which was done on SocketAcceptor. There, a Boolean was used as lock variable which was wrong ( b): You are right about the scenario you described. What do you think? |
Comment by Mate Varga [ 24/Aug/12 ] |
a): b) |
Comment by Christoph John [ 24/Aug/12 ] |
a) To have it at least look a little bit like the SocketAcceptor which used Boolean for quite some time. b) I'll think a little about it and change it. Probably it is OK if the Initiator is just not initialized twice at the same time. |
Comment by Christoph John [ 11/Sep/12 ] |
Removed synchronization inside stop() method. We just want to make sure that initialization is not done twice/concurrently so we only synchronize access to start() method. |