@Override public void set(String key, Number val, Context ctx) { MetricConsumer consumer = currentConsumer(); if (consumer != null) { consumer.set(key, val, ctx); } }
@Override public Context createContext(Map<String, ?> keys) { MetricConsumer consumer = currentConsumer(); if (consumer == null) { return null; } return consumer.createContext(keys); }
public RequestHandlerTestDriver(String binding, RequestHandler handler) { driver = TestDriver.newSimpleApplicationInstanceWithoutOsgi(); ContainerBuilder builder = driver.newContainerBuilder(); builder.serverBindings().bind(binding, handler); driver.activateContainer(builder); }
/** * <p>Creates a {@link UriPattern} from the given pattern string, and calls {@link #put(UriPattern, Object)}.</p> * * @param uriPattern The URI pattern to parse and bind to the target. * @param target The target to assign to the URI pattern. * @throws NullPointerException If any argument is null. * @throws IllegalArgumentException If the URI pattern string could not be parsed. */ public void bind(String uriPattern, T target) { put(new UriPattern(uriPattern), target); }
private static void bindUri(BindingRepository<RequestHandler> bindings, List<String> uriPatterns, RequestHandler target) { for (String uri : uriPatterns) { bindings.bind(uri, target); } }
@Override public void add(String key, Number val, Context ctx) { MetricConsumer consumer = currentConsumer(); if (consumer != null) { consumer.add(key, val, ctx); } }
/** * Make this instance retain a reference to the resource until it is destroyed. */ void retainReference(SharedResource resource) { resourceReferences.retain(resource); }
@Override public void set(String key, Number val, Metric.Context ctx) { ForwardingContext fwd = (ForwardingContext)ctx; for (int i = 0; i < consumers.length; ++i) { consumers[i].set(key, val, fwd != null ? fwd.contexts[i] : null); } }
@Override public void add(String key, Number val, Metric.Context ctx) { ForwardingContext fwd = (ForwardingContext)ctx; for (int i = 0; i < consumers.length; ++i) { consumers[i].add(key, val, fwd != null ? fwd.contexts[i] : null); } }
public void installAll(Iterable<? extends ServerProvider> servers) { for (ServerProvider server : servers) { install(server); } }
@Override public void close() throws Exception { release(); } }
public MetricProvider(MetricConsumerProvider provider) { metric = new com.yahoo.jdisc.application.MetricProvider(new com.google.inject.Provider<MetricConsumer>() { @Override public MetricConsumer get() { return provider.newInstance(); } }).get(); }
/** * <p>Returns the number of captured groups of this match. Any non-negative integer smaller than the value returned * by this method is a valid group index for this match.</p> * * @return The number of captured groups. */ public int groupCount() { return match.groupCount(); }
@Override public void refreshPackages() { jdiscOsgi.refreshPackages(); } }
@Override public Metric get() { return new MetricImpl(consumerProvider); } }
public void uninstallAll(Iterable<? extends ServerProvider> handlers) { for (ServerProvider handler : handlers) { uninstall(handler); } }
/** * <p>Returns the number of captured groups of this match. Any non-negative integer smaller than the value * returned by this method is a valid group index for this match.</p> * * @return The number of captured groups. */ public int groupCount() { return scheme.groupCount() + host.groupCount() + (port > 0 ? 1 : 0) + path.groupCount(); }
/** * <p>Returns the input subsequence captured by the given group by this match. Groups are indexed from left to * right, starting at zero. Note that some groups may match an empty string, in which case this method returns the * empty string. This method never returns null.</p> * * @param idx The index of the group to return. * @return The (possibly empty) substring captured by the group during matching, never <code>null</code>. * @throws IndexOutOfBoundsException If there is no group in the match with the given index. */ public String group(int idx) { return match.group(idx); }
public void uninstallAll(Iterable<? extends Module> modules) { for (Module module : modules) { uninstall(module); } }