-
-
Notifications
You must be signed in to change notification settings - Fork 142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multithread support for Iso853Client? #4
Labels
Comments
I have written a thread safe version that is not fully tested but I think could work. I could send it to you if you are interested. |
Thank you, @keyhan, send it please. |
I guess it does not have any timeout handling? I was thinking something in line with: private synchronized void send(IsoMessage isoMessage) throws InterruptedException {
sendAsync(isoMessage).sync().await();
}
public void orderSend(IsoMessage isoMessage, int timeoutperiod) throws InterruptedException, TimeoutException{
Runnable orderTask = new Runnable() {
@Override
public void run() {
try {
send(isoMessage);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
};
Thread orderThread = new Thread(orderTask);
orderThread.start();
Thread.sleep(timeoutperiod);
if(orderThread.isAlive()) {
orderThread.interrupt();
throw new TimeoutException("Thread " + orderThread.getName() + " has timed out.");
}
} |
don't use this netty based library with blocking thread timeout handling. For multithread use
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, just a comment, it would make sense to make some methods like "send()" in client class synchronized. This would make them threadsafe, allowing multiple threads using the same client.
The text was updated successfully, but these errors were encountered: