Added a time out for the market data semaphore in the client#8
Open
matthewdicks98 wants to merge 1 commit intodharmeshsing:masterfrom
Open
Added a time out for the market data semaphore in the client#8matthewdicks98 wants to merge 1 commit intodharmeshsing:masterfrom
matthewdicks98 wants to merge 1 commit intodharmeshsing:masterfrom
Conversation
| public void waitForMarketDataUpdate() { while(!mktDataUpdateSemaphore.acquire()){} } | ||
| public void waitForMarketDataUpdate() { | ||
| long startTime = System.currentTimeMillis(); | ||
| while(!mktDataUpdateSemaphore.acquire()){ |
Owner
There was a problem hiding this comment.
acquire is a blocking operation. This should be tryAcquire with a timeout
Author
There was a problem hiding this comment.
No problem. This was the implementation in the Hawkes client so does that need to be changed to use a tryAquire as well?
Owner
|
I don’t recall why the code was written like that, so I think it is best to make the change on your code first before updating the hawkes client code.
… On 16 May 2022, at 4:14 pm, matthewdicks98 ***@***.***> wrote:
@matthewdicks98 commented on this pull request.
In ClientSimulator/src/main/java/client/Client.java <#8 (comment)>:
> @@ -153,7 +153,15 @@ public void close() {
System.out.println("Logged out.");
}
- public void waitForMarketDataUpdate() { while(!mktDataUpdateSemaphore.acquire()){} }
+ public void waitForMarketDataUpdate() {
+ long startTime = System.currentTimeMillis();
+ while(!mktDataUpdateSemaphore.acquire()){
No problem. This was the implementation in the Hawkes client so does that need to be changed to use a tryAquire as well?
—
Reply to this email directly, view it on GitHub <#8 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ACSXZWLUBP65NQDLFERKWPLVKHRTDANCNFSM5VYAOY2A>.
You are receiving this because you commented.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added a time out for the semaphore in the client using the same structure as found in the Hawkes client.