Eric,

Well done, although there is one minor change that's required:

  private static final byte[] LOCK= new byte[0];

  public void initialize(ARPluginContext context) throws ARException {
      ... 
      synchronized(LOCK) { 
        if(myplug == null){
          myplug = getInstance();
          ...
        }
      }
  }

The lock is required because multiple threads can access that method,
and you only want one to create the MyPlugin object. 

As a further improvement, I'd use a different object for your singleton,
i.e. separate it from the plugin.

Finally, do remember that in a multi-threaded model, using a singleton
is a bottleneck.


John
-- 
Single Sign On for the AR System
http://www.javasystemsolutions.com/jss/ssoplugin

_______________________________________________________________________________
UNSUBSCRIBE or access ARSlist Archives at www.arslist.org
attend wwrug11 www.wwrug.com ARSList: "Where the Answers Are"

Reply via email to