本文整理汇总了Java中org.apache.hadoop.metrics.spi.AbstractMetricsContext类的典型用法代码示例。如果您正苦于以下问题:Java AbstractMetricsContext类的具体用法?Java AbstractMetricsContext怎么用?Java AbstractMetricsContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AbstractMetricsContext类属于org.apache.hadoop.metrics.spi包,在下文中一共展示了AbstractMetricsContext类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testCloseShouldCloseTheSocketWhichIsCreatedByInit
import org.apache.hadoop.metrics.spi.AbstractMetricsContext; //导入依赖的package包/类
@Test
public void testCloseShouldCloseTheSocketWhichIsCreatedByInit() throws Exception {
AbstractMetricsContext context=new GangliaContext();
context.init("gangliaContext", ContextFactory.getFactory());
GangliaContext gangliaContext =(GangliaContext) context;
assertFalse("Socket already closed",gangliaContext.datagramSocket.isClosed());
context.close();
assertTrue("Socket not closed",gangliaContext.datagramSocket.isClosed());
}
示例2: printLoadedJars
import org.apache.hadoop.metrics.spi.AbstractMetricsContext; //导入依赖的package包/类
/**
* Only works in DEBUG level.
* Prints the loaded .jar files at the start of Cygnus run.
*/
public static void printLoadedJars() {
// trace the file containing the httpclient library
URL myClassURL = PoolingClientConnectionManager.class.getProtectionDomain().getCodeSource().getLocation();
LOGGER.debug("Loading httpclient from " + myClassURL.toExternalForm());
// trace the file containing the httpcore library
myClassURL = DefaultBHttpServerConnection.class.getProtectionDomain().getCodeSource().getLocation();
LOGGER.debug("Loading httpcore from " + myClassURL.toExternalForm());
// trace the file containing the junit library
myClassURL = ErrorCollector.class.getProtectionDomain().getCodeSource().getLocation();
LOGGER.debug("Loading junit from " + myClassURL.toExternalForm());
// trace the file containing the flume-ng-node library
myClassURL =
RegexExtractorInterceptorMillisSerializer.class.getProtectionDomain().getCodeSource().getLocation();
LOGGER.debug("Loading flume-ng-node from " + myClassURL.toExternalForm());
// trace the file containing the libthrift library
myClassURL = ListMetaData.class.getProtectionDomain().getCodeSource().getLocation();
LOGGER.debug("Loading libthrift from " + myClassURL.toExternalForm());
// trace the file containing the gson library
myClassURL = JsonPrimitive.class.getProtectionDomain().getCodeSource().getLocation();
LOGGER.debug("Loading gson from " + myClassURL.toExternalForm());
// trace the file containing the json-simple library
myClassURL = Yytoken.class.getProtectionDomain().getCodeSource().getLocation();
LOGGER.debug("Loading json-simple from " + myClassURL.toExternalForm());
// trace the file containing the mysql-connector-java library
myClassURL = Driver.class.getProtectionDomain().getCodeSource().getLocation();
LOGGER.debug("Loading mysql-connector-java from " + myClassURL.toExternalForm());
// trace the file containing the postgresql library
myClassURL = BlobOutputStream.class.getProtectionDomain().getCodeSource().getLocation();
LOGGER.debug("Loading postgresql from " + myClassURL.toExternalForm());
// trace the file containing the log4j library
myClassURL = SequenceNumberPatternConverter.class.getProtectionDomain().getCodeSource().getLocation();
LOGGER.debug("Loading log4j from " + myClassURL.toExternalForm());
// trace the file containing the hadoop-core library
myClassURL = AbstractMetricsContext.class.getProtectionDomain().getCodeSource().getLocation();
LOGGER.debug("Loading hadoop-core from " + myClassURL.toExternalForm());
// trace the file containing the hive-exec library
myClassURL = AbstractMapJoinOperator.class.getProtectionDomain().getCodeSource().getLocation();
LOGGER.debug("Loading hive-exec from " + myClassURL.toExternalForm());
// trace the file containing the hive-jdbc library
myClassURL = HivePreparedStatement.class.getProtectionDomain().getCodeSource().getLocation();
LOGGER.debug("Loading hive-jdbc from " + myClassURL.toExternalForm());
// trace the file containing the mongodb-driver library
myClassURL = AsyncReadWriteBinding.class.getProtectionDomain().getCodeSource().getLocation();
LOGGER.debug("Loading mongodb-driver from " + myClassURL.toExternalForm());
// trace the file containing the kafka-clients library
myClassURL = OffsetOutOfRangeException.class.getProtectionDomain().getCodeSource().getLocation();
LOGGER.debug("Loading kafka-clientsc from " + myClassURL.toExternalForm());
// trace the file containing the zkclient library
myClassURL = ZkNoNodeException.class.getProtectionDomain().getCodeSource().getLocation();
LOGGER.debug("Loading zkclient from " + myClassURL.toExternalForm());
// trace the file containing the kafka_2.11 library
myClassURL = KafkaMigrationTool.class.getProtectionDomain().getCodeSource().getLocation();
LOGGER.debug("Loading kafka_2.11 from " + myClassURL.toExternalForm());
// trace the file containing the aws-java-sdk-dynamodb library
myClassURL = WriteRequest.class.getProtectionDomain().getCodeSource().getLocation();
LOGGER.debug("Loading aws-java-sdk-dynamodb from " + myClassURL.toExternalForm());
}