[concurrency-interest] dealing with peoplethatquestionvisibility problems

Ernst, Matthias matthias.ernst at coremedia.com
Thu Mar 1 07:53:36 EST 2007


> I have made a few small changes to the blogentry

Peter,

two remarks:

as I understand "action2" comes before "action1". Construction also happens under the lock of the application context.
And I don't understand why you say this is only safe since 1.5. If the following is not safe in 1.4 what is?

T1:
synchronized(map) {
  manager = map.get("manager");
  if(manager == null) {
    manager = new Manager();
    manager.setDao(dao);
    map.put("manager", manager);
  }
}

T2:
synchronized(map) {
  manager = map.get("manager");
  // not null
}
manager.fire(...);



Matthias


-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/attachments/20070301/197848af/attachment.html 


More information about the Concurrency-interest mailing list