com.caucho.env.warning
Class WarningService

java.lang.Object
  extended by com.caucho.env.service.AbstractResinSubSystem
      extended by com.caucho.env.warning.WarningService
All Implemented Interfaces:
ResinSubSystem

public class WarningService
extends AbstractResinSubSystem

The WarningService is a general way to send warning and critical system messages such as shutdown messages.


Field Summary
static int START_PRIORITY
           
 
Fields inherited from interface com.caucho.env.service.ResinSubSystem
START_PRIORITY_CACHE_SERVICE, START_PRIORITY_CLASSLOADER, START_PRIORITY_CLUSTER_SERVICE, START_PRIORITY_DEFAULT, START_PRIORITY_ENV_SYSTEM, START_PRIORITY_NETWORK_CLUSTER
 
Constructor Summary
WarningService()
           
 
Method Summary
 void addHandler(WarningHandler handler)
          Add a warning event handler.
 void addPriorityHandler(WarningHandler handler)
          Add a warning event handler.
static WarningService createAndAddService()
           
static WarningService getCurrent()
           
 int getStartPriority()
          Returns the start priority of the service, used to determine which services to start first.
static void sendCurrentWarning(java.lang.Object source, java.lang.String msg)
          Sends a warning to the current service.
static void sendCurrentWarning(java.lang.Object source, java.lang.Throwable e)
          Sends a warning to the current service.
 void sendWarning(java.lang.Object source, java.lang.String msg)
          Send a warning message to any registered handlers.
 void sendWarning(java.lang.Object source, java.lang.Throwable e)
          Send a warning message to any registered handlers.
 
Methods inherited from class com.caucho.env.service.AbstractResinSubSystem
destroy, getStopPriority, preCreate, start, stop, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

START_PRIORITY

public static final int START_PRIORITY
See Also:
Constant Field Values
Constructor Detail

WarningService

public WarningService()
Method Detail

createAndAddService

public static WarningService createAndAddService()

getCurrent

public static WarningService getCurrent()

sendWarning

public void sendWarning(java.lang.Object source,
                        java.lang.String msg)
Send a warning message to any registered handlers. A high priority warning only goes to all handlers, high priority first. High priority handlers do not receive non-high priority warnings.

Parameters:
source - source of the message, usually you
msg - test to print or send as an alert
isHighPriority - set true to send to high priority warning handlers

sendWarning

public void sendWarning(java.lang.Object source,
                        java.lang.Throwable e)
Send a warning message to any registered handlers. A high priority warning only goes to all handlers, high priority first. High priority handlers do not receive non-high priority warnings.

Parameters:
source - source of the message, usually you
msg - test to print or send as an alert
isHighPriority - set true to send to high priority warning handlers

sendCurrentWarning

public static void sendCurrentWarning(java.lang.Object source,
                                      java.lang.String msg)
Sends a warning to the current service.


sendCurrentWarning

public static void sendCurrentWarning(java.lang.Object source,
                                      java.lang.Throwable e)
Sends a warning to the current service.


addHandler

public void addHandler(WarningHandler handler)
Add a warning event handler. High priority handlers ONLY get high priority warnings, and they are notified first. Other handlers gets all warnings after high priority handlers are notified.

Parameters:
handler - an object that implements WarningHandler
isHighPriority - high priority handlers only get high priority warnings.

addPriorityHandler

public void addPriorityHandler(WarningHandler handler)
Add a warning event handler. High priority handlers ONLY get high priority warnings, and they are notified first. Other handlers gets all warnings after high priority handlers are notified.

Parameters:
handler - an object that implements WarningHandler
isHighPriority - high priority handlers only get high priority warnings.

getStartPriority

public int getStartPriority()
Description copied from interface: ResinSubSystem
Returns the start priority of the service, used to determine which services to start first.

Specified by:
getStartPriority in interface ResinSubSystem
Overrides:
getStartPriority in class AbstractResinSubSystem