ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Singeltons created in Java Plugin not accessible to JCN

Post new topic  Reply to topic
 Singeltons created in Java Plugin not accessible to JCN « View previous topic :: View next topic » 
Author Message
jcraw62
PostPosted: Wed Jul 11, 2007 10:17 am    Post subject: Singeltons created in Java Plugin not accessible to JCN Reply with quote

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 ?

Many thanks.
Back to top
View user's profile Send private message
ak
PostPosted: Thu Jul 12, 2007 12:57 am    Post subject: Reply with quote

Apprentice

Joined: 07 Aug 2006
Posts: 48
Location: England

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.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Thu Jul 12, 2007 7:07 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Yes, JCNs and plugins use different classloaders.

Put your singleton class into a jar file that is put into shared-classes.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Singeltons created in Java Plugin not accessible to JCN
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.