%line | %branch | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
net.sf.infrared.agent.transport.impl.ForwardingAggregator |
|
|
1 | /* |
|
2 | * Copyright 2005 Tavant Technologies and Contributors |
|
3 | * |
|
4 | * Licensed under the Apache License, Version 2.0 (the "License") |
|
5 | * you may not use this file except in compliance with the License. |
|
6 | * You may obtain a copy of the License at |
|
7 | * |
|
8 | * http://www.apache.org/licenses/LICENSE-2.0 |
|
9 | * |
|
10 | * Unless required by applicable law or agreed to in writing, software |
|
11 | * distributed under the License is distributed on an "AS IS" BASIS, |
|
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
13 | * See the License for the specific language governing permissions and |
|
14 | * limitations under the License. |
|
15 | * |
|
16 | * |
|
17 | * |
|
18 | * Original Author: kamal.govindraj (Tavant Technologies) |
|
19 | * Contributor(s): -; |
|
20 | * |
|
21 | */ |
|
22 | package net.sf.infrared.agent.transport.impl; |
|
23 | ||
24 | import org.apache.log4j.Logger; |
|
25 | ||
26 | import net.sf.infrared.agent.transport.Aggregator; |
|
27 | import net.sf.infrared.agent.transport.Forwarder; |
|
28 | import net.sf.infrared.base.model.OperationStatistics; |
|
29 | import net.sf.infrared.base.util.LoggingFactory; |
|
30 | ||
31 | /** |
|
32 | * An implementation of the aggregator which just passes on the stats object to |
|
33 | * the forwarder without any processing |
|
34 | * |
|
35 | * @author kamal.govindraj |
|
36 | */ |
|
37 | 0 | public class ForwardingAggregator implements Aggregator { |
38 | 0 | private static final Logger log = LoggingFactory.getLogger(ForwardingAggregator.class); |
39 | ||
40 | 0 | private Forwarder forwarder = null; |
41 | ||
42 | public void aggregate(OperationStatistics stats) { |
|
43 | 0 | if (forwarder != null) { |
44 | 0 | forwarder.forward(stats); |
45 | 0 | if (log.isDebugEnabled()) { |
46 | 0 | log.debug("Forwarded statistics for " + stats.getApplicationName() + " on " |
47 | + stats.getInstanceId()); |
|
48 | } |
|
49 | } else { |
|
50 | 0 | log.error("forwarder not set correctly!"); |
51 | } |
|
52 | 0 | } |
53 | ||
54 | public void flush() { |
|
55 | // no op |
|
56 | 0 | } |
57 | ||
58 | public void setForwarder(Forwarder forwarder) { |
|
59 | 0 | this.forwarder = forwarder; |
60 | 0 | } |
61 | ||
62 | public void shutdown() { |
|
63 | 0 | } |
64 | } |
This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |