Hi Marcin,

Maybe this link will be helpfull:
  http://www.javacoffeebreak.com/articles/designpatterns/index.html
To me it looks as if it covers all related problems.

Other similar link
http://www.javaworld.com/javaworld/jw-04-2003/jw-0425-designpatterns.html
http://www.javaworld.com/javaworld/jw-04-2003/jw-0425-designpatterns.html?page=2

At a quick glance at them I also noted the topic of sharing only one
instance between different JVM or processes. Maybe you like to check
that out as well.


Thomas



> Hi,
> 
> I'm implementing a class that implements a known OOo service (actually, 
> several ones, but the important one is XGrammarChecker). The problem is 
> that the class is instantiated many times in OOo whenever a UI item is 
> used, and the instances created do not share data.
> 
> So I think I should guarantee that the service is instantiated only once 
> per OOo instance. As far as I understand, I need to make a singleton 
> class for this purpose. The docs (if one can call it docs) refer to 
> writing an IDL spec which is not useful for implementing a known UNO 
> service, so I think in this case writing IDL is completely superfluous. 
> All I want from the class is that it's created only once per JVM in OOo 
> (the code is in Java). What should I do to make my class a one-instance 
> class? Is it enough to add some registry code to __writeRegistryServiceInfo?
> 
> You can find the whole code in our CVS repo:
> 
> http://languagetool.cvs.sourceforge.net/languagetool/JLanguageTool/src/java/de/danielnaber/languagetool/openoffice/Main.java?view=markup
> 
> Anyway, if there is a better or easier way to share implementation data 
> of multiple instances, I could use it as well but I think that for 
> performance purposes, it's wise to have only a single instance of my 
> service - it's a grammar checker that will be run in the background 
> thread in Writer, and instantiating the class is somewhat costly.
> 
> Thanks for your advice, and best regards,
> Marcin
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to