SourceForge.net
2004-10-05 20:15:42 UTC
Bugs item #1040960, was opened at 2004-10-05 16:15
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=474136&aid=1040960&group_id=54559
Category: None
Group: v0.7.6.1
Status: Open
Resolution: None
Priority: 5
Submitted By: sshearer (kungfucode)
Assigned to: Nobody/Anonymous (nobody)
Summary: Singleton pattern not implemented properly in ConsumerManage
Initial Comment:
The _instance member is declared static, however,
multiple calls to createInstance will continually
create new ConsumerManager objects and assign their
references to _instance. With createInstance being
callable from anywhere, it is public after all, this
leaves the door open for potentially difficult to
diagnose concurrency issues down the road.
Recommend checking for null value in createInstance and
only creating a new object if the Singleton reference
_instance has yet to be initialized.
Also recommend synchronizing the method createInstance
to protect against problems stemming from calls to the
method by multiple threads.
Finally, _instance does not need to be declared static
since the null check as suggested above will take care
of maintaining only a single reference.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=474136&aid=1040960&group_id=54559
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=474136&aid=1040960&group_id=54559
Category: None
Group: v0.7.6.1
Status: Open
Resolution: None
Priority: 5
Submitted By: sshearer (kungfucode)
Assigned to: Nobody/Anonymous (nobody)
Summary: Singleton pattern not implemented properly in ConsumerManage
Initial Comment:
The _instance member is declared static, however,
multiple calls to createInstance will continually
create new ConsumerManager objects and assign their
references to _instance. With createInstance being
callable from anywhere, it is public after all, this
leaves the door open for potentially difficult to
diagnose concurrency issues down the road.
Recommend checking for null value in createInstance and
only creating a new object if the Singleton reference
_instance has yet to be initialized.
Also recommend synchronizing the method createInstance
to protect against problems stemming from calls to the
method by multiple threads.
Finally, _instance does not need to be declared static
since the null check as suggested above will take care
of maintaining only a single reference.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=474136&aid=1040960&group_id=54559