Sunday, August 24, 2014

TomEE - Detecting Webapp Deployment

Setup your environment for a TomEE debugging session

To understand the TomEE startup process

Once TomEE jars are loaded into Tomcat and initialized, There should be a way of detecting deployments of the other webapps. This is again achieved through a Tomcat's favourite Lifecycle Listener named GlobalListenerSupport.

The TomcatWebappBuilder class can be considered as the main contirbutor of this process. When TomEE initialized,

  • It creates a new instance of TomcatWebappBuilder.
  • The TomcatWebappBulder creates an instance of GlobalListenerSupport.
  • GlobalListenerSupport holds a reference to TomcatWebappBulderInstance.
  • The GlobalListenerSupport is registered to the Server as a lifecycle listener

Now when a lifecycle event occurred for any webapp,
  • The Tomcat will trigger the GlobalListenerSupport since it is a lifecycle listener.
  • The GlobalListener will simply filter the relevant events and call the relevant method of the TomcatWebappBuilder  reference.

This is how the TomcatWebappBuilder get to know about webapp deployment & undeployment. 



No comments:

Post a Comment