Hi all,I am trying to use a Singleton Java class at multiple locations (Database script, Actions, etc). The problem I have is that multiple instances of the singleton class are instantiated ! However, my singleton has been triple-checked and should not be instantiable more than once. I can provide the code if needed.
More precisely : I use the singleton to set a flag in it in Database script / Initialize, and then I try to access that flag when an action is triggered in the form (Calendar Preferences). The singleton constructor is launched a first time when the database starts, and a second time when I click on the action in the form. And of course, the flag is not set when I try to access it from the form, since its a new instance of the class.
Now, is there some kind of scoped JVM or something I don’t know about preventing the use of a Java singleton ?
Here is how I call my singleton methods :
Dim mySession As JAVASESSION
Set mySession = New JavaSession()
Dim jclass As JAVACLASS
Set jclass = mySession.getClass("SingletonObject")
Dim jobj As JavaObject
Set jobj = jclass.getSingletonObject()
Call jobj.setMessage("myFlag")
I wanted to look at the javaconn extension, but its a compiled dll so no luch there.
Thanks for any assistance !
Alexis