
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();
}