The scenario is like this:
We have a web UI to initiate the call (on the server). After the call is initiated we will have a callId sent back from the server to the UI and wait for the user actions. There will also be a Timer running on the UI (counting down for 1 minute). If the user does not pick up the call in 1 minute, the web UI will send an HTTP request to the server and ask the server to drop that call, and then update the call status to be Timeout.
Another approach is to have a timer associated with the call and in the timeout() method drop that call in certain time. But I' not sure if this is a better way since each timer will create a new thread running inside the service, when we have multiple calls need to be handled, will these threads have some bad effects ? Another thing is that if we do this way then in the timeout() method I also have to send notification back to the web ui. Since HTTP request is a one way communication, we will have to either use asynchronous request (tried to but failed) or open a web socket. That will make thing more complicated. We are using simple HTTP polling to update status of calls right now. BTW, I also tried EJB Timer but got confused about the Properties and InitialContext in the example you gave me in another post. Is there any example in SDK which uses a Timer service so I can see how to get the Properties and InitialContext in the project ?
|