Thanks, John. Duly noted. Again, appreciate the wisdom! Without the gory
details, I believe any bottle neck here, will have little if any affect
on the requirements and design for my particular need, but I'll keep
searching for a better alternative. 

-----Original Message-----
From: Action Request System discussion list(ARSList)
[mailto:arsl...@arslist.org] On Behalf Of John Baker
Sent: Friday, October 29, 2010 4:08 PM
To: arslist@ARSLIST.ORG
Subject: Java plugin server thread configuration question

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"

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

Reply via email to