JavaMemoryModel: Re: TheServerSide.com: EJBean Class Initialization Hooks

From: David Smiley (dsmiley@mitre.org)
Date: Fri Jun 22 2001 - 10:02:03 EDT


I want to add a correction. I still believe my last email to be correct,
but there can be a more efficient implementation by avoiding a shared
datastructure altogether. It is so obvious, I figure the reason I didn't
notice it the first time was because I was looking at all his code where at
least half of it was unnecessary.

public abstract class AbstractEJBean
{

    private static classInited= false;

   final protected void onSetEJBContext()
    {
            synchronized(getClass()) {
                if (!classInited) {
                    initializeOncePerBeanClass();
                    classInited= true;
                }
            }
            initializeOncePerInstance();
    }
}

-- David Smiley

-------------------------------
JavaMemoryModel mailing list - http://www.cs.umd.edu/~pugh/java/memoryModel



This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:00:32 EDT