ie.omk.smpp.event
Class ReceiverExitEvent

java.lang.Object
  extended by ie.omk.smpp.event.SMPPEvent
      extended by ie.omk.smpp.event.ReceiverExitEvent

public class ReceiverExitEvent
extends SMPPEvent

Event generated by the receiver thread exiting. This event will be generated when the receiver thread terminates either normally or abnormally due to an exception. In the former case, isException will return false. In the latter, isException will return true and the Throwable object that was the cause of the thread's termination can be accessed using getException(). If an application receives this event, it can be assumed that the connection to the SMSC is invalid. That is, the network-specific connection will have to be reestablished before binding to the SMSC is again possible. It is up to the application to do any necessary clean up to the old network connection.

Version:
$Id: ReceiverExitEvent.java 264 2006-03-09 14:00:40Z orank $
Author:
Oran Kelly

Field Summary
static int BIND_TIMEOUT
          Receiver exited because bind timed out.
static int EXCEPTION
          Receiver exited due to an exception.
static int UNKNOWN
          Recevier exit reason of "unknown".
 
Fields inherited from class ie.omk.smpp.event.SMPPEvent
RECEIVER_EXCEPTION, RECEIVER_EXIT, RECEIVER_START
 
Constructor Summary
ReceiverExitEvent(Connection source)
          Create a new ReceiverExitEvent.
ReceiverExitEvent(Connection source, Throwable t)
          Create a new ReceiverExitEvent.
ReceiverExitEvent(Connection source, Throwable t, int state)
          Create a new ReceiverExitEvent.
 
Method Summary
 Throwable getException()
          Get the exception that caused termination.
 int getReason()
          Get the reason for the exit event.
 int getState()
          Get the state the Connection was in when termination occurred.
 boolean isException()
          Deprecated. use {#link #getReason}
 void setException(Throwable t)
           
 void setReason(int reason)
          Set the reason for the exit event.
 
Methods inherited from class ie.omk.smpp.event.SMPPEvent
getSource, getType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNKNOWN

public static final int UNKNOWN
Recevier exit reason of "unknown".

See Also:
Constant Field Values

BIND_TIMEOUT

public static final int BIND_TIMEOUT
Receiver exited because bind timed out.

See Also:
Constant Field Values

EXCEPTION

public static final int EXCEPTION
Receiver exited due to an exception.

See Also:
Constant Field Values
Constructor Detail

ReceiverExitEvent

public ReceiverExitEvent(Connection source)
Create a new ReceiverExitEvent. Events created with this constructor will signify a normal receiver thread termination with no errors.

Parameters:
source - the source Connection of this event.

ReceiverExitEvent

public ReceiverExitEvent(Connection source,
                         Throwable t)
Create a new ReceiverExitEvent. If t is not null, the newly created event will represent an abnormal termination of the receiver thread. If t is null, this constructor has the same effect as ReceiverExitEvent(Connection).

Parameters:
source - the source Connection of this event.
t - the exception which caused termination (may be null).

ReceiverExitEvent

public ReceiverExitEvent(Connection source,
                         Throwable t,
                         int state)
Create a new ReceiverExitEvent. If t is not null, the newly created event will represent an abnormal termination of the receiver thread. If t is null, this constructor has the same effect as ReceiverExitEvent(Connection).

Parameters:
source - the source Connection of this event.
t - the exception which caused termination (may be null).
state - the state the Connection was in when termination occurred.
See Also:
Connection.BOUND, Connection.UNBOUND, Connection.BINDING, Connection.UNBINDING
Method Detail

isException

public boolean isException()
Deprecated. use {#link #getReason}

Test if this event represents an abnormal termination.

Returns:
true if this event represents abnormal termination due to an exception, false if it represents normal termination.

getException

public Throwable getException()
Get the exception that caused termination.

Returns:
the exception, or null if this event represents normal termination.

setException

public void setException(Throwable t)

getState

public int getState()
Get the state the Connection was in when termination occurred.

Returns:
the integer value representing the state of the connection.
See Also:
Connection.BOUND, Connection.UNBOUND, Connection.BINDING, Connection.UNBINDING

getReason

public int getReason()
Get the reason for the exit event.

Returns:
Returns the reason.

setReason

public void setReason(int reason)
Set the reason for the exit event. Should be one of the enumeration values defined in this class.

Parameters:
reason - The reason to set.


Copyright © 2011 smppapi at Sourceforge. All Rights Reserved.