-
1. Re: Is it possible to know ejb client disconnection at Server side
jaikiran Nov 14, 2012 1:42 AM (in response to apparaonali)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?
-
2. Re: Is it possible to know ejb client disconnection at Server side
apparaonali Nov 15, 2012 4:46 AM (in response to jaikiran)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?
-
3. Re: Is it possible to know ejb client disconnection at Server side
nickarls Nov 15, 2012 5:17 AM (in response to apparaonali)Not sure about any hooks but I think there is a heartbeat-property that can be set that might help
remote.connection.someconnection.connect.options.org.jboss.remoting3.RemotingOptions.HEARTBEAT_INTERVAL=60000
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.
-
4. Re: Is it possible to know ejb client disconnection at Server side
raylite3 Nov 15, 2012 4:41 PM (in response to apparaonali)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.
-
5. Re: Is it possible to know ejb client disconnection at Server side
ybxiang.china Nov 15, 2012 8:52 PM (in response to nickarls)This info is valuable to me.
I implemented the heart beat in my ejb interface, Now I can remove it.
Thank you sir!
-
6. Re: Is it possible to know ejb client disconnection at Server side
ybxiang.china Nov 15, 2012 8:59 PM (in response to apparaonali)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.
-
7. Re: Is it possible to know ejb client disconnection at Server side
apparaonali Nov 15, 2012 10:49 PM (in response to ybxiang.china)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?
-
8. Re: Is it possible to know ejb client disconnection at Server side
ybxiang.china Nov 19, 2012 6:17 AM (in response to apparaonali)You can search it in jboss forum.
-
9. Re: Is it possible to know ejb client disconnection at Server side
ybxiang.china Nov 19, 2012 6:40 AM (in response to apparaonali)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.
Good luck!
-
10. Re: Is it possible to know ejb client disconnection at Server side
ybxiang.china Nov 19, 2012 6:42 AM (in response to apparaonali)You can find many links about this topic, for example: https://community.jboss.org/message/604175#604175
-
11. Re: Is it possible to know ejb client disconnection at Server side
ybxiang.china Nov 19, 2012 6:44 AM (in response to apparaonali)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.
-
12. Re: Is it possible to know ejb client disconnection at Server side
apparaonali Nov 19, 2012 11:01 AM (in response to ybxiang.china)Thanks Xiang Yingbing for your suggestions. I will look into documentation and if it suites our requirement will use that.
-
13. Re: Is it possible to know ejb client disconnection at Server side
ybxiang.china Nov 20, 2012 12:25 AM (in response to apparaonali) -
14. Re: Is it possible to know ejb client disconnection at Server side
ybxiang.china Nov 22, 2012 2:44 AM (in response to apparaonali)JBoss 7 resource adaptor configuration: