Package org.tanukisoftware.wrapper.event

# Class WrapperControlEvent

java.lang.Object
java.util.EventObject
org.tanukisoftware.wrapper.event.WrapperEvent
org.tanukisoftware.wrapper.event.WrapperConsumableEvent
org.tanukisoftware.wrapper.event.WrapperControlEvent

All Implemented Interfaces:
  `Serializable`

public class WrapperControlEvent extends WrapperConsumableEvent
WrapperControlEvent are used to notify the listener whenever the native wrapper code traps a system control signal against the Java process. It is up to the listener to take any actions necessary.

The Wrapper will send this event to any registered listeners first, then it will pass the control code to the WrapperListener.controlEvent method. If the consume method is called, it will still be passed to other WrapperEventListeners, but will not be passed to the WrapperListener.controlEvent method. Other WrapperEventListeners should check the isConsumed method to decide whether or not the even has already been handled.

If the wrapper.ignore_signals property is set to true then the event will still be fired, but its isConsumed() method will return true initially.

Possible values are:

WrapperManager.WRAPPER_CTRL_C_EVENT
  The user pressed CTRL-C in a command windown (Windows or UNIX). Or the kill INT signal was received (UNIX).
WRAPPER_CTRL_CLOSE_EVENT
  The user is trying to close the console in which the Wrapper is running (Windows).
WRAPPER_CTRL_LOGOFF_EVENT
  The user logged off (Windows).
WRAPPER_CTRL_SHUTDOWN_EVENT
  The system is being shutdown (Windows).
WRAPPER_CTRL_TERM_EVENT
  The kill TERM signal was received (UNIX).
WRAPPER_CTRL_HUP_EVENT
  The kill HUP signal was received (UNIX).

See Also:
  - Serialized Form

## Field Summary

### Fields inherited from class java.util.EventObject

`source`

## Constructor Summary

Constructors
Constructor
Description
`WrapperControlEvent(int controlEvent, String controlEventName)`
Creates a new WrapperControlEvent.

## Method Summary

Modifier and Type
Method
Description
`int`
`getControlEvent()`
Returns the system control event.
`String`
`getControlEventName()`
Returns the name of the control event.
`long`
`getFlags()`
Returns a set of event flags for which the event should be fired.
`String`
`toString()`
Returns a string representation of the event.

### Methods inherited from class org.tanukisoftware.wrapper.event.WrapperConsumableEvent

`consume, isConsumed`

### Methods inherited from class java.util.EventObject

`getSource`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Constructor Details

### WrapperControlEvent

public WrapperControlEvent(int controlEvent, String controlEventName)
Creates a new WrapperControlEvent.

Parameters:
  `controlEvent` - Service control event.
  `controlEventName` - The name of the event.

## Method Details

### getFlags

public long getFlags()
Returns a set of event flags for which the event should be fired. This value is compared with the mask supplied when when a WrapperEventListener is registered to decide which listeners should receive the event.

If subclassed, the return value of the super class should usually be ORed with any additional flags.

Overrides:
  `getFlags` in class `WrapperEvent`
Returns:
  a set of event flags.

### getControlEvent

public int getControlEvent()
Returns the system control event.

Possible values are: WrapperManager.WRAPPER_CTRL_C_EVENT, WRAPPER_CTRL_CLOSE_EVENT, WRAPPER_CTRL_LOGOFF_EVENT, WRAPPER_CTRL_SHUTDOWN_EVENT, WRAPPER_CTRL_TERM_EVENT, or WRAPPER_CTRL_HUP_EVENT.

Returns:
  The system control event.

### getControlEventName

public String getControlEventName()
Returns the name of the control event.

Returns:
  The name of the control event.

### toString

public String toString()
Returns a string representation of the event.

Overrides:
  `toString` in class `EventObject`
Returns:
  A string representation of the event.