www.ClassicTW.com
https://mail.black-squirrel.com/

SWATH UserDefinedCommand: initInstance vs. initCommand
https://mail.black-squirrel.com/viewtopic.php?f=15&t=31916
Page 1 of 1

Author:  kjkrum [ Sun Jul 24, 2011 3:45 pm ]
Post subject:  SWATH UserDefinedCommand: initInstance vs. initCommand

I wrote a simple UserDefinedCommand called TradeAll and a UserDefinedScript that uses it. I noticed that the exec() methods in other people's UDCs were calling initInstance() and execInstance() instead of initCommand() and startCommand(), so I copied this without understanding it.

But when I ran it, SWATH 1.9.8 hung on executing the UDC. (It said "cmd: TradeAll" in the status bar.) I added some trace messages and discovered that my command was getting executed, but it hung after returning from the startCommand() method.

When I call initCommand() and startCommand() myself, it works.

Can anyone explain what's going on? Why do people call initInstance() and execInstance()?

Code:
public static void exec() throws Exception {
   TradeAll cmd = new TradeAll();
   //cmd.initInstance();
   //cmd.execInstance();
   if(cmd.initCommand()) cmd.startCommand();
}

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/