deadlock fixed BLD200303311356
authormmatula@netbeans.org
Mon, 31 Mar 2003 13:46:04 +0000
changeset 12598ab1b7c5494a
parent 1258 596396c66ee1
child 1260 ae562a72373f
deadlock fixed
mdr/src/org/netbeans/mdr/handlers/BaseObjectHandler.java
     1.1 --- a/mdr/src/org/netbeans/mdr/handlers/BaseObjectHandler.java	Sat Mar 29 00:18:00 2003 +0000
     1.2 +++ b/mdr/src/org/netbeans/mdr/handlers/BaseObjectHandler.java	Mon Mar 31 13:46:04 2003 +0000
     1.3 @@ -207,13 +207,15 @@
     1.4              /* create handler object, if necessary */
     1.5              Constructor cons = cl.getConstructor(new Class[] {cls});
     1.6  
     1.7 -            synchronized (facilityCache) {
     1.8 -                Object oldRecord = facilityCache.get(s.getMofId());
     1.9 -                if (oldRecord == null) {
    1.10 -                    oldRecord = cons.newInstance(new Object[] {s});
    1.11 -                    facilityCache.put(s.getMofId(), oldRecord);
    1.12 +            synchronized (s.getMdrStorage().getStorageByMofId(s.getMofId())) {
    1.13 +                synchronized (facilityCache) {
    1.14 +                    Object oldRecord = facilityCache.get(s.getMofId());
    1.15 +                    if (oldRecord == null) {
    1.16 +                        oldRecord = cons.newInstance(new Object[] {s});
    1.17 +                        facilityCache.put(s.getMofId(), oldRecord);
    1.18 +                    }
    1.19 +                    return (BaseObjectHandler) oldRecord;
    1.20                  }
    1.21 -                return (BaseObjectHandler) oldRecord;
    1.22              }
    1.23  	} catch (NoSuchMethodException e) {
    1.24              throw (DebugException) Logger.getDefault().annotate(new DebugException(), e);