class JDBCObjectStore implements ObjectStore {

    @Override
    public ObjectStoreConnection getConnection(boolean autoCommit, boolean readWrite) {
        final String caller = "getConnection";
        try {
            PoolableDataSource src = readWrite ? rwSrc : roSrc;
            JDBCConnection jdbcConn = new JDBCConnection(src.getConnection(), autoCommit);
            jdbcConn.setOperationTimeout(opTimeout);
            return jdbcConn;
        } catch (Exception ex) {
            
            // if this was a read-only operation and we failed to get a connection
            // then we're going to try to get a connection from our read-write
            // pool first before throwing an exception
            
            if (!readWrite) {
                return getConnection(autoCommit, true);
            }
            
            // otherwise our service is not available and let the caller
            // retry the request if necessary
            
            throw ZMSUtils.error(ResourceException.SERVICE_UNAVAILABLE, ex.getMessage(), caller);
        }
    }

    public  JDBCObjectStore(PoolableDataSource rwSrc, PoolableDataSource roSrc);

}