Posted: Wed Jul 11, 2007 10:17 am Post subject: Singeltons created in Java Plugin not accessible to JCN
Newbie
Joined: 17 Mar 2006 Posts: 6
I am instantiating a singelton in the contructor of a Java plug-in. The plug-in appears to load OK but when I attempt to retreive the instance in a JCN it is not loaded.
Is this because plugins and JCNs use different classloaders ? Ideas on how I can get around this ?
My exprience with the JCN is that only try to implement your user code within the evaluate method. JCN Contructors are called when you are deploying bar files to execution groups and this might not be the time you really start executing that code.
Singleton pattern - allows you to initiate it once and at the time when you first need to use it. So if your sigleton class has a static method to return this instance i.e.
static Singleton Instance(){
if (_instance == null)
_instance = new Singleton();
return _instance;
}
This means that you can now concentrate on using/calling the static method Instance().anyMethod() within the evaluate of the JCN. Do all your initialisation within the Singleton constructor if possible.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum