List synchedList = ( List ) externalJNDI.lookup( "synchedList" );
synchronized ( synchedList )
{
//do something to that list
}
Sorry but your initial posting didn�t make this very clear, or at least it wasn�t very clear to me. Initially I thought that you only want to synchronize the basic add/remove/get operations.
However the real question is whether synchronized block of code might be allowed or not with ejbs. My opinion again is that in certain situation it might be allowed if there aren�t other solutions. Couple of examples could be using the Hashtable and Vector classes (which as far as I know j2ee doesn�t forbid them), or synchronizing the getInstance() method when implementing singletons (which again arguable might be considered "bad practice").
Other opinions?