public abstract class AbstractSession extends Object implements Session
| Constructor and Description |
|---|
AbstractSession(PDUSender pduSender) |
| Modifier and Type | Method and Description |
|---|---|
void |
addSessionStateListener(SessionStateListener l) |
void |
close()
Forced close connection without sending UNBIND command to Message Center.
|
protected abstract Connection |
connection() |
DataSmResult |
dataShortMessage(String serviceType,
TypeOfNumber sourceAddrTon,
NumberingPlanIndicator sourceAddrNpi,
String sourceAddr,
TypeOfNumber destAddrTon,
NumberingPlanIndicator destAddrNpi,
String destinationAddr,
ESMClass esmClass,
RegisteredDelivery registeredDelivery,
DataCoding dataCoding,
OptionalParameter... optionalParameters)
Send the data_sm command.
|
protected Command |
executeSendCommand(SendCommandTask task,
long timeout)
Execute send command command task.
|
protected DataSmResult |
fireAcceptDataSm(DataSm dataSm) |
int |
getEnquireLinkTimer() |
long |
getLastActivityTimestamp()
Get the last reading valid PDU from remote host.
|
int |
getPduProcessorDegree()
Get the total of thread that can handle read and process PDU parallely.
|
String |
getSessionId()
Get session id.
|
SessionState |
getSessionState() |
long |
getTransactionTimer() |
protected abstract GenericMessageReceiverListener |
messageReceiverListener() |
protected PDUSender |
pduSender() |
protected PendingResponse<Command> |
removePendingResponse(int sequenceNumber) |
void |
removeSessionStateListener(SessionStateListener l) |
protected void |
sendEnquireLink()
Ensure we have proper link.
|
protected Sequence |
sequence() |
protected abstract AbstractSessionContext |
sessionContext() |
void |
setEnquireLinkTimer(int enquireLinkTimer) |
void |
setPduProcessorDegree(int pduProcessorDegree)
Set total thread can read PDU and process it parallely.
|
void |
setTransactionTimer(long transactionTimer) |
void |
unbindAndClose()
Sending UNBIND and close connection immediately.
|
public AbstractSession(PDUSender pduSender)
protected abstract AbstractSessionContext sessionContext()
protected abstract Connection connection()
protected abstract GenericMessageReceiverListener messageReceiverListener()
protected PDUSender pduSender()
protected Sequence sequence()
protected PendingResponse<Command> removePendingResponse(int sequenceNumber)
public String getSessionId()
SessiongetSessionId in interface Sessionpublic void setEnquireLinkTimer(int enquireLinkTimer)
setEnquireLinkTimer in interface Sessionpublic int getEnquireLinkTimer()
getEnquireLinkTimer in interface Sessionpublic void setTransactionTimer(long transactionTimer)
setTransactionTimer in interface Sessionpublic long getTransactionTimer()
getTransactionTimer in interface Sessionpublic SessionState getSessionState()
getSessionState in interface Sessionpublic void addSessionStateListener(SessionStateListener l)
addSessionStateListener in interface Sessionpublic void removeSessionStateListener(SessionStateListener l)
removeSessionStateListener in interface Sessionpublic long getLastActivityTimestamp()
SessiongetLastActivityTimestamp in interface Sessionpublic void setPduProcessorDegree(int pduProcessorDegree)
throws IllegalStateException
pduProcessorDegree - is the total thread can handle read and process
PDU parallely.IllegalStateException - if the PDU Reader has been started.public int getPduProcessorDegree()
public DataSmResult dataShortMessage(String serviceType, TypeOfNumber sourceAddrTon, NumberingPlanIndicator sourceAddrNpi, String sourceAddr, TypeOfNumber destAddrTon, NumberingPlanIndicator destAddrNpi, String destinationAddr, ESMClass esmClass, RegisteredDelivery registeredDelivery, DataCoding dataCoding, OptionalParameter... optionalParameters) throws PDUException, ResponseTimeoutException, InvalidResponseException, NegativeResponseException, IOException
dataShortMessage in interface SessionserviceType - is the service_type parameter.sourceAddrTon - is the source_addr_ton parameter.sourceAddrNpi - is the source_addr_npi parameter.sourceAddr - is the source_addr parameter.destAddrTon - is the dest_addr_ton parameter.destAddrNpi - is the dest_addr_npi parameter.destinationAddr - is the destination_addr parameter.esmClass - is the esm_class parameter.registeredDelivery - is the registered_delivery parameter.dataCoding - is the data_coding parameter.optionalParameters - is the optional parameters.PDUException - if there is an invalid PDU parameter found.ResponseTimeoutException - if the response take time too long.InvalidResponseException - if the response is invalid.NegativeResponseException - if the response return NON-OK command_status.IOException - if there is an IO error found.public void close()
Sessionprotected DataSmResult fireAcceptDataSm(DataSm dataSm) throws ProcessRequestException
ProcessRequestExceptionprotected Command executeSendCommand(SendCommandTask task, long timeout) throws PDUException, ResponseTimeoutException, InvalidResponseException, NegativeResponseException, IOException
task - is the task.timeout - is the timeout in millisecond.PDUException - if there is invalid PDU parameter found.ResponseTimeoutException - if the response has reach it timeout.InvalidResponseException - if invalid response found.NegativeResponseException - if the negative response found.IOException - if there is an IO error found.protected void sendEnquireLink()
throws ResponseTimeoutException,
InvalidResponseException,
IOException
ResponseTimeoutException - if there is no valid response after defined millisecond.InvalidResponseException - if there is invalid response found.IOException - if there is an IO error found.public void unbindAndClose()
SessionunbindAndClose in interface Session