Dukascopy
 
 
Wiki JStore Search Login

Attention! Read the forum rules carefully before posting a topic.

    Try to find an answer in Wiki before asking a question.
    Submit programming questions in this forum only.
    Off topics are strictly forbidden.

Any topics which do not satisfy these rules will be deleted.

com.dukascopy.api.JFException: Incorrect thread on Live
 Post subject: com.dukascopy.api.JFException: Incorrect thread on Live Post rating: 0   New post Posted: Fri 02 Dec, 2011, 15:02 

User rating: 0
Joined: Thu 04 Aug, 2011, 09:33
Posts: 6
Location: PL
Hello,

I have just experienced the above exception for the second time in a standalone JForex API
application (2.6.46) when submitting order. I am aware of threading issues:
https://www.dukascopy.com/wiki/index.php?title=Threading

The strange thing is that I do not send orders from an Event
Dispatch thread or any other thread. The strategy runs automatically
in a thread provided by ClientFactory.getDefaultInstance().

I did not catch the exception, it stopped the strategy (onStop was invoked). But the other
strange thing is that the strategy kept on executing, receiving messages, bars etc. as if nothing happened. The orders were received and filled. If onStop is invoked I would expect that it is shut down. I have my client code that depends on the onStop method. In particular I can turn the strategy on from my GUI and have two instances run at the same time...

The stack trace:
com.dukascopy.api.JFException: Incorrect thread
       at com.dukascopy.api.impl.connect.JForexEngineImpl.submitOrder(JForexEngineImpl.java:117)
       at com.dukascopy.api.impl.connect.JForexEngineImpl.submitOrder(JForexEngineImpl.java:296)
       at com.dukascopy.api.impl.connect.JForexEngineImpl.submitOrder(JForexEngineImpl.java:300)
       at com.dukascopy.api.impl.connect.JForexEngineImpl.submitOrder(JForexEngineImpl.java:304)
(...) client code
       at com.dukascopy.api.impl.execution.TaskTick.call(TaskTick.java:62)
       at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
       at java.util.concurrent.FutureTask.run(FutureTask.java:138)
       at com.dukascopy.api.impl.execution.ScienceThreadPoolExecutor$Worker.runTask(ScienceThreadPoolExecutor.java:904)
       at com.dukascopy.api.impl.execution.ScienceThreadPoolExecutor$Worker.run(ScienceThreadPoolExecutor.java:926)
       at java.lang.Thread.run(Thread.java:662)

Today it happened at 2011-12-02 13:26:56.558 GMT if it's of any use.

Regards,
Marcin Bablok


 
 Post subject: Re: com.dukascopy.api.JFException: Incorrect thread on Live Post rating: 0   New post Posted: Mon 05 Dec, 2011, 15:15 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
We were not able to reproduce the issue with the given information. Could you please specify:
1) Did you launch the strategy with live-data or with historical-data?
2) How many and which instruments does your strategy use?
3) After the onStop() got executed, did you receive messages over all instruments, periods and ticks, or only a part (for instance only EUR/CHF messages from onBar method of 1 minute bars)?
4) Could you please provide a more detailed log from (JForexClientLibrary folder logs)?


 
 Post subject: Re: com.dukascopy.api.JFException: Incorrect thread on Live Post rating: 0   New post Posted: Tue 06 Dec, 2011, 09:29 

User rating: 0
Joined: Thu 04 Aug, 2011, 09:33
Posts: 6
Location: PL
API Support wrote:
We were not able to reproduce the issue with the given information. Could you please specify:
1) Did you launch the strategy with live-data or with historical-data?

Live-data
API Support wrote:
2) How many and which instruments does your strategy use?

28 instruments:
AUDCAD
AUDCHF
AUDJPY
AUDNZD
AUDUSD
CADCHF
CADJPY
CHFJPY
EURAUD
EURCAD
EURCHF
EURGBP
EURJPY
EURNZD
EURUSD
GBPAUD
GBPCAD
GBPCHF
GBPJPY
GBPNZD
GBPUSD
NZDCAD
NZDCHF
NZDJPY
NZDUSD
USDCAD
USDCHF
USDJPY
API Support wrote:
3) After the onStop() got executed, did you receive messages over all instruments, periods and ticks, or only a part (for instance only EUR/CHF messages from onBar method of 1 minute bars)?

Yes, all instruments received messages. Ticks and bars - which bars I do not know, I log only events that come from hour period and ticks.
API Support wrote:
4) Could you please provide a more detailed log from (JForexClientLibrary folder logs)?

If you refer to logs that can be set in log4j.properties - I have the com.dukascopy category set to INFO level and there is nothing in the log file above what I have already put in the previous post.

I hope it helps.

Regards,
Marcin Bablok


 
 Post subject: Re: com.dukascopy.api.JFException: Incorrect thread on Live Post rating: 0   New post Posted: Tue 06 Dec, 2011, 09:41 

User rating: 0
Joined: Thu 04 Aug, 2011, 09:33
Posts: 6
Location: PL
The problem is on my side. I have a connection listener and when it is reconnected it starts the same strategy for the second time. I just experienced it, and found my bug. One strategy stops when eg. tries to close a position that was just closed and it stops on exception, but the other works, hence the log entries...

Thank you for help anyway.


 

Jump to:  

  © 1998-2025 Dukascopy® Bank SA
On-line Currency forex trading with Swiss Forex Broker - ECN Forex Brokerage,
Managed Forex Accounts, introducing forex brokers, Currency Forex Data Feed and News
Currency Forex Trading Platform provided on-line by Dukascopy.com