question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Questions regarding Exchange and Service's states and lifecycle

See original GitHub issue

Let’s say we have the following code in my class.

this.exchange = ExchangeFactory.INSTANCE.createExchange(this.exchangeSpecification);
this.marketDataService = this.exchange.getMarketDataService();
this.accountService = this.exchange.getAccountService();
this.tradeService = this.exchange.getTradeService();

If I pass around the references to other classes, do I need to handle any synchronization or inconsistent state issue across classes when using these services?

Basically, I want to know during my program’s lifecycle, is it safe to assume I only need to create one instance of Exchange and pass its reference anywhere without worrying about any internal inconsistency?

Am I correct to assume so because it’s REST API so instance of Exchange doesn’t hold any internal state information and it’s just a set of interfaces.

Assuming the exchange specification is the same, does it mean, in no circumstance, that I need to recreate the instance of exchange and its services in case of exceptions? Once they are created, they are always valid to use?

Let me know if my questions are ambiguous and I’d structure them more clearly.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:14 (14 by maintainers)

github_iconTop GitHub Comments

1reaction
npomfretcommented, Sep 20, 2017

I don’t know the exact exceptions but you can force them to happen by setting the two timeout values to 1ms. Obviously, you’ll need to do them one at a time because the read timeout won’t happen if the connection isn’t made.

0reactions
jcuyperscommented, Oct 23, 2017

it would be beneficial if this could be integrated with the rate-limiter discussion. mutex block with rate-limiting consideration.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Android Interview Questions And Answers | DigitalOcean
I have written a lot on Android tutorials, here I am listing some of the important android interview questions to help you in...
Read more >
Services overview | Android Developers
For more information about the lifecycle of a service, see the section below about Managing the Lifecycle of a Service. Creating a bound...
Read more >
Everything You Need to Know about Customer Lifecycle ...
Here are some customer service tool resources for customer lifecycle management:
Read more >
Android - Services - Tutorialspoint
A service has life cycle callback methods that you can implement to monitor changes in the service's state and you can perform work...
Read more >
Products Ending Support for 2020 - Microsoft Lifecycle
Find out which products will retire, reach end of support or move from mainstream support to extended support in 2020.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found