Skip to Content.
Sympa Menu

perfsonar-dev - Re: [pS-dev] Service (un)Initialization implementation

Subject: perfsonar development work

List archive

Re: [pS-dev] Service (un)Initialization implementation


Chronological Thread 
  • From: Uros Juvan <>
  • To: Roman Lapacz <>
  • Cc:
  • Subject: Re: [pS-dev] Service (un)Initialization implementation
  • Date: Fri, 13 Oct 2006 10:02:01 +0200
  • Organization: Arnes



Roman Lapacz wrote:
Uros Juvan wrote:
I will be adding perfSONAR services initialization and uninitialization
routines, implemented as ServletContextListeners.
I am planning to add class

org.perfsonar.commons.container.listeners.StartupInitializer

for which we have to add the following lines to AXIS's WEB-INF/web.xml:

<listener>
<listener-class>org.perfsonar.commons.container.listeners.StartupInitializer</listener-class>
</listener>

right after the last <listener> entry.

This code has two methods:

* contextInitialized:
takes care of initialization of service components:
AuxiliaryComponentManager.getInstance();

* contextDestroyed:
takes care of uninitialization of service components
by walking over a Map of components implementing
AuxiliaryThreadedComponent

For StartupInitializer to compile, I have to add servlet-api.jar artifact to
libs-download-targets.xml. Thank you Loukik for adding it to our repository
the other day :)

I had to add another interface extending AuxiliaryComponent, called
AuxiliaryThreadedComponent, which must be implemented by all components
running in infinite loop of a spawned thread. AuxiliaryThreadedComponent
interface just adds stopThread method, used to terminate thread and
effectively a infinite loop.
I also changed interface simple Scheduler implements from AuxiliaryComponent
to AuxiliaryThreadedComponent and added method stopThread, which in turn
calls stopScheduler method.

componentsIterator method was added to AuxiliaryComponentManager class to
support iteration over all the initialized components. This is needed for
contextDestroyed of StartupInitializer class to properly call stopThread
method for all components implementing AuxiliaryThreadedComponent.


Consequence of these modifications:
1. Start LS Registration scheduler at tomcat startup
2. Bugfix of Tomcat not stopping if LS Registration scheduler started
already



Do you think I can commit those changes to SVN? Maciej already agreed,
Loukik, Roman, others?

Looks fine for me. I would also think on this how to automate adding this new listener to web.xml (I would put it somewhere in deploy target).

It looks reasonable to me. I just have to check if Tomcat is shipped with classes, which already implement some kind of web.xml handling, which I am almost sure it does. I then need to evaluate if it seems reasonable potentially adding another Tomcat/Servlet jar file to our jar-repository, or does it seem easier to XML parse web.xml by myself and insert new <listener> if necessary.

This target may change a bit when Loukik changes the way services are installed into Tomcat (multiple services in the same Tomcat instance).

I will commit changes I made so far. If you do not add <listener> entries to AXIS's web.xml, then you do not have (un)initializer, i.e. everything should work as it did before.

IMPORTANT: You should run libs-generic ant target, when updating your copy of perfSONAR code with the perfSONAR's SVN trunk, otherwise you might be faced with weird errors about missing classes from javax.servlet namespace!


Roman




Regards,



Regards,

--
Uroš Juvan
Arnes




Archive powered by MHonArc 2.6.16.

Top of Page