|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.epam.fixengine.session.AbstractFIXSession
public abstract class AbstractFIXSession
The abstract session implementation. Provides base functional for acceptor and initiator sessions.
| Field Summary | |
|---|---|
protected com.epam.fixengine.session.util.ConfigurationAdaptor |
configuration
|
protected HandlerChain |
listener
|
protected Log |
log
|
protected FIXMessageFactory |
messageFactory
|
protected Queue<FIXFieldListWithType> |
queue
|
protected Object |
sessionLock
|
protected SessionParameters |
sessionParameters
|
protected FIXTransport |
transport
|
| Constructor Summary | |
|---|---|
AbstractFIXSession(FIXMessageFactory messageFactory,
SessionParameters sessionParameters,
HandlerChain fixSessionListener)
Creates the AbstractFIXSession . |
|
| Method Summary | |
|---|---|
void |
addSessionStateListener(com.epam.fixengine.session.FIXSessionStateListener stateListener)
|
void |
checkHasSessionSendOrReceivedTestRequest()
The method checks if TR send or received. |
void |
clearQueue()
Clears output message queue. |
abstract void |
connect()
Connects to remote counterparty, if initiator or accepts incoming connection if acceptor. |
void |
disconnect(String reason)
Disconnect the session. |
protected void |
disconnectTestRequestIsLost()
Disconnect the session if test request doesn't received. |
void |
dispose()
Disposes current session, removes its reference from GlobalSessionManager and frees all allocated resources. |
boolean |
equals(Object o)
|
Object |
getAttribute(String key)
Gets session attribute value. |
long |
getBytesRead()
Gets read bytes. |
long |
getBytesSent()
Gets send bytes. |
com.epam.fixengine.encryption.Encryption |
getEncryption()
|
ErrorHandler |
getErrorHandler()
Gets session error handler. |
long |
getEstablished()
Gets established session timestamp. |
ExtendedFIXSessionListener |
getExtendedFIXSessionListener()
Gets extended fix session listener. |
MessageStorage |
getIncomingMessageStorage()
Gets incoming message storage. |
long |
getLastInMessageTimestamp()
Gets last received message timestamp. |
long |
getLastOutMessageTimestamp()
Gets time when the message is sent |
FIXMessageFactory |
getMessageFactory()
Gets message factory. |
protected HandlerChain |
getMessageHandlers()
Gets chain of message handlers. |
MessageValidator |
getMessageValidator()
Returns message validator. |
long |
getNoOfInMessages()
Gets number of received message. |
long |
getNoOfOutMessages()
Gets number of sent message. |
MessageStorage |
getOutgoingMessageStorage()
Gets outgoing message storage. |
RejectMessageListener |
getRejectMessageListener()
Gets reject message listener. |
SessionSequenceManager |
getSequenceManager()
|
SessionParameters |
getSessionParameters()
The returned value is cloned. |
SessionParameters |
getSessionParametersInstance()
Gets session parameter instance. |
SessionState |
getSessionState()
Returns session state. |
StorageFactory |
getStorageFactory()
Gets storage factory |
int |
hashCode()
|
protected void |
initSession()
Initializes the resources and sends a logon message. |
protected void |
initSessionInternal()
Initialize session internal. |
protected boolean |
isResetTimeMissed(long lastResetTime)
|
protected void |
loadSessionParametersFromFile()
Load session parameters. |
void |
markShutdownAsGraceful()
Marks the session shutdown as gracefully. |
void |
removeAttribute(String key)
Removes session attribute. |
void |
removeSessionStateListener(com.epam.fixengine.session.FIXSessionStateListener stateListener)
|
void |
resetSequenceNumbers()
Allows user to reset sequences numbers by sending logon with 141=Y. |
void |
resetSequenceNumbers(boolean checkGapFillBefore)
Allows user to reset sequences numbers by sending logon with 141=Y. |
protected void |
restoreSessionAfterReceivedTestRequest()
Restore the session if test request is received. |
void |
restoreSessionParameters()
Restore session parameters in file. |
void |
saveSessionParameters()
Save session parameters to file. |
void |
sendAsIs(FIXFieldList message)
Convinient method to send out FIX message based on the message type and message content. |
void |
sendMessage(FIXFieldList message)
Convinient method to send out user built FIX message. |
void |
sendMessage(String type,
FIXFieldList content)
Convinient method to send out FIX message based on the message type and message content. |
void |
sendMessageOutOfTurn(String type,
FIXFieldList message)
Sends message out of turn. |
protected void |
sendTestRequest()
Send test request. |
void |
sendWithChanges(FIXFieldList content,
ChangesType allowedChangesType)
Convinient method to send out FIX message based on the message type and message content. |
void |
setAttribute(String key,
Object object)
Sets session attribute. |
void |
setErrorHandler(ErrorHandler handler)
Sets error handler. |
void |
setFIXSessionListener(FIXSessionListener listener)
Sets FIXSession listener to monitor session status and receive incoming messages. |
void |
setOutOfTurnMode(boolean mode)
Sets OutOf turn mode. |
void |
setRejectMessageListener(RejectMessageListener listener)
Sets reject message listener. |
void |
setSessionState(SessionState sessionState)
Sets session state. |
void |
shutdown(boolean blocking)
Shutdown the session. |
protected void |
startSession()
|
protected void |
storeProcessedSeqNumber()
Store the last processed seq number. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected final Log log
protected FIXTransport transport
protected Queue<FIXFieldListWithType> queue
protected final HandlerChain listener
protected final SessionParameters sessionParameters
protected final FIXMessageFactory messageFactory
protected final Object sessionLock
protected final com.epam.fixengine.session.util.ConfigurationAdaptor configuration
| Constructor Detail |
|---|
public AbstractFIXSession(FIXMessageFactory messageFactory,
SessionParameters sessionParameters,
HandlerChain fixSessionListener)
AbstractFIXSession .
| Method Detail |
|---|
public SessionSequenceManager getSequenceManager()
public ExtendedFIXSessionListener getExtendedFIXSessionListener()
ExtendedFIXSession
getExtendedFIXSessionListener in interface ExtendedFIXSessionExtendedFIXSession.getExtendedFIXSessionListener()public StorageFactory getStorageFactory()
public RejectMessageListener getRejectMessageListener()
ExtendedFIXSession
getRejectMessageListener in interface ExtendedFIXSessionExtendedFIXSession.getRejectMessageListener()public ErrorHandler getErrorHandler()
ExtendedFIXSession
getErrorHandler in interface ExtendedFIXSessionExtendedFIXSession.getErrorHandler()public void setErrorHandler(ErrorHandler handler)
FIXSession
setErrorHandler in interface FIXSessionhandler - the error handlerFIXSession.setErrorHandler(com.epam.fixengine.ErrorHandler)public void setRejectMessageListener(RejectMessageListener listener)
FIXSession
setRejectMessageListener in interface FIXSessionlistener - the reject message listenerFIXSession.setRejectMessageListener(com.epam.fixengine.RejectMessageListener)public void markShutdownAsGraceful()
ExtendedFIXSession
markShutdownAsGraceful in interface ExtendedFIXSessionExtendedFIXSession.markShutdownAsGraceful();public void clearQueue()
ExtendedFIXSessionRejectMessageListener listener.
clearQueue in interface ExtendedFIXSessionExtendedFIXSession.clearQueue()public void setOutOfTurnMode(boolean mode)
ExtendedFIXSession
setOutOfTurnMode in interface ExtendedFIXSessionmode - the mode
public void resetSequenceNumbers()
throws IOException
FIXSession
resetSequenceNumbers in interface FIXSessionIOExceptionFIXSession.resetSequenceNumbers()
public void resetSequenceNumbers(boolean checkGapFillBefore)
throws IOException
FIXSession
resetSequenceNumbers in interface FIXSessioncheckGapFillBefore - - the flag indicates if needed to check the seq num.
If true the TR will be sent before introday logon otherwise only intraday logon will be sent.
IOExceptionFIXSession.resetSequenceNumbers(boolean)public void setFIXSessionListener(FIXSessionListener listener)
FIXSession
setFIXSessionListener in interface FIXSessionlistener - the user specified listenerFIXSession.setFIXSessionListener(FIXSessionListener)public MessageStorage getOutgoingMessageStorage()
ExtendedFIXSession
getOutgoingMessageStorage in interface ExtendedFIXSessionExtendedFIXSession.getOutgoingMessageStorage()public MessageStorage getIncomingMessageStorage()
ExtendedFIXSession
getIncomingMessageStorage in interface ExtendedFIXSessionExtendedFIXSession.getIncomingMessageStorage()
public void saveSessionParameters()
throws IOException
ExtendedFIXSession
saveSessionParameters in interface ExtendedFIXSessionIOException - if I/O error occurredExtendedFIXSession.saveSessionParameters()
public void restoreSessionParameters()
throws IOException
ExtendedFIXSession
restoreSessionParameters in interface ExtendedFIXSessionIOException - if I/O error occurredExtendedFIXSession.restoreSessionParameters()
public abstract void connect()
throws IOException
FIXSession
connect in interface FIXSessionIOException - I/O exception if error occurredpublic SessionParameters getSessionParametersInstance()
ExtendedFIXSession
getSessionParametersInstance in interface ExtendedFIXSessionExtendedFIXSession.getSessionParametersInstance()public FIXMessageFactory getMessageFactory()
ExtendedFIXSession
getMessageFactory in interface ExtendedFIXSessionExtendedFIXSession.getMessageFactory()public SessionParameters getSessionParameters()
getSessionParameters in interface FIXSessionFIXSession.getSessionParameters()public SessionState getSessionState()
FIXSession
getSessionState in interface FIXSessionFIXSession.getSessionState()public void setSessionState(SessionState sessionState)
ExtendedFIXSession
setSessionState in interface ExtendedFIXSessionsessionState - the new session stateExtendedFIXSession.setSessionState(com.epam.fixengine.SessionState)public long getBytesRead()
ExtendedFIXSession
getBytesRead in interface ExtendedFIXSessionExtendedFIXSession.getBytesRead()public long getEstablished()
ExtendedFIXSession
getEstablished in interface ExtendedFIXSessionExtendedFIXSession.getEstablished()public long getBytesSent()
ExtendedFIXSession
getBytesSent in interface ExtendedFIXSessionExtendedFIXSession.getBytesSent()public long getNoOfInMessages()
ExtendedFIXSession
getNoOfInMessages in interface ExtendedFIXSessionExtendedFIXSession.getNoOfInMessages()public long getNoOfOutMessages()
ExtendedFIXSession
getNoOfOutMessages in interface ExtendedFIXSessionExtendedFIXSession.getNoOfInMessages()public long getLastInMessageTimestamp()
ExtendedFIXSession
getLastInMessageTimestamp in interface ExtendedFIXSessionExtendedFIXSession.getLastInMessageTimestamp()public long getLastOutMessageTimestamp()
ExtendedFIXSession
getLastOutMessageTimestamp in interface ExtendedFIXSessionExtendedFIXSession.getLastOutMessageTimestamp()protected HandlerChain getMessageHandlers()
protected void initSession()
throws IOException
IOException - - if I/O error occurred.protected boolean isResetTimeMissed(long lastResetTime)
protected void initSessionInternal()
throws IOException
IOExceptionprotected void loadSessionParametersFromFile()
.
protected void startSession()
throws IOException
IOExceptionpublic void disconnect(String reason)
disconnect in interface FIXSessionreason - the reason, if parameter is not null,
the logof message will be send with 58=reason.FIXSession.disconnect(String)public void shutdown(boolean blocking)
blocking is true, the next call of method is blocking.
shutdown in interface ExtendedFIXSessionblocking - the blocking parameterprotected void storeProcessedSeqNumber()
The method work only when last processed and last incoming seq nums are not equals.
public void sendMessage(String type,
FIXFieldList content)
FIXSessionmsgType is null, Engine sends the message as is;
msgType is "", Engine updates body length, sequence number, sending time and checksum fields;
content.
sendMessage in interface FIXSessiontype - the message type (Tag 35 content)content - the message contentFIXSession.sendMessage(String, com.epam.fix.message.FIXFieldList)public void sendAsIs(FIXFieldList message)
FIXSession
sendAsIs in interface FIXSessionmessage - the message content
public void sendWithChanges(FIXFieldList content,
ChangesType allowedChangesType)
FIXSession
sendWithChanges in interface FIXSessioncontent - the message contentallowedChangesType - the parameter takes the next values:public void sendMessage(FIXFieldList message)
FIXSessionmessage .
sendMessage in interface FIXSessionmessage - the messageFIXSession.sendMessage(com.epam.fix.message.FIXFieldList)
public void sendMessageOutOfTurn(String type,
FIXFieldList message)
ExtendedFIXSession
sendMessageOutOfTurn in interface ExtendedFIXSessiontype - the message typemessage - the messageFIXSession.sendMessage(String, com.epam.fix.message.FIXFieldList)public MessageValidator getMessageValidator()
FIXSession
getMessageValidator in interface FIXSessionFIXSession.getMessageValidator()public void dispose()
FIXSession
dispose in interface FIXSessionFIXSession.dispose()protected void sendTestRequest()
protected void disconnectTestRequestIsLost()
public void checkHasSessionSendOrReceivedTestRequest()
If session is not received any messages during HB interval the HB will be send and
If no response received session will be disconnected;
This is helper method for session task.
protected void restoreSessionAfterReceivedTestRequest()
public void setAttribute(String key,
Object object)
ExtendedFIXSession
setAttribute in interface ExtendedFIXSessionkey - the attribute keyobject - the attribute valueExtendedFIXSession.setAttribute(String, Object)public Object getAttribute(String key)
ExtendedFIXSession
getAttribute in interface ExtendedFIXSessionkey - the attribute key
ExtendedFIXSession.getAttribute(String)public void removeAttribute(String key)
ExtendedFIXSession
removeAttribute in interface ExtendedFIXSessionkey - the attribute keyExtendedFIXSession.removeAttribute(String)public void addSessionStateListener(com.epam.fixengine.session.FIXSessionStateListener stateListener)
addSessionStateListener in interface com.epam.fixengine.session.SessionStateListenSupportpublic void removeSessionStateListener(com.epam.fixengine.session.FIXSessionStateListener stateListener)
removeSessionStateListener in interface com.epam.fixengine.session.SessionStateListenSupportpublic String toString()
toString in class Objectpublic boolean equals(Object o)
equals in class Objectpublic int hashCode()
hashCode in class Objectpublic com.epam.fixengine.encryption.Encryption getEncryption()
getEncryption in interface ExtendedFIXSession
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||