ContainerAnalysis getAnalysis(final Class cls) throws RMIIIOPViolationException {
        ContainerAnalysis ret = null;
        boolean created = false;
        try {
            synchronized (this) {
                ret = lookupDone(cls);
                if (ret != null) {
                    return ret;
                }

                // is it work-in-progress?
                final ContainerAnalysis inProgress = workInProgress.get(new InProgressKey(cls, Thread.currentThread()));
                if (inProgress != null) {
                        return inProgress; // return unfinished

                    // Do not wait for the other thread: We may deadlock
                    // Double work is better that deadlock...
                }

                ret = createWorkInProgress(cls);
            }
            created = true;
            // Do the work
            doTheWork(cls, ret);
        } finally {
            // We did it
            synchronized (this) {
                if(created) {
                    workInProgress.remove(new InProgressKey(cls, Thread.currentThread()));
                    workDone.put(cls, new SoftReference<ContainerAnalysis>(ret));
                    ClassLoader classLoader = cls.getClassLoader();
                    if (classLoader != null) {
                        Set<Class<?>> classes = classesByLoader.get(classLoader);
                        if (classes == null) {
                            classesByLoader.put(classLoader, classes = new HashSet<Class<?>>());
                        }
                        classes.add(cls);
                    }
                }
                notifyAll();
            }
        }
        return ret;
    }
ContainerAnalysis getAnalysis(final Class cls) throws RMIIIOPViolationException {
        ContainerAnalysis ret = null;
        boolean created = false;
        try {
            synchronized (this) {
                ret = lookupDone(cls);
                if (ret != null) {
                    return ret;
                }

                
                final ContainerAnalysis inProgress = workInProgress.get(new InProgressKey(cls, Thread.currentThread()));
                if (inProgress != null) {
                        return inProgress; 

                    
                    
                }

                ret = createWorkInProgress(cls);
            }
            created = true;
            
            doTheWork(cls, ret);
        } finally {
            
            synchronized (this) {
                if(created) {
                    workInProgress.remove(new InProgressKey(cls, Thread.currentThread()));
                    workDone.put(cls, new SoftReference<ContainerAnalysis>(ret));
                    ClassLoader classLoader = cls.getClassLoader();
                    if (classLoader != null) {
                        Set<Class<?>> classes = classesByLoader.get(classLoader);
                        if (classes == null) {
                            classesByLoader.put(classLoader, classes = new HashSet<Class<?>>());
                        }
                        classes.add(cls);
                    }
                }
                notifyAll();
            }
        }
        return ret;
    }
ContainerAnalysis getAnalysis ( final Class cls ) throws RMIIIOPViolationException { ContainerAnalysis ret = null ; boolean created = false ; try { synchronized ( this ) { ret = lookupDone ( cls ) ; if ( ret != null ) { return ret ; } // is it work-in-progress? final ContainerAnalysis inProgress = workInProgress . get ( new InProgressKey ( cls , Thread . currentThread ( ) ) ) ; if ( inProgress != null ) { return inProgress ; // return unfinished // Do not wait for the other thread: We may deadlock // Double work is better that deadlock... } ret = createWorkInProgress ( cls ) ; } created = true ; // Do the work doTheWork ( cls , ret ) ; } finally { // We did it synchronized ( this ) { if ( created ) { workInProgress . remove ( new InProgressKey ( cls , Thread . currentThread ( ) ) ) ; workDone . put ( cls , new SoftReference < ContainerAnalysis > ( ret ) ) ; ClassLoader classLoader = cls . getClassLoader ( ) ; if ( classLoader != null ) { Set < Class < ? > > classes = classesByLoader . get ( classLoader ) ; if ( classes == null ) { classesByLoader . put ( classLoader , classes = new HashSet < Class < ? > > ( ) ) ; } classes . add ( cls ) ; } } notifyAll ( ) ; } } return ret ; }
Returns an analysis.
If the calling thread is currently doing an analysis of this
class, an unfinished analysis is returned.
Returns an analysis . If the calling thread is currently doing an analysis of this class an unfinished analysis is returned .