当前位置: 首页>>代码示例>>Java>>正文


Java Context.close方法代码示例

本文整理汇总了Java中com.codahale.metrics.Timer.Context.close方法的典型用法代码示例。如果您正苦于以下问题:Java Context.close方法的具体用法?Java Context.close怎么用?Java Context.close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.codahale.metrics.Timer.Context的用法示例。


在下文中一共展示了Context.close方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handleRequest

import com.codahale.metrics.Timer.Context; //导入方法依赖的package包/类
@Override
public void handleRequest(HttpServerExchange exchange) throws Exception {
    Context context = timer.time();
    try {
        handler.handleRequest(exchange);
    } finally {
        context.close();
    }
}
 
开发者ID:StubbornJava,项目名称:StubbornJava,代码行数:10,代码来源:TimingHttpHandler.java

示例2: testLookup

import com.codahale.metrics.Timer.Context; //导入方法依赖的package包/类
public Deferred<EnumMap<UniqueIdType, Map<String, String>>> testLookup(final TSDBMetricMeta meta) {
	final Context ctx = resolveUidsTimer.time();
	final EnumMap<UniqueIdType, Map<String, String>> map = new EnumMap<UniqueIdType, Map<String, String>>(UniqueIdType.class);
	final TSDBMetricMeta m = metricMetas.get(meta.getTsuid());
	map.put(UniqueIdType.METRIC, Collections.singletonMap(m.getMetricName(), m.getMetricUid()));
	map.put(UniqueIdType.TAGK, m.getTagKeyUids());
	map.put(UniqueIdType.TAGV, m.getTagValueUids());
	ctx.close();
	return Deferred.fromResult(map);
}
 
开发者ID:nickman,项目名称:HeliosStreams,代码行数:11,代码来源:TSDBChronicleEventPublisher.java

示例3: doGet

import com.codahale.metrics.Timer.Context; //导入方法依赖的package包/类
@Override
protected final void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
	log(req);

	Context context = getTimer(req).time();
	try {
		get(req, resp);
	} finally {
		context.close();
	}
}
 
开发者ID:dstl,项目名称:baleen,代码行数:12,代码来源:AbstractApiServlet.java

示例4: doPost

import com.codahale.metrics.Timer.Context; //导入方法依赖的package包/类
@Override
protected final void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
	log(req);

	Context context = getTimer(req).time();
	try {
		post(req, resp);
	} finally {
		context.close();
	}
}
 
开发者ID:dstl,项目名称:baleen,代码行数:12,代码来源:AbstractApiServlet.java

示例5: doPut

import com.codahale.metrics.Timer.Context; //导入方法依赖的package包/类
@Override
protected final void doPut(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
	log(req);

	Context context = getTimer(req).time();
	try {
		put(req, resp);
	} finally {
		context.close();
	}
}
 
开发者ID:dstl,项目名称:baleen,代码行数:12,代码来源:AbstractApiServlet.java

示例6: doDelete

import com.codahale.metrics.Timer.Context; //导入方法依赖的package包/类
@Override
protected void doDelete(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
	log(req);

	Context context = getTimer(req).time();
	try {
		delete(req, resp);
	} finally {
		context.close();
	}
}
 
开发者ID:dstl,项目名称:baleen,代码行数:12,代码来源:AbstractApiServlet.java

示例7: onClose

import com.codahale.metrics.Timer.Context; //导入方法依赖的package包/类
@Override
protected void onClose(CloseReason closereason) {
    edm.countOpened.ifPresent(Counter::dec);
    Context ctx = (Context) getJsrSession().getUserProperties().get(this.getClass().getName());
    if (ctx != null)
        ctx.close();
    super.onClose(closereason);
}
 
开发者ID:LivePersonInc,项目名称:dropwizard-websockets,代码行数:9,代码来源:InstJsrAnnotatedEventDriver.java

示例8: rebalanceCurrentCluster

import com.codahale.metrics.Timer.Context; //导入方法依赖的package包/类
public synchronized void rebalanceCurrentCluster(List<LiveInstance> liveInstances) {
  Context context = _rebalanceTimer.time();
  LOGGER.info("AutoRebalanceLiveInstanceChangeListener.onLiveInstanceChange() wakes up!");
  try {
    _numLiveInstances.inc(liveInstances.size() - _numLiveInstances.getCount());
    if (!_helixManager.isLeader()) {
      LOGGER.info("Not leader, do nothing!");
      return;
    }
    if (!_helixMirrorMakerManager.isAutoBalancingEnabled()) {
      LOGGER.info("Is leader, but auto-balancing is disabled, do nothing!");
      return;
    }
    if (liveInstances.isEmpty()) {
      LOGGER.info("No live instances, do nothing!");
      return;
    }
    final Map<String, Set<TopicPartition>> instanceToTopicPartitionMap =
        HelixUtils.getInstanceToTopicPartitionsMap(_helixManager);
    Set<TopicPartition> unassignedTopicPartitions =
        HelixUtils.getUnassignedPartitions(_helixManager);
    if (instanceToTopicPartitionMap.isEmpty() && unassignedTopicPartitions.isEmpty()) {
      LOGGER.info("No topic got assigned yet, do nothing!");
      return;
    }
    Set<InstanceTopicPartitionHolder> newAssignment =
        rescaleInstanceToTopicPartitionMap(liveInstances, instanceToTopicPartitionMap,
            unassignedTopicPartitions);
    if (newAssignment == null) {
      LOGGER.info("No Live Instances got changed, do nothing!");
      return;
    }
    LOGGER.info("Trying to fetch IdealStatesMap from current assignment!");
    Map<String, IdealState> idealStatesFromAssignment =
        HelixUtils.getIdealStatesFromAssignment(newAssignment);
    LOGGER.info("Trying to assign new IdealStatesMap!");
    assignIdealStates(_helixManager, idealStatesFromAssignment);

    _helixMirrorMakerManager.updateCurrentServingInstance();
    _rebalanceRate.mark();
  } finally {
    context.close();
  }
}
 
开发者ID:uber,项目名称:uReplicator,代码行数:45,代码来源:AutoRebalanceLiveInstanceChangeListener.java


注:本文中的com.codahale.metrics.Timer.Context.close方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。