Can you add a bit more details on what exactly you are looking for and what you are trying to cleanup on close of what resource?
Thanks Jai Kiran for your reply.
We a Application Server(Jboss7) running where we deployed all our services. One of the services maintains all the clients resources held by a client. Resource is like some file at server side, on request server marks the resource for the client.
Each resource can be held by certain number of cleints. We need to release/clean all the resources(files) held by a cleint if the client disconnects from the Server with in certain amount of time like under 1 minute.
We need to handle all the cases of client termination.
Case1 - Client sends request to release the resource held by the cleint - Server release resource as it receives a request from client to release resource.
Case2 - Client Crash - We registered JVM Exit hooks and it sends request to server to clean all the resources held by the client.
Case3 - JVM Crash - Client will not get chance to send request to server to clean resources(files) held by the client.
I am working on how to handle Case3, I am finding all the possible options.
One of the options is - If Jboss provides a facility to register Listener/Callback for Client Disconnection, then we could use that.
I could see some messages in Jboss7 server log after client JVM exits.
I am looking for some suggestions to handle Case3. Is it possible to Register Listener for Client Disconnection? If Yes, any pointers?
Not sure about any hooks but I think there is a heartbeat-property that can be set that might help
In other cases you might implement some timestamping when operations are called and the server kills the connection if no operations come in within a given timeout.
Can you use a stateful session bean for this? If the client exits without removing the bean, the server should invoke the remove after the remove timeout.
This info is valuable to me.
I implemented the heart beat in my ejb interface, Now I can remove it.
Thank you sir!
Why NOT use resource adaptor to pool your resources in server (just like DB connection pool) ???
You can configure timeout for it!
Your solution is not good.
I do NOT think resource adaptor configuration is difficult for you.
Thank you all for your suggestions.
Currently we are send heartbeat for every five minutes. However we are not convienced with the solution and our requirementt is resource should be released as quickly as possible.
Can you elaborate more how Resource Adaptor pool can be used for this problem?
You can search it in jboss forum.
I know how to configure resource adaptor in jboss 5, but I do NOT try it in jboss 7.
But, I am sure that jboss 7 support resource adaptor too.
The basic framework:
The attached article is written in chinese.
But I think you can understand java codes.
After you know how to configure resource adaptor in jboss 5, resource adaptor in jboss 7 will be easier.
If you still can NOT find your answer, then post a question with another topic in jboss 7 forum.
Many jboss experts will help you.
Thanks Xiang Yingbing for your suggestions. I will look into documentation and if it suites our requirement will use that.