@Override public String getRequestMetricCollector() { MetricCollector mc = AwsSdkMetrics.getInternalMetricCollector(); RequestMetricCollector rmc = mc == null ? null : mc.getRequestMetricCollector(); return mc == null || rmc == RequestMetricCollector.NONE ? "NONE" : rmc.getClass().getName() ; } @Override
@Override public String getServiceMetricCollector() { MetricCollector mc = AwsSdkMetrics.getInternalMetricCollector(); ServiceMetricCollector smc = mc == null ? null : mc.getServiceMetricCollector(); return mc == null || smc == ServiceMetricCollector.NONE ? "NONE" : smc.getClass().getName() ; } @Override
/** * Returns true if metrics at the AWS SDK level is enabled; false * if disabled. */ public static boolean isMetricsEnabled() { MetricCollector mc = AwsSdkMetrics.mc; return mc != null && mc.isEnabled(); }
/** * Sets the metric collector to be used by the AWS SDK, and stop the * previously running collector used by the AWS SDK, if any. Note, however, * a request metric collector specified at the web service client level or * request level, if any, always takes precedence over the one specified at * the AWS SDK level. * <p> * Caller of this method is responsible for starting the new metric * collector specified as the input parameter. * * @param mc * the metric collector to be used by the AWS SDK; or * null if no metric collection is to be performed * at the AWS SDK level. * * @see RequestMetricCollector * @see RequestMetricCollector#NONE */ public static synchronized void setMetricCollector(MetricCollector mc) { MetricCollector old = AwsSdkMetrics.mc; AwsSdkMetrics.mc = mc; if (old != null) { old.stop(); } }
/** * Sets the metric collector to be used by the AWS SDK, and stop the * previously running collector used by the AWS SDK, if any. Note, however, * a request metric collector specified at the web service client level or * request level, if any, always takes precedence over the one specified at * the AWS SDK level. * <p> * Caller of this method is responsible for starting the new metric * collector specified as the input parameter. * * @param mc the metric collector to be used by the AWS SDK; or null if no * metric collection is to be performed at the AWS SDK level. * @see RequestMetricCollector * @see RequestMetricCollector#NONE */ @SuppressWarnings("checkstyle:hiddenfield") public static synchronized void setMetricCollector(MetricCollector mc) { MetricCollector old = AwsSdkMetrics.mc; AwsSdkMetrics.mc = mc; if (old != null) { old.stop(); } }
if (mc == null || !mc.isEnabled()) { if (dirtyEnabling) { throw new IllegalStateException("Reentrancy is not allowed");
public static <T extends ServiceMetricCollector> T getServiceMetricCollector() { if (mc == null) { if (isDefaultMetricsEnabled()) enableDefaultMetrics(); } @SuppressWarnings("unchecked") T t = (T)(mc == null ? ServiceMetricCollector.NONE : mc.getServiceMetricCollector()); return t; }
/** * Returns a non-null request metric collector for the SDK. If no custom * request metric collector has previously been specified via * {@link #setMetricCollector(MetricCollector)} and the * {@link SDKGlobalConfiguration#DEFAULT_METRICS_SYSTEM_PROPERTY} has been set, then this method * will initialize and return the default metric collector provided by the * AWS SDK on a best-attempt basis. */ public static <T extends RequestMetricCollector> T getRequestMetricCollector() { if (mc == null) { if (isDefaultMetricsEnabled()) enableDefaultMetrics(); } @SuppressWarnings("unchecked") T t = (T)(mc == null ? RequestMetricCollector.NONE : mc.getRequestMetricCollector()); return t; }
/** * Sets the metric collector to be used by the AWS SDK, and stop the * previously running collector used by the AWS SDK, if any. Note, however, * a request metric collector specified at the web service client level or * request level, if any, always takes precedence over the one specified at * the AWS SDK level. * <p> * Caller of this method is responsible for starting the new metric * collector specified as the input parameter. * * @param mc * the metric collector to be used by the AWS SDK; or * null if no metric collection is to be performed * at the AWS SDK level. * * @see RequestMetricCollector * @see RequestMetricCollector#NONE */ public static synchronized void setMetricCollector(MetricCollector mc) { MetricCollector old = AwsSdkMetrics.mc; AwsSdkMetrics.mc = mc; if (old != null) { old.stop(); } }
/** * @return true if metrics at the AWS SDK level is enabled; false if * disabled. */ @SuppressWarnings("checkstyle:hiddenfield") public static boolean isMetricsEnabled() { MetricCollector mc = AwsSdkMetrics.mc; return mc != null && mc.isEnabled(); }
@Override public String getServiceMetricCollector() { MetricCollector mc = AwsSdkMetrics.getInternalMetricCollector(); ServiceMetricCollector smc = mc == null ? null : mc.getServiceMetricCollector(); return mc == null || smc == ServiceMetricCollector.NONE ? "NONE" : smc.getClass().getName() ; } @Override
@Override public String getRequestMetricCollector() { MetricCollector mc = AwsSdkMetrics.getInternalMetricCollector(); RequestMetricCollector rmc = mc == null ? null : mc.getRequestMetricCollector(); return mc == null || rmc == RequestMetricCollector.NONE ? "NONE" : rmc.getClass().getName() ; } @Override
/** * Sets the metric collector to be used by the AWS SDK, and stop the * previously running collector used by the AWS SDK, if any. Note, however, * a request metric collector specified at the web service client level or * request level, if any, always takes precedence over the one specified at * the AWS SDK level. * <p> * Caller of this method is responsible for starting the new metric * collector specified as the input parameter. * * @param mc the metric collector to be used by the AWS SDK; or null if no * metric collection is to be performed at the AWS SDK level. * @see RequestMetricCollector * @see RequestMetricCollector#NONE */ @SuppressWarnings("checkstyle:hiddenfield") public static synchronized void setMetricCollector(MetricCollector mc) { MetricCollector old = AwsSdkMetrics.mc; AwsSdkMetrics.mc = mc; if (old != null) { old.stop(); } }
/** * Returns true if metrics at the AWS SDK level is enabled; false * if disabled. */ public static boolean isMetricsEnabled() { MetricCollector mc = AwsSdkMetrics.mc; return mc != null && mc.isEnabled(); }
public static <T extends ServiceMetricCollector> T getServiceMetricCollector() { if (mc == null) { if (isDefaultMetricsEnabled()) enableDefaultMetrics(); } @SuppressWarnings("unchecked") T t = (T)(mc == null ? ServiceMetricCollector.NONE : mc.getServiceMetricCollector()); return t; }
/** * Returns a non-null request metric collector for the SDK. If no custom * request metric collector has previously been specified via * {@link #setMetricCollector(MetricCollector)} and the * {@link SDKGlobalConfiguration#DEFAULT_METRICS_SYSTEM_PROPERTY} has been set, then this method * will initialize and return the default metric collector provided by the * AWS SDK on a best-attempt basis. */ public static <T extends RequestMetricCollector> T getRequestMetricCollector() { if (mc == null) { if (isDefaultMetricsEnabled()) enableDefaultMetrics(); } @SuppressWarnings("unchecked") T t = (T)(mc == null ? RequestMetricCollector.NONE : mc.getRequestMetricCollector()); return t; }
/** * Sets the metric collector to be used by the AWS SDK, and stop the * previously running collector used by the AWS SDK, if any. Note, however, * a request metric collector specified at the web service client level or * request level, if any, always takes precedence over the one specified at * the AWS SDK level. * <p> * Caller of this method is responsible for starting the new metric * collector specified as the input parameter. * * @param mc the metric collector to be used by the AWS SDK; or null if no * metric collection is to be performed at the AWS SDK level. * @see RequestMetricCollector * @see RequestMetricCollector#NONE */ @SuppressWarnings("checkstyle:hiddenfield") public static synchronized void setMetricCollector(MetricCollector mc) { MetricCollector old = AwsSdkMetrics.mc; AwsSdkMetrics.mc = mc; if (old != null) { old.stop(); } }
if (mc == null || !mc.isEnabled()) { if (dirtyEnabling) { throw new IllegalStateException("Reentrancy is not allowed");
/** * @param <T> Tje ServiceMetricCollector type. * @return a non-null service metric collector for the SDK. */ public static <T extends ServiceMetricCollector> T getServiceMetricCollector() { if (mc == null) { if (isDefaultMetricsEnabled()) enableDefaultMetrics(); } @SuppressWarnings("unchecked") T t = (T) (mc == null ? ServiceMetricCollector.NONE : mc.getServiceMetricCollector()); return t; }
/** * @param <T> RequestMetricCollector type. * @return a non-null request metric collector for the SDK. If no custom * request metric collector has previously been specified via * {@link #setMetricCollector(MetricCollector)} and the * {@link SDKGlobalConfiguration#DEFAULT_METRICS_SYSTEM_PROPERTY} has been * set, then this method will initialize and return the default metric * collector provided by the AWS SDK on a best-attempt basis. */ public static <T extends RequestMetricCollector> T getRequestMetricCollector() { if (mc == null) { if (isDefaultMetricsEnabled()) enableDefaultMetrics(); } @SuppressWarnings("unchecked") T t = (T) (mc == null ? RequestMetricCollector.NONE : mc.getRequestMetricCollector()); return t; }