[Quickfix-developers] Java SocketInitiator Termination
Brought to you by:
orenmnero
From: <Rob...@ca...> - 2004-10-11 21:12:36
|
Hello All, I'm a newbie to QuickFIX 1.9.2 and am working with Java to write a simple SocketInitiator program. It works well, but hangs at the end of main. Perhaps there's a thread still running or a socket still open. I'm at a loss to understand why I need to invoke System.exit to get my application to end. To experiment, I changed the SocketInitiator to a SocketAcceptor and modified the configuration file. It then terminated properly. The example program "tradeclient," a C++ SocketInitiator program, terminates properly for me, as does the Java SocketAcceptor "executor." Below is a simplified version of my main Java object and my configuration file. Thanks for any help, Rob Kracik Cargill Investor Services ===Java Application=== package buysidesimulator; import quickfix.*; import java.io.FileInputStream; public class BuySideSimulator { static { System.loadLibrary("quickfix_jni"); } public static void main(String args[]) throws Exception { try { // Parse arguments into an object. CmdLineArgs cmdLineArgs = new CmdLineArgs(args); // Standard QuickFix start-up. Application application = new Application(); SessionSettings settings = new SessionSettings(new FileInputStream(cmdLineArgs.m_configFile)); MessageStoreFactory messageStoreFactory = new FileStoreFactory(settings); LogFactory logFactory = new FileLogFactory(settings); MessageFactory messageFactory = new DefaultMessageFactory(); SocketInitiator initiator = new SocketInitiator (application, messageStoreFactory, settings, logFactory, messageFactory); initiator.start(); // For simplicity, don't do any useful work. // application.run(cmdLineArgs); initiator.stop(); } catch (Exception e) { System.out.println(e); } // I get to this point, but need to invoke System.exit(0) to cause my application to end. // System.exit(0); } } ===Configuration File=== (Same as the configuration file I use for "tradeclient") [DEFAULT] ConnectionType=initiator HeartBtInt=30 FileStorePath=store FileLogPath=logs StartTime=06:00:00 EndTime=06:00:00 UseDataDictionary=N SocketConnectHost=localhost SocketConnectPort=5001 [SESSION] BeginString=FIX.4.2 # VeriFIX default values SenderCompID=YourComputer TargetCompID=MyComputer |