ShutdownHookEmailModule¶
-
public class
ShutdownHookEmailModule
extends Module¶ The ShutdownHookEmailModule is a piazza common module which send email to the specified when the JVM is terminated. It is typical used to notify the operator for the termination of long-running java process like application server (for instance, Tomcat) through email. Background about this: This component is emerged when project swallow requires the detection of application crashes and therefore we want a reusable generic component for doing such. Sample Module Descriptor
<module id="shutdown.email.module" name="Email shutdown hook module"> <parameters> <parameter name="host" value="intraflow2.cs.hku.hk"/> <parameter name="protocol" value="smtp"/> <parameter name="username" value=""/> <parameter name="password" value=""/> <parameter name="from" value="yourDaemon@cecid.hku.hk"/> <parameter name="to" value="yourEmailAddress"/> <parameter name="cc" value="yourCCEmailAddress"/> <parameter name="verbose" value="false"/> </parameters> </module>
Author: Twinsen Tsang
Constructors¶
ShutdownHookEmailModule¶
ShutdownHookEmailModule¶
-
public
ShutdownHookEmailModule
(String descriptorLocation, ClassLoader loader, boolean shouldInitialize)¶ Creates a new instance of
ShutdownHookEmailModule
.Parameters: - descriptorLocation – the module descriptor.
- shouldInitialize – true if the module should be initialized.
Throws: - ModuleException – if errors encountered when loading the module descriptor.
ShutdownHookEmailModule¶
-
public
ShutdownHookEmailModule
(String descriptorLocation, ClassLoader loader)¶ Creates a new instance of
ShutdownHookEmailModule
.Parameters: - descriptorLocation – the module descriptor.
- loader – the class loader for this module.
Throws: - ModuleException – if errors encountered when loading the module descriptor.
Methods¶
createShutdownHookWorker¶
-
protected Thread
createShutdownHookWorker
()¶ Create the thread executed during JVM shutdown. By default, it create an new instance of ShutdownHookEmailThread associated with the property defined in this module descriptor. The thread created must conform the rule specified in the Java API. For detail, read here
Throws: - Throwable – any kind of execution for setup the shutdown hook worker.
Returns: The thread executed during JVM shutdown