Package com.codahale.metrics.Timer

Examples of com.codahale.metrics.Timer.Context


    @Override
    public void handleGet(ServletServiceRequest request, ServletServiceResponse response,
            OperationDiagnostics stats) throws IOException
    {
        final OperationMetrics metrics = _listMetrics;
        Context timer = (metrics == null) ? null : metrics.start();
        String str = request.getQueryParameter(ClusterMateConstants.QUERY_PARAM_SINCE);
        try {
            if (str == null) {
                response = _syncHandler.missingArgument(response, ClusterMateConstants.QUERY_PARAM_SINCE);
            } else {
View Full Code Here


    @Override
    public void handlePost(ServletServiceRequest request, ServletServiceResponse response,
            OperationDiagnostics metadata) throws IOException
    {
        final OperationMetrics metrics = _pullMetrics;
        Context timer = (metrics == null) ? null : metrics.start();
        try {
            response = _pullEntries(request, response, metadata);
            _addStdHeaders(response);
            response.writeOut(_jsonWriter);
        } finally {
View Full Code Here

    LOG.info("{} Uploading {} item(s)", logIdentifier, toUpload.size());

    int success = 0;

    for (int i = 0; i < toUpload.size(); i++) {
      final Context context = metrics.getUploadTimer().time();
      final Path file = toUpload.get(i);
      try {
        uploadSingle(i, file);
        metrics.upload();
        success++;
        Files.delete(file);
      } catch (Exception e) {
        metrics.error();
        LOG.warn("{} Couldn't upload or delete {}", logIdentifier, file, e);
      } finally {
        context.stop();
      }
    }

    LOG.info("{} Uploaded {} out of {} item(s) in {}", logIdentifier, success, toUpload.size(), JavaUtils.duration(start));
  }
View Full Code Here

    super(metricRegistry, targetClass, ANNOTATION, METHOD_FILTER);
  }

  @Override
  protected Object invoke(MethodInvocation invocation, Timer timer, Timed annotation) throws Throwable {
    final Context timerCtx = timer.time();
    try {
      return invocation.proceed();
    }
    finally {
      timerCtx.close();
    }
  }
View Full Code Here

    @Override
    public void handlePost(ServletServiceRequest request, ServletServiceResponse response,
            OperationDiagnostics metadata) throws IOException
    {
        final OperationMetrics metrics = _pullMetrics;
        Context timer = (metrics == null) ? null : metrics.start();
        try {
            _syncHandler.pullEntries(request, response, request.getInputStream(), metadata);
            _addStdHeaders(response);
            response.writeOut(_jsonWriter);
        } finally {
View Full Code Here

    @Override
    public void handlePost(ServletServiceRequest request, ServletServiceResponse response,
            OperationDiagnostics metadata) throws IOException
    {
        final OperationMetrics metrics = _pullMetrics;
        Context timer = (metrics == null) ? null : metrics.start();
        try {
            _syncHandler.pullEntries(request, response, request.getInputStream(), metadata);
            _addStdHeaders(response);
            response.writeOut(_jsonWriter);
        } finally {
View Full Code Here

    @Override
    public void handleGet(ServletServiceRequest request, ServletServiceResponse response,
            OperationDiagnostics stats) throws IOException
    {
        final OperationMetrics metrics = _getMetrics;
        Context timer = (metrics == null) ? null : metrics.start();
        try {
            K key = _findKey(request, response);
            if (key != null) { // null means trouble; response has all we need
                response = _handleGet(request, response, stats, key);
            }
View Full Code Here

    @Override
    public void handlePut(ServletServiceRequest request, ServletServiceResponse response,
            OperationDiagnostics stats) throws IOException
    {
        final OperationMetrics metrics = _putMetrics;
        Context timer = (metrics == null) ? null : metrics.start();

        try {
            K key = _findKey(request, response);
            if (key != null) {
                response = _handlePut(request, response, stats, key);
View Full Code Here

    @Override
    public void handleDelete(ServletServiceRequest request, ServletServiceResponse response,
            OperationDiagnostics stats) throws IOException
    {
        final OperationMetrics metrics = _deleteMetrics;
        Context timer = (metrics == null) ? null : metrics.start();

        try {
            K key = _findKey(request, response);
            if (key != null) {
                response = _handleDelete(request, response, stats, key);
View Full Code Here

    @Override
    public void handleGet(ServletServiceRequest request, ServletServiceResponse response,
            OperationDiagnostics stats) throws IOException
    {
        final OperationMetrics metrics = _listMetrics;
        Context timer = (metrics == null) ? null : metrics.start();
        String str = request.getQueryParameter(ClusterMateConstants.QUERY_PARAM_SINCE);
        try {
            if (str == null) {
                response = _syncHandler.missingArgument(response, ClusterMateConstants.QUERY_PARAM_SINCE);
            } else {
View Full Code Here

TOP

Related Classes of com.codahale.metrics.Timer.Context

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.