001    /*
002     * Licensed to the Apache Software Foundation (ASF) under one or more
003     * contributor license agreements.  See the NOTICE file distributed with
004     * this work for additional information regarding copyright ownership.
005     * The ASF licenses this file to You under the Apache License, Version 2.0
006     * (the "License"); you may not use this file except in compliance with
007     * the License.  You may obtain a copy of the License at
008     *
009     *     http://www.apache.org/licenses/LICENSE-2.0
010     *
011     * Unless required by applicable law or agreed to in writing, software
012     * distributed under the License is distributed on an "AS IS" BASIS,
013     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014     * See the License for the specific language governing permissions and
015     * limitations under the License.
016     */
017    package org.apache.commons.pipeline.stage;
018    
019    /**
020     * Interface to JMX enable the ExtendedBaseStage.
021     * 
022     * @author mzsanford
023     */
024    public interface ExtendedBaseStageMBean {
025            /**
026             * @return build the status message. This may have an effect on stage throughput.
027             */
028            public abstract String getStatusMessage();
029    
030            /**
031             * @return number of records after which status messages are logged.
032             */
033            public abstract Long getStatusInterval();
034    
035            /**
036             * @param statusInterval new status interval
037             */
038            public abstract void setStatusInterval(Long statusInterval);
039    
040            /**
041             * @return Size of batches processes by this stage (used to adjust throughput statistics)
042             */
043            public Integer getStatusBatchSize();
044    
045            /**
046             * @param statusBatchSize Size of batches processes by this stage (used to adjust throughput statistics)
047             */
048            public void setStatusBatchSize(Integer statusBatchSize);
049            
050            /**
051             * @return number of objects received
052             */
053            public abstract long getObjectsReceived();
054    
055            /**
056             * @return total number of milliseconds spent processing
057             */
058            public abstract long getTotalServiceTime();
059    
060            /**
061             * @return total number of milliseconds spent blocked on downstream queues
062             */
063            public abstract long getTotalEmitTime();
064    
065            /**
066             * @return total number of emits to downstream queues
067             */
068            public abstract long getTotalEmits();
069    
070            /**
071             * @return true is this stage is collecting branch stats, false otherwise.
072             */
073            public abstract Boolean getCollectBranchStats();
074    
075            /**
076             * Branch stats are disabled by default because they are slow. Turning this on
077             * can have a noticeable effect on stage throughput.
078             * 
079             * @param collectBranchStats true if this stage should start collecting branch stats,
080             *  false otherwise.
081             */
082            public abstract void setCollectBranchStats(Boolean collectBranchStats);
083            
084            /**
085             * Get the current average service time. This works by looking only at the last
086             * X objects processed, where X is defined and reported by the getCurrentStatWindowSize
087             *  and  setCurrentStatWindowSize methods.
088             *
089             * @return average time to process in milliseconds
090             */
091            public double getCurrentServiceTimeAverage();
092            
093            /**
094             * Get the size of the service time collection window
095             */
096            public Integer getCurrentStatWindowSize();
097            
098            /**
099             * Set the size of the service time collection window
100             */
101            public void setCurrentStatWindowSize(Integer newStatWindowSize);
102    
103    }