[QFJ-185] Improper use of synchronized keyword Created: 30/May/07  Updated: 04/Jul/07  Resolved: 01/Jun/07

Status: Closed
Project: QuickFIX/J
Component/s: Engine
Affects Version/s: 1.1.0
Fix Version/s: 1.2.0

Type: Bug Priority: Major
Reporter: Qiyan Li Assignee: Steve Bate
Resolution: Fixed Votes: 0
Labels: None
Environment:

All



 Description   

In the quickfix.SocketInitiator class, lines [77, 84] are as follows (version 1.1.0 source code):

private void initialize() throws ConfigError {
synchronized (isStarted) {
if (isStarted == Boolean.FALSE)

{ initiateSessions(eventHandlingStrategy); }

isStarted = Boolean.TRUE;
}
}

which incorrectly uses the synchronized keyword because Java locks on objects not variables. In other words, threads would lock on Boolean.TRUE and Boolean.FALSE, which could in turn cause deadlocks.



 Comments   
Comment by Steve Bate [ 30/May/07 ]

Good catch. That's been there for about 1.5 years now. I don't even remember why it was done. It looks like a normal synchronization method would be fine. I'll make the changes in 1.1.1.

Generated at Sat May 18 06:51:08 UTC 2024 using JIRA 7.5.2#75007-sha1:9f5725bb824792b3230a5d8716f0c13e296a3cae.