class QueryCacheBean {

    @GET
    @Path("/listRunningQueries")
    @Produces({"application/xml", "text/xml", "application/json", "text/yaml", "text/x-yaml", "application/x-yaml", "text/html"})
    @GZIP
    @RolesAllowed({"Administrator", "JBossAdministrator"})
    public RunningQueries getRunningQueries() {
        
        RunningQueries result = new RunningQueries();
        
        // Iterate over the cache contents
        for (RunningQuery value : cache) {
            result.getQueries().add(value.toString());
        }
        // Iterate over queries that are in the init phase
        for (Entry<String,Pair<QueryLogic<?>,Connector>> entry : qlCache.snapshot().entrySet()) {
            result.getQueries().add("Identifier: " + entry.getKey() + " Query Logic: " + entry.getValue().getFirst().getClass().getName() + "\n");
        }
        return result;
    }

}