I’m trying to write a message acknowledgement application where I need to:
a) Add every new message on a message queue. Just using an Arraylist for creating a message queue.
b) Notify a timertask to expect an acknowledge in 50 sec for the message so make it to either sleep for 50sec or wake up when an acknowledgement is received.
What is the best practice to implement this?
Thanks
I’m not quite clear what your needs are. What does this have to do with Swing or timers? What kind of threading are you dealing with here? I’ll make some assumptions and suggest a couple things.
It sounds like you want to put a message in a queue, then wait until a response is received, or 50s max. You should check out BlockingQueue. It is thread-safe, and you can wait for a specific amount of time for another thread to put something in it. This seems like it could be useful for message/acknowledge problem.
I need more details on your problem for more specific help.