@Override public Set<Statistic<Number>> passthru(String name, Set<String> tags) { ArrayList<String> key = new ArrayList<String>(tags.size() + 1); key.addAll(tags); Collections.sort(key); key.add(name); if (customPassthrus.containsKey(key)) { return customPassthrus.get(key); } // lets make sure we don't get it twice. synchronized (customPassthrus) { if (customPassthrus.containsKey(key)) { return customPassthrus.get(key); } Set<ValueStatistic<?>> interim = findPassThroughStatistic(manager, EhcacheQueryBuilder.cache().descendants(), name, tags); if (interim.isEmpty()) { return Collections.EMPTY_SET; } Set<Statistic<Number>> ret = new HashSet<Statistic<Number>>(interim.size()); for (ValueStatistic<?> vs : interim) { SemiExpiringStatistic stat = new SemiExpiringStatistic(vs, executor, defaultHistorySize, SECONDS.toNanos(defaultIntervalSeconds)); ret.add(stat); } customPassthrus.put(key, ret); return ret; } }
@Override public Set<TreeNode> execute(Set<TreeNode> input) { Set<TreeNode> result = new HashSet<TreeNode>(); result.addAll(input); result.addAll(chain.execute(input)); return result; } }).build());
@Override public Set<Statistic<Number>> passthru(String name, Set<String> tags) { ArrayList<String> key = new ArrayList<String>(tags.size() + 1); key.addAll(tags); Collections.sort(key); key.add(name); if (customPassthrus.containsKey(key)) { return customPassthrus.get(key); } // lets make sure we don't get it twice. synchronized (customPassthrus) { if (customPassthrus.containsKey(key)) { return customPassthrus.get(key); } Set<ValueStatistic<?>> interim = findPassThroughStatistic(manager, EhcacheQueryBuilder.cache().descendants(), name, tags); if (interim.isEmpty()) { return Collections.EMPTY_SET; } Set<Statistic<Number>> ret = new HashSet<Statistic<Number>>(interim.size()); for (ValueStatistic<?> vs : interim) { SemiExpiringStatistic stat = new SemiExpiringStatistic(vs, executor, defaultHistorySize, SECONDS.toNanos(defaultIntervalSeconds)); ret.add(stat); } customPassthrus.put(key, ret); return ret; } }
@Override public Set<Statistic<Number>> passthru(String name, Set<String> tags) { ArrayList<String> key = new ArrayList<String>(tags.size() + 1); key.addAll(tags); Collections.sort(key); key.add(name); if (customPassthrus.containsKey(key)) { return customPassthrus.get(key); } // lets make sure we don't get it twice. synchronized (customPassthrus) { if (customPassthrus.containsKey(key)) { return customPassthrus.get(key); } Set<ValueStatistic<?>> interim = findPassThroughStatistic(manager, EhcacheQueryBuilder.cache().descendants(), name, tags); if (interim.isEmpty()) { return Collections.EMPTY_SET; } Set<Statistic<Number>> ret = new HashSet<Statistic<Number>>(interim.size()); for (ValueStatistic<?> vs : interim) { SemiExpiringStatistic stat = new SemiExpiringStatistic(vs, executor, defaultHistorySize, SECONDS.toNanos(defaultIntervalSeconds)); ret.add(stat); } customPassthrus.put(key, ret); return ret; } }
/** * Add the given nodes to the current node set * * @return merged node set */ EhcacheQuery add(final EhcacheQuery chain) { return new EhcacheQuery(queryBuilder().chain(query).chain(new Query() { @Override public Set<TreeNode> execute(Set<TreeNode> input) { Set<TreeNode> result = new HashSet<TreeNode>(); result.addAll(input); result.addAll(chain.execute(input)); return result; } }).build()); }
/** * Select the descendants of the current node set * * @return descendants */ EhcacheQuery descendants() { return new EhcacheQuery(queryBuilder().chain(query).descendants().build()); }
/** * Select the children of the current node set that are subtypes of the specified class * * @param klazz class to be selected * @return children of the specified type */ EhcacheQuery children(Class<?> klazz) { return new EhcacheQuery(queryBuilder().chain(query).children().filter(context(identifier(subclassOf(klazz)))).build()); }
/** * Remove instances of the specified type from the node set * * @param klazz class to be excluded * @return current set minus the given type */ EhcacheQuery exclude(Class<?> klazz) { return new EhcacheQuery(queryBuilder().chain(query).filter(context(identifier(not(subclassOf(klazz))))).build()); }
/** * Select the descendants of the current node set * * @return descendants */ EhcacheQuery descendants() { return new EhcacheQuery(queryBuilder().chain(query).descendants().build()); }
/** * Creates a query selecting all children. * * @return children query */ static EhcacheQuery children() { return new EhcacheQuery(queryBuilder().build()).children(); }
/** * Creates a query selecting caches. * * @return cache query */ static EhcacheQuery cache() { return new EhcacheQuery(queryBuilder().build()).children(Cache.class); }
/** * Remove instances of the specified type from the node set * * @param klazz class to be excluded * @return current set minus the given type */ EhcacheQuery exclude(Class<?> klazz) { return new EhcacheQuery(queryBuilder().chain(query).filter(context(identifier(not(subclassOf(klazz))))).build()); }
/** * Select the children of the current node set that are subtypes of the specified class * * @param klazz class to be selected * @return children of the specified type */ EhcacheQuery children(Class<?> klazz) { return new EhcacheQuery(queryBuilder().chain(query).children().filter(context(identifier(subclassOf(klazz)))).build()); }
/** * Creates a query selecting all descendants. * * @return descendants query */ static EhcacheQuery descendants() { return new EhcacheQuery(queryBuilder().build()).descendants(); }
/** * Select the children of the current node set * * @return children */ EhcacheQuery children() { return new EhcacheQuery(queryBuilder().chain(query).children().build()); }
/** * Select the children of the current node set * * @return children */ EhcacheQuery children() { return new EhcacheQuery(queryBuilder().chain(query).children().build()); }
/** * Creates a query selecting all children. * * @return children query */ static EhcacheQuery children() { return new EhcacheQuery(queryBuilder().build()).children(); }
@Override public Set<TreeNode> execute(Set<TreeNode> input) { Set<TreeNode> result = new HashSet<TreeNode>(); result.addAll(input); result.addAll(chain.execute(input)); return result; } }).build());
/** * Creates a query selecting caches. * * @return cache query */ static EhcacheQuery cache() { return new EhcacheQuery(queryBuilder().build()).children(Cache.class); }
/** * Creates a query selecting all descendants. * * @return descendants query */ static EhcacheQuery descendants() { return new EhcacheQuery(queryBuilder().build()).descendants(); }