[Quickfix-developers] How to stop a session?
Brought to you by:
orenmnero
From: Danis T. <td...@ho...> - 2002-11-18 17:38:46
|
Folks, I am experimenting with QuickFix using Java interfcace, and I have a couple of questions. I have created a CLIENT (initiator) and a SERVER (acceptor) which run on different JVM. A structure of both programs is idential excluding that the CLIENT uses Initiator class and the SERVER uses Acceptor class. Initially both of them create initiator or acceptor objects and start them. The object that implements Application interface is a simple logger with an inifinite loop in onRun(). Acceptor.start() method is blocked until onRun() is running. That's why the SERVER listens infinitely. I intend to send messages being outside from onRun() method of clients. To make this possible I start a simple thread that starts initiator. Something like this: (new Thread() { public void run() { initiator.statr(); } }).start(); where initiator is an instance of Initiator class. After that the CLIENT goes to sleep for awhile (10 secodns). The SERVER and the CLIENT successfully establish a session and wait. When the CLIENT wakes up it just tries to stop the "started" initiator. The call to Initiator.stop() method doesn't return and the session doesn't finish. Instead onRun() is called again. And when the time of Heartbeat message comes up LOGON procedure is initiated. See the log (FIX 4.1): [22:15,511]: CLIENT: ON_CREATE [22:15,521]: CLIENT: ON_RUN [22:25,516]: CLIENT: ON_RUN <-- !!! trying to stop() [22:26,478]: CLIENT: TO_ADMIN: ...35=A34=1... [22:26,528]: CLIENT: FROM_ADMIN: ...35=A34=1... [22:26,528]: CLIENT: ON_LOGOUT [22:56,572]: CLIENT: TO_ADMIN: ...35=034=2... [23:26,616]: CLIENT: TO_ADMIN: ...35=134=3... [23:56,740]: CLIENT: TO_ADMIN: ...35=134=4... [24:26,814]: CLIENT: TO_ADMIN: ...35=134=5... [24:56,858]: CLIENT: ON_LOGOUT [25:02,857]: CLIENT: TO_ADMIN: ...35=A34=6... <--- Again [25:02,867]: CLIENT: FROM_ADMIN: ...35=A34=2... [25:02,867]: CLIENT: ON_LOGON [25:02,877]: CLIENT: FROM_ADMIN: ...35=234=3... [25:02,877]: CLIENT: TO_ADMIN: ...35=434=2... [25:32,911]: CLIENT: TO_ADMIN: ...35=034=7... [25:32,911]: CLIENT: FROM_ADMIN: ...35=234=4... [25:32,911]: CLIENT: TO_ADMIN: ...35=434=6... [26:02,034]: CLIENT: FROM_ADMIN: ...35=034=5... [26:02,044]: CLIENT: ON_LOGOUT An unexpected exception has been detected in native code outside the VM. Unexpected Signal : EXCEPTION_ACCESS_VIOLATION occurred at PC=0x8a1ee0a Function name=(N/A) Library=(N/A) Current Java thread: at org.quickfix.SocketInitiator.doStart(Native Method) at org.quickfix.SocketInitiator.start(Unknown Source) at rawclient.Client$1.run(Client.java:37) at java.lang.Thread.run(Unknown Source) Is it allowed to use QuickFix this way? Where am I wrong? I don't know where to dig. Thanks. Danis Tazeev |