class DBService implements RolesProvider {

    boolean shouldRetryOperation(ResourceException ex, int retryCount) {
        
        // before doing anything else let's check to see if
        // we still have the option to retry the operation
        
        if (retryCount <= 1) {
            return false;
        }
        
        // if we got a conflict result it means we either had
        // no connection or deadlock was detected and as such
        // the changes were aborted
        
        boolean retry = false;
        switch (ex.getCode()) {
            
            case ResourceException.CONFLICT:
                
                retry = true;
                break;
                
            case ResourceException.GONE:

                // this error indicates that the server is reporting it is in
                // read-only mode which indicates a fail-over has taken place
                // and we need to clear all connections and start new ones
                // this could only happen with write operations against the
                // read-write object store
                
                store.clearConnections();
                retry = true;
                break;
        }
        
        // if we're asked to retry then we're going to
        // wait for a short period of time to allow the other
        // connection to finish its work
        
        if (retry) {
            
            if (LOG.isDebugEnabled()) {
                LOG.debug(": possible deadlock, retries available: " + retryCount);
            }

            ZMSUtils.threadSleep(retrySleepTime);
        }
        
        // return our response
        
        return retry;
    }

    public  DBService(ObjectStore store, AuditLogger auditLogger, ZMSConfig zmsConfig, AuditReferenceValidator auditReferenceValidator);

}