I'm working on an Oracle 11g RAC. We're going to start using FCF. It's my understanding, that in order to make a node failure invisible to the application, the application must detect that the node failed while the application is doing work on the connection, and retry its work. When it gets a new connection from the pool, it will be from a good node because the bad node's connections will have been reaped.
Of course, I'd like to implement this so that it's invisible to the actual application code. My first thought was to write a custom implementation of Session. This custom implementation would delegate work to the normal SessionImpl, but wrap calls in a try{} catch{} and if it detects a connecton problem, it would reconnect the session (getting a good connection) open a transaction (when necessary) and re-execute the method. However, it would appear that I would need to create my own SessionFactory implementation to get my session implementation that knows how to retry. Additionally, I would need to resolve the fact that AnnotationConfiguration generates SessionFactoryImpl's, and I would want it to generate my new implementation that can generating my retrying session implementation.
An alternative approach would be to avoid writing implementations of hibernate interfaces, but use AOP to grab the exceptions, and retry as appropriate.
I'm looking for any information about recommended strategies for handling the retry when using hibernate. I'd also be interested in hearing other approaches, or if there is a better way to do my first approach.
Thank you
Greg
|