streams-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (STREAMS-197) Implement New Counting Classes
Date Tue, 21 Oct 2014 19:11:34 GMT

    [ https://issues.apache.org/jira/browse/STREAMS-197?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14178868#comment-14178868
] 

ASF GitHub Bot commented on STREAMS-197:
----------------------------------------

Github user robdouglas commented on a diff in the pull request:

    https://github.com/apache/incubator-streams/pull/107#discussion_r19171663
  
    --- Diff: streams-runtimes/streams-runtime-local/src/main/java/org/apache/streams/local/counters/StreamsTaskCounter.java
---
    @@ -0,0 +1,163 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + *
    + *   http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing,
    + * software distributed under the License is distributed on an
    + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    + * KIND, either express or implied.  See the License for the
    + * specific language governing permissions and limitations
    + * under the License.
    + */
    +package org.apache.streams.local.counters;
    +
    +import net.jcip.annotations.GuardedBy;
    +import net.jcip.annotations.ThreadSafe;
    +import org.slf4j.Logger;
    +import org.slf4j.LoggerFactory;
    +
    +import javax.management.*;
    +import java.lang.management.ManagementFactory;
    +import java.util.concurrent.atomic.AtomicLong;
    +
    +/**
    + *
    + */
    +@ThreadSafe
    +public class StreamsTaskCounter implements StreamsTaskCounterMXBean{
    +
    +    public static final String NAME_TEMPLATE = "org.apache.streams.local:type=StreamsTaskCounter,name=%s";
    +    private static final Logger LOGGER = LoggerFactory.getLogger(StreamsTaskCounter.class);
    +
    +    private AtomicLong emitted;
    +    private AtomicLong received;
    +    private AtomicLong errors;
    +    private AtomicLong totalTime;
    +    @GuardedBy("this")
    +    private volatile long maxTime;
    +
    +    /**
    +     *
    +     * @param id
    +     */
    +    public StreamsTaskCounter(String id) {
    +        this.emitted = new AtomicLong(0);
    +        this.received = new AtomicLong(0);
    +        this.errors = new AtomicLong(0);
    +        this.totalTime = new AtomicLong(0);
    +        this.maxTime = -1;
    +        try {
    --- End diff --
    
    looks like this block gets reused, any chance it could be abstracted out to a common interface?


> Implement New Counting Classes
> ------------------------------
>
>                 Key: STREAMS-197
>                 URL: https://issues.apache.org/jira/browse/STREAMS-197
>             Project: Streams
>          Issue Type: Sub-task
>            Reporter: Ryan Ebanks
>
> Need to implement threadsafe classes that will count datums at the task level and process
(prov/proc/writer) level.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message