Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion ClientSimulator/src/main/java/client/Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -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()){
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

acquire is a blocking operation. This should be tryAcquire with a timeout

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem. This was the implementation in the Hawkes client so does that need to be changed to use a tryAquire as well?

if(System.currentTimeMillis() - startTime > 100_000){
System.out.println("Market Data Time out");
break;
}
}
}

public void submitOrder(String clientOrderId, long volume, long price, String side, String orderType, String timeInForce, long displayQuantity, long minQuantity, long stopPrice) {
mktDataUpdateSemaphore.acquire();
Expand Down