/** * @param type type of query * @param profile userprofile * @param sessionIdentifier session */ protected void trackQuery(String type, Profile profile, String sessionIdentifier) { String userName = (profile.getUsername() != null) ? profile.getUsername() : ""; QueryTrack queryTrack = new QueryTrack( type, userName, sessionIdentifier, new Timestamp(System.currentTimeMillis())); if (queryTracker != null) { queryTracker.storeTrack(queryTrack); } else { LOG.warn("Query execution not tracked. Check if the QueryTracker has been configured"); } }
/** * Return an instance of the QueryTracker * * @param con connection to the database * @param trackQueue the queue where the tracks are temporary stored * @return QueryTracker the query tracker */ public static QueryTracker getInstance(Connection con, Queue<Track> trackQueue) { if (queryTracker == null) { queryTracker = new QueryTracker(con, trackQueue); try { queryTracker.createTrackerTable(con); } catch (Exception e) { LOG.error("Error creating the table associated to the QueryTracker" + e); } } return queryTracker; }