예제 #1
0
 public static <T extends MetricCollector> T getMetricCollector() {
   if (mc == null) {
     if (isDefaultMetricsEnabled()) enableDefaultMetrics();
   }
   @SuppressWarnings("unchecked")
   T t = (T) (mc == null ? MetricCollector.NONE : mc);
   return t;
 }
예제 #2
0
 @Test
 public void test() {
   // by default, it's disabled
   assertFalse(AwsSdkMetrics.isDefaultMetricsEnabled());
   // won't be anble to enable unless the default impl library is on the classpath
   assertFalse(AwsSdkMetrics.enableDefaultMetrics());
   assertFalse(AwsSdkMetrics.isDefaultMetricsEnabled());
   assertSame(RequestMetricCollector.NONE, AwsSdkMetrics.getRequestMetricCollector());
   assertFalse(AwsSdkMetrics.isDefaultMetricsEnabled());
   // effectively no effect
   AwsSdkMetrics.disableMetrics();
   assertFalse(AwsSdkMetrics.isDefaultMetricsEnabled());
 }
예제 #3
0
 @Override
 public boolean enableDefaultMetrics() {
   return AwsSdkMetrics.enableDefaultMetrics();
 }
예제 #4
0
 /**
  * By default the AWS SDK metric collection is disabled. Enabling it should fail unless the
  * necessary CloudWatch related jars are on the classpath. Therefore, this test is expected to
  * fail in enabling the default metric collection, but have absolutely no impact otherwise.
  */
 @Test
 public void enableDefaultMetrics() {
   Assert.assertFalse(AwsSdkMetrics.enableDefaultMetrics());
 }