Failover in JDO
JDO needs the capability to recover from connection failures switching to backup servers upon failure.
- Switch to backup server when JDO is unable to obtain a connection to a database server/engine, or the connection breaks while in use.
- User may be able to configure an ordered list of datasources.
- JDO will default to the first datasource in the list, and if unable to obtain a connection, will attempt to obtain a connection from the next datasource in the list.
- JDO will raise JDODatastoreException when unsuccessful attempts to obtain connection in all datasources are exausted.
- If a database connection in use breaks, JDO may try to recover using the same datasource before switching to the next datasource in the list.
- If a database connection in use breaks, JDO will apply changes made previously to the new connection during JDO transaction commit or flush. The broken connection has changes rolled back.
- Each datasource in the list, may have a test statement that verifies if the connection is healthy.
- For every new transaction, JDO will switch back to the first datasource in the list.
- JDO, in background, may track which datasources are heathy to do faster switching.