public synchronized boolean shouldExecute(KeySelect keySelect){
  if (slowQueries == null)   return true;
  String queryKey=keySelect.generateKey();
  Long pendingQueryInvocation=pendingQueries.get(queryKey);
  if (pendingQueryInvocation != null) {
    if (logger.isDebugEnabled()) {
      logger.debug("Skipped pending query: queryKey=" + queryKey);
    }
    return false;
  }
  Long slowQueryInvocation=slowQueries.get(queryKey);
  if (slowQueryInvocation != null) {
    keySelect.setLastInvocation(slowQueryInvocation);
    long sinceLastMillis=System.currentTimeMillis() - slowQueryInvocation;
    if (sinceLastMillis < (slowQueryCacheDuration * 1000)) {
      slowQueries.put(queryKey,System.currentTimeMillis());
      return false;
    }
  }
  pendingQueries.put(queryKey,System.currentTimeMillis());
  return true;
}

public synchronized boolean shouldExecute ( KeySelect keySelect ) { if ( slowQueries == null ) return true ; String queryKey = keySelect . generateKey ( ) ; Long pendingQueryInvocation = pendingQueries . get ( queryKey ) ; if ( pendingQueryInvocation != null ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Skipped pending query: queryKey=" + queryKey ) ; } return false ; } Long slowQueryInvocation = slowQueries . get ( queryKey ) ; if ( slowQueryInvocation != null ) { keySelect . setLastInvocation ( slowQueryInvocation ) ; long sinceLastMillis = System . currentTimeMillis ( ) - slowQueryInvocation ; if ( sinceLastMillis < ( slowQueryCacheDuration * 1000 ) ) { slowQueries . put ( queryKey , System . currentTimeMillis ( ) ) ; return false ; } } pendingQueries . put ( queryKey , System . currentTimeMillis ( ) ) ; return true ; }
returns true if we have not heard of this query * or * if the query has exceeded the slow query limit .
