ShutdownHookEmailThread

public class ShutdownHookEmailThread extends Thread

The ShutdownHookEmailThread is the actual worker thread executing during the JVM shutdown.

Fields

DEFAULT_SHUTDOWN_MAIL_SUBJECT

public static final String DEFAULT_SHUTDOWN_MAIL_SUBJECT

ccs

protected String ccs

from

protected String from

host

protected String host

password

protected String password

protocol

protected String protocol

subject

protected String subject

tos

protected String tos

username

protected String username

verbose

protected boolean verbose

Constructors

ShutdownHookEmailThread

public ShutdownHookEmailThread(String protocol, String host, String username, String password, String from, String tos, String ccs, String subject, boolean verbose)

Create an instance of ShutdownHookEmailThread for delivering shutdown notification mail.

Parameters:
  • protocol – The protocol for delivering email. default: smtp.
  • host – The host-name of email server.
  • username – The user-name for authenticating the email server, if necessary.
  • password – The password for authenticating the email server, if necessary.
  • from – The source email address of the shutdown notification email.
  • tos – The to email address of recipient notification email.
  • ccs – The cc email address of recipient notification email.
  • subject – The subject of the email address.
  • verbose – Enable debug mode ?

Methods

getCcs

public String getCcs()

Get the carbon copy address of the shutdown alert email.

Returns:Get the carbon copy address of the shutdown alert email.

getFrom

public String getFrom()

Get the source address of the shutdown alert email.

Returns:Get the source address of the shutdown alert email.

getHost

public String getHost()

Get the email host of the shutdown alert email.

Returns:Get the email host of the shutdown alert email.

getIsVerbose

public boolean getIsVerbose()

Get whether the shutdown hook output verbosely.

Returns:Get whether the shutdown hook output verbosely.

getPassword

public String getPassword()

Get the password (if any) for authenticating the email host for delivering the alert email.

Returns:Get the password (if any) for authenticating the email host.

getProtocol

public String getProtocol()

Get the email protocol of the shutdown alert email.

Returns:Get the email protocol of the shutdown alert email.

getSubject

public String getSubject()

Get the subject title of the shutdown alert email.

Returns:Get the subject title of the shutdown alert email.

getTos

public String getTos()

Get the recipient address of the shutdown alert email.

Returns:Get the recipient address of the shutdown alert email.

getUsername

public String getUsername()

Get the user-name (if any) for authenticating the email host for delivering the alert email.

Returns:Get the user-name (if any) for authenticating the email host.

onCreateMailNotificationBody

protected String onCreateMailNotificationBody()

Return the body of notification email. The default return the snapshot of all thread dump information. Sub-class may override this to customize the subject of notification email.

Returns:Return the body of notification email.

onCreateMailNotificationSubject

protected String onCreateMailNotificationSubject()

Return the subject of notification email. Sub-class may override this to customize the subject of notification email.

Returns:Return the subject of notification email, default is DEFAULT_SHUTDOWN_MAIL_SUBJECT

run

public void run()

The shutdown thread execution.