java - Singleton class to be shared among multiple portlets -


i have couple of singleton classes in liferay application hold several configuration parameters , servicelocator instances webservices need consume.

i have put these classes in jar declared dependency on portlets.

the thing is, have put logging lines initialization in theses singleton classes, , when deploy portlets can see these lines multiple times, once every portlet, since each portlet has own class context.

for appconfig class might not such big deal servicelocator hold bunch of references take bit of memory.

is there way can put these singleton references in kind of shared context in liferay portal?

the problem every portlet runs in own war file , aech war file has own classloader.

usually when had achieve requirement this, had put singleton classen in jar file , jar file in common class loader library instead of packing each war. (in tomcat: <tomcathome>/common/lib or that)

then you'll have put dependent libraries common lib dir, too. don't know how in liferay, though. tomcat see thread: stackoverflow.com/questions/267953/ , documentation: http://tomcat.apache.org/tomcat-7.0-doc/class-loader-howto.html. depends on servlet container.


Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

android - CollapsingToolbarLayout: position the ExpandedText programmatically -

Listeners to visualise results of load test in JMeter -