public class DefaultSmppSession extends Object implements SmppServerSession, SmppSessionChannelListener, com.cloudhopper.commons.util.windowing.WindowListener<Integer,PduRequest,PduResponse>, DefaultSmppSessionMXBean
SmppSession.TypeSTATE_BINDING, STATE_BOUND, STATE_CLOSED, STATE_INITIAL, STATE_OPEN, STATE_UNBINDING, STATES| Constructor and Description |
|---|
DefaultSmppSession(SmppSession.Type localType,
SmppSessionConfiguration configuration,
org.jboss.netty.channel.Channel channel,
DefaultSmppServer server,
Long serverSessionId,
BaseBindResp preparedBindResponse,
byte interfaceVersion,
ScheduledExecutorService monitorExecutor)
Creates an SmppSession for a server-based session.
|
DefaultSmppSession(SmppSession.Type localType,
SmppSessionConfiguration configuration,
org.jboss.netty.channel.Channel channel,
SmppSessionHandler sessionHandler)
Creates an SmppSession for a client-based session.
|
DefaultSmppSession(SmppSession.Type localType,
SmppSessionConfiguration configuration,
org.jboss.netty.channel.Channel channel,
SmppSessionHandler sessionHandler,
ScheduledExecutorService monitorExecutor)
Creates an SmppSession for a client-based session.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
areOptionalParametersSupported()
Returns whether optional parameters are supported with the remote
endpoint.
|
protected void |
assertValidRequest(PduRequest request) |
protected BaseBindResp |
bind(BaseBind request,
long timeoutInMillis) |
void |
close()
Immediately close the session by closing the underlying socket/channel.
|
void |
close(long timeoutInMillis) |
void |
destroy()
Destroy a session by ensuring the socket is closed and all
resources are cleaned up.
|
void |
disableLogBytes() |
void |
disableLogPdu() |
String[] |
dumpWindow() |
void |
enableLogBytes() |
void |
enableLogPdu() |
EnquireLinkResp |
enquireLink(EnquireLink request,
long timeoutInMillis)
Synchronously sends an "enquire_link" request to the remote endpoint and
waits for up to a specified number of milliseconds for a response.
|
void |
expired(com.cloudhopper.commons.util.windowing.WindowFuture<Integer,PduRequest,PduResponse> future) |
void |
fireChannelClosed()
Fired when the Channel is closed (reached EOF or timed out)
|
void |
fireExceptionThrown(Throwable t)
Fired when an exception was raised by an I/O thread or an upstream handler.
|
void |
firePduReceived(Pdu pdu)
Fired when a PDU was successfully decoded and received on this Channel.
|
SmppBindType |
getBindType()
Gets the type of bind for this session such as "transceiver", "receiver",
or "transmitter".
|
String |
getBindTypeName() |
String |
getBoundDuration() |
long |
getBoundTime()
Returns the System.currentTimeMillis() value of when this session reached
the "BOUND" state.
|
org.jboss.netty.channel.Channel |
getChannel() |
SmppSessionConfiguration |
getConfiguration()
Gets the configuration associated with this session.
|
SmppSessionCounters |
getCounters()
Gets the counters this session is tracking.
|
byte |
getInterfaceVersion()
Gets the interface version currently in use between local and remote
endpoints.
|
String |
getInterfaceVersionName() |
String |
getLocalAddressAndPort() |
SmppSession.Type |
getLocalType()
Gets the session type of the local system.
|
String |
getLocalTypeName() |
int |
getMaxWindowSize() |
String |
getName() |
int |
getNextSequenceNumber() |
String |
getPassword() |
String |
getRemoteAddressAndPort() |
SmppSession.Type |
getRemoteType()
Gets the session type of the remote system.
|
String |
getRemoteTypeName() |
long |
getRequestExpiryTimeout() |
com.cloudhopper.commons.util.windowing.Window<Integer,PduRequest,PduResponse> |
getRequestWindow() |
String |
getRxDataSMCounter() |
String |
getRxDeliverSMCounter() |
String |
getRxEnquireLinkCounter() |
String |
getRxSubmitSMCounter() |
com.cloudhopper.commons.util.windowing.Window<Integer,PduRequest,PduResponse> |
getSendWindow()
Gets the underlying request "window" for this session.
|
SequenceNumber |
getSequenceNumber() |
String |
getStateName()
Gets the name of the current state of the session.
|
String |
getSystemId() |
String |
getSystemType() |
protected PduTranscoder |
getTranscoder() |
String |
getTxDataSMCounter() |
String |
getTxDeliverSMCounter() |
String |
getTxEnquireLinkCounter() |
String |
getTxSubmitSMCounter() |
long |
getWindowMonitorInterval() |
int |
getWindowSize() |
long |
getWindowWaitTimeout() |
boolean |
hasCounters()
Returns true if and only if this session has counters enabled.
|
boolean |
isBinding()
Checks if the session is currently in the "BINDING" state.
|
boolean |
isBound()
Checks if the session is currently in the "BOUND" state.
|
boolean |
isClosed()
Checks if the session is currently in the "CLOSED" state.
|
boolean |
isOpen()
Checks if the session is currently in the "OPEN" state.
|
boolean |
isUnbinding()
Checks if the session is currently in the "UNBINDING" state.
|
boolean |
isWindowMonitorEnabled() |
void |
registerMBean(String objectName) |
void |
resetCounters() |
protected PduResponse |
sendRequestAndGetResponse(PduRequest requestPdu,
long timeoutInMillis)
Sends a PDU request and gets a PDU response that matches its sequence #.
|
com.cloudhopper.commons.util.windowing.WindowFuture<Integer,PduRequest,PduResponse> |
sendRequestPdu(PduRequest pdu,
long timeoutMillis,
boolean synchronous)
Main underlying method for sending a request PDU to the remote endpoint.
|
void |
sendResponsePdu(PduResponse pdu)
Asynchronously sends a PDU and does not wait for a response PDU.
|
void |
serverReady(SmppSessionHandler sessionHandler)
Indicates that the local endpoint (server) is ready to start processing
requests for the session.
|
protected void |
setBound() |
protected void |
setInterfaceVersion(byte value) |
SubmitSmResp |
submit(SubmitSm request,
long timeoutInMillis)
Synchronously sends a "submit" request to the remote endpoint and
waits for up to a specified number of milliseconds for a response.
|
void |
unbind(long timeoutInMillis)
Attempts to "unbind" the session, waiting up to a specified period of
milliseconds for an unbind response from the remote endpoint.
|
void |
unregisterMBean(String objectName) |
public DefaultSmppSession(SmppSession.Type localType, SmppSessionConfiguration configuration, org.jboss.netty.channel.Channel channel, DefaultSmppServer server, Long serverSessionId, BaseBindResp preparedBindResponse, byte interfaceVersion, ScheduledExecutorService monitorExecutor)
public DefaultSmppSession(SmppSession.Type localType, SmppSessionConfiguration configuration, org.jboss.netty.channel.Channel channel, SmppSessionHandler sessionHandler)
localType - The type of local endpoint (ESME vs. SMSC)configuration - The session configurationchannel - The channel associated with this session. The channel
needs to already be opened.sessionHandler - The handler for session eventspublic DefaultSmppSession(SmppSession.Type localType, SmppSessionConfiguration configuration, org.jboss.netty.channel.Channel channel, SmppSessionHandler sessionHandler, ScheduledExecutorService monitorExecutor)
localType - The type of local endpoint (ESME vs. SMSC)configuration - The session configurationchannel - The channel associated with this session. The channel
needs to already be opened.sessionHandler - The handler for session eventsexecutor - The executor that window monitoring and potentially
statistics will be periodically executed under. If null, monitoring
will be disabled.public void registerMBean(String objectName)
public void unregisterMBean(String objectName)
public SmppBindType getBindType()
SmppSessiongetBindType in interface SmppSessionpublic SmppSession.Type getLocalType()
SmppSessiongetLocalType in interface SmppSessionpublic SmppSession.Type getRemoteType()
SmppSessiongetRemoteType in interface SmppSessionprotected void setBound()
public long getBoundTime()
SmppSessiongetBoundTime in interface SmppSessionpublic String getStateName()
SmppSessiongetStateName in interface DefaultSmppSessionMXBeangetStateName in interface SmppSessionprotected void setInterfaceVersion(byte value)
public byte getInterfaceVersion()
SmppSessiongetInterfaceVersion in interface SmppSessionpublic boolean areOptionalParametersSupported()
SmppSessionareOptionalParametersSupported in interface SmppSessionpublic boolean isOpen()
SmppSessionisOpen in interface DefaultSmppSessionMXBeanisOpen in interface SmppSessionpublic boolean isBinding()
SmppSessionisBinding in interface DefaultSmppSessionMXBeanisBinding in interface SmppSessionpublic boolean isBound()
SmppSessionisBound in interface DefaultSmppSessionMXBeanisBound in interface SmppSessionpublic boolean isUnbinding()
SmppSessionisUnbinding in interface DefaultSmppSessionMXBeanisUnbinding in interface SmppSessionpublic boolean isClosed()
SmppSessionisClosed in interface DefaultSmppSessionMXBeanisClosed in interface SmppSessionpublic SmppSessionConfiguration getConfiguration()
SmppSessiongetConfiguration in interface SmppSessionpublic org.jboss.netty.channel.Channel getChannel()
public SequenceNumber getSequenceNumber()
protected PduTranscoder getTranscoder()
public com.cloudhopper.commons.util.windowing.Window<Integer,PduRequest,PduResponse> getRequestWindow()
getRequestWindow in interface SmppSessionSmppSession.getSendWindow()public com.cloudhopper.commons.util.windowing.Window<Integer,PduRequest,PduResponse> getSendWindow()
SmppSessiongetSendWindow in interface SmppSessionpublic boolean hasCounters()
SmppSessionhasCounters in interface SmppSessionpublic SmppSessionCounters getCounters()
SmppSessiongetCounters in interface SmppSessionpublic void serverReady(SmppSessionHandler sessionHandler)
SmppServerSessionserverReady in interface SmppServerSessionsessionHandler - The handler for the session to use for processingprotected BaseBindResp bind(BaseBind request, long timeoutInMillis) throws RecoverablePduException, UnrecoverablePduException, SmppBindException, SmppTimeoutException, SmppChannelException, InterruptedException
public void unbind(long timeoutInMillis)
SmppSessionunbind in interface DefaultSmppSessionMXBeanunbind in interface SmppSessiontimeoutInMillis - The number of milliseconds to wait until an unbind
response is received from the SMSC.SmppSession.close()public void close()
SmppSessionclose in interface DefaultSmppSessionMXBeanclose in interface SmppSessionSmppSession.unbind(long)public void close(long timeoutInMillis)
close in interface DefaultSmppSessionMXBeanpublic void destroy()
SmppSessiondestroy in interface DefaultSmppSessionMXBeandestroy in interface SmppSessionpublic EnquireLinkResp enquireLink(EnquireLink request, long timeoutInMillis) throws RecoverablePduException, UnrecoverablePduException, SmppTimeoutException, SmppChannelException, InterruptedException
SmppSessionenquireLink in interface SmppSessionrequest - The request to send to the remote endpointtimeoutInMillis - The number of milliseconds to wait until a valid
response is received.RecoverablePduException - Thrown when a recoverable PDU error occurs.
A recoverable PDU error includes the partially decoded PDU in order
to generate a negative acknowledgement (NACK) response.UnrecoverablePduException - Thrown when an unrecoverable PDU error
occurs. This indicates a seriours error occurred and usually indicates
the session should be immediately terminated.SmppTimeoutException - A timeout occurred while waiting for a response
from the remote endpoint. A timeout can either occur with an unresponse
remote endpoint or the bytes were not written in time.SmppChannelException - Thrown when the underlying socket/channel was
unable to write the request.InterruptedException - The calling thread was interrupted while waiting
to acquire a lock or write/read the bytes from the socket/channel.public SubmitSmResp submit(SubmitSm request, long timeoutInMillis) throws RecoverablePduException, UnrecoverablePduException, SmppTimeoutException, SmppChannelException, InterruptedException
SmppSessionsubmit in interface SmppSessionrequest - The request to send to the remote endpointtimeoutInMillis - The number of milliseconds to wait until a valid
response is received.RecoverablePduException - Thrown when a recoverable PDU error occurs.
A recoverable PDU error includes the partially decoded PDU in order
to generate a negative acknowledgement (NACK) response.UnrecoverablePduException - Thrown when an unrecoverable PDU error
occurs. This indicates a seriours error occurred and usually indicates
the session should be immediately terminated.SmppTimeoutException - A timeout occurred while waiting for a response
from the remote endpoint. A timeout can either occur with an unresponse
remote endpoint or the bytes were not written in time.SmppChannelException - Thrown when the underlying socket/channel was
unable to write the request.InterruptedException - The calling thread was interrupted while waiting
to acquire a lock or write/read the bytes from the socket/channel.protected void assertValidRequest(PduRequest request) throws NullPointerException, RecoverablePduException, UnrecoverablePduException
protected PduResponse sendRequestAndGetResponse(PduRequest requestPdu, long timeoutInMillis) throws RecoverablePduException, UnrecoverablePduException, SmppTimeoutException, SmppChannelException, InterruptedException
public com.cloudhopper.commons.util.windowing.WindowFuture<Integer,PduRequest,PduResponse> sendRequestPdu(PduRequest pdu, long timeoutMillis, boolean synchronous) throws RecoverablePduException, UnrecoverablePduException, SmppTimeoutException, SmppChannelException, InterruptedException
SmppSessionsendRequestPdu in interface SmppSessiontimeoutMillis - If synchronous is true, this represents the time to
wait for a slot to open in the underlying window AND the time to wait
for a response back from the remote endpoint. If synchronous is false,
this only represents the time to wait for a slot to open in the
underlying window.synchronous - True if the calling thread plans on waiting for a
response on the returned future. False if the calling thread plans
on discarding the returned future and expects the response PDU to
be passed to the "fireExpectedPduResponseReceived" method on the session handler.RecoverablePduException - Thrown when a recoverable PDU error occurs.
A recoverable PDU error includes the partially decoded PDU in order
to generate a negative acknowledgment (NACK) response.UnrecoverablePduException - Thrown when an unrecoverable PDU error
occurs. This indicates a serious error occurred and usually indicates
the session should be immediately terminated.SmppTimeoutException - A timeout occurred while waiting for a response
from the remote endpoint. A timeout can either occur with an unresponsive
remote endpoint or the bytes were not written in time.SmppChannelException - Thrown when the underlying socket/channel was
unable to write the request.InterruptedException - The calling thread was interrupted while waiting
to acquire a lock or write/read the bytes from the socket/channel.public void sendResponsePdu(PduResponse pdu) throws RecoverablePduException, UnrecoverablePduException, SmppChannelException, InterruptedException
sendResponsePdu in interface SmppSessionpdu - The PDU to send (can be either a response or request)RecoverablePduEncodingExceptionUnrecoverablePduEncodingExceptionSmppChannelExceptionInterruptedExceptionRecoverablePduException - Thrown when a recoverable PDU error occurs.
A recoverable PDU error includes the partially decoded PDU in order
to generate a negative acknowledgment (NACK) response.UnrecoverablePduException - Thrown when an unrecoverable PDU error
occurs. This indicates a serious error occurred and usually indicates
the session should be immediately terminated.public void firePduReceived(Pdu pdu)
SmppSessionChannelListenerfirePduReceived in interface SmppSessionChannelListenerpdu - The PDU decoded from the Channelpublic void fireExceptionThrown(Throwable t)
SmppSessionChannelListenerfireExceptionThrown in interface SmppSessionChannelListenert - The exception thrownpublic void fireChannelClosed()
SmppSessionChannelListenerfireChannelClosed in interface SmppSessionChannelListenerpublic void expired(com.cloudhopper.commons.util.windowing.WindowFuture<Integer,PduRequest,PduResponse> future)
expired in interface com.cloudhopper.commons.util.windowing.WindowListener<Integer,PduRequest,PduResponse>public void resetCounters()
resetCounters in interface DefaultSmppSessionMXBeanpublic String getBindTypeName()
getBindTypeName in interface DefaultSmppSessionMXBeanpublic String getBoundDuration()
getBoundDuration in interface DefaultSmppSessionMXBeanpublic String getInterfaceVersionName()
getInterfaceVersionName in interface DefaultSmppSessionMXBeanpublic String getLocalTypeName()
getLocalTypeName in interface DefaultSmppSessionMXBeanpublic String getRemoteTypeName()
getRemoteTypeName in interface DefaultSmppSessionMXBeanpublic int getNextSequenceNumber()
getNextSequenceNumber in interface DefaultSmppSessionMXBeanpublic String getLocalAddressAndPort()
getLocalAddressAndPort in interface DefaultSmppSessionMXBeanpublic String getRemoteAddressAndPort()
getRemoteAddressAndPort in interface DefaultSmppSessionMXBeanpublic String getName()
getName in interface DefaultSmppSessionMXBeanpublic String getPassword()
getPassword in interface DefaultSmppSessionMXBeanpublic long getRequestExpiryTimeout()
getRequestExpiryTimeout in interface DefaultSmppSessionMXBeanpublic String getSystemId()
getSystemId in interface DefaultSmppSessionMXBeanpublic String getSystemType()
getSystemType in interface DefaultSmppSessionMXBeanpublic boolean isWindowMonitorEnabled()
isWindowMonitorEnabled in interface DefaultSmppSessionMXBeanpublic long getWindowMonitorInterval()
getWindowMonitorInterval in interface DefaultSmppSessionMXBeanpublic int getMaxWindowSize()
getMaxWindowSize in interface DefaultSmppSessionMXBeanpublic int getWindowSize()
getWindowSize in interface DefaultSmppSessionMXBeanpublic long getWindowWaitTimeout()
getWindowWaitTimeout in interface DefaultSmppSessionMXBeanpublic String[] dumpWindow()
dumpWindow in interface DefaultSmppSessionMXBeanpublic String getRxDataSMCounter()
getRxDataSMCounter in interface DefaultSmppSessionMXBeanpublic String getRxDeliverSMCounter()
getRxDeliverSMCounter in interface DefaultSmppSessionMXBeanpublic String getRxEnquireLinkCounter()
getRxEnquireLinkCounter in interface DefaultSmppSessionMXBeanpublic String getRxSubmitSMCounter()
getRxSubmitSMCounter in interface DefaultSmppSessionMXBeanpublic String getTxDataSMCounter()
getTxDataSMCounter in interface DefaultSmppSessionMXBeanpublic String getTxDeliverSMCounter()
getTxDeliverSMCounter in interface DefaultSmppSessionMXBeanpublic String getTxEnquireLinkCounter()
getTxEnquireLinkCounter in interface DefaultSmppSessionMXBeanpublic String getTxSubmitSMCounter()
getTxSubmitSMCounter in interface DefaultSmppSessionMXBeanpublic void enableLogBytes()
enableLogBytes in interface DefaultSmppSessionMXBeanpublic void disableLogBytes()
disableLogBytes in interface DefaultSmppSessionMXBeanpublic void enableLogPdu()
enableLogPdu in interface DefaultSmppSessionMXBeanpublic void disableLogPdu()
disableLogPdu in interface DefaultSmppSessionMXBeanCopyright © 2009-2014 Cloudhopper by Twitter. All Rights Reserved.