/** * Wraps the specified dynamic proxy with the Dropwizard {@link Managed} interface. * @param proxy A dynamic service proxy created by {@link ServicePoolBuilder#buildProxy(RetryPolicy)}. */ public ManagedServicePoolProxy(Object proxy) { checkArgument(ServicePoolProxies.isProxy(proxy)); _proxy = proxy; }
/** * Returns the {@link com.bazaarvoice.ostrich.ServicePool} used by the specified dynamic service proxy. This can be * used for various reasons, including making a service call using non-standard retry parameters or getting access * to service pool statistics. * @param dynamicProxy A service pool dynamic proxy created by {@link ServicePoolBuilder#buildProxy}. * @param <S> The service interface type. * @return The {@link com.bazaarvoice.ostrich.ServicePool} used by the specified dynamic service proxy. */ public static <S> com.bazaarvoice.ostrich.ServicePool<S> getPool(S dynamicProxy) { checkNotNull(dynamicProxy); checkArgument(isProxy(dynamicProxy)); @SuppressWarnings("unchecked") ServicePoolProxy<S> poolProxy = (ServicePoolProxy<S>) Proxy.getInvocationHandler(dynamicProxy); return poolProxy.getServicePool(); } }
/** * Returns the {@link com.bazaarvoice.ostrich.ServicePool} used by the specified dynamic service proxy. This can be * used for various reasons, including making a service call using non-standard retry parameters or getting access * to service pool statistics. * @param dynamicProxy A service pool dynamic proxy created by {@link ServicePoolBuilder#buildProxy}. * @param <S> The service interface type. * @return The {@link com.bazaarvoice.ostrich.ServicePool} used by the specified dynamic service proxy. */ public static <S> com.bazaarvoice.ostrich.ServicePool<S> getPool(S dynamicProxy) { checkNotNull(dynamicProxy); checkArgument(isProxy(dynamicProxy)); @SuppressWarnings("unchecked") ServicePoolProxy<S> poolProxy = (ServicePoolProxy<S>) Proxy.getInvocationHandler(dynamicProxy); return poolProxy.getServicePool(); } }