diff options
| author | Keith Wall <kwall@apache.org> | 2014-05-16 11:08:51 +0000 |
|---|---|---|
| committer | Keith Wall <kwall@apache.org> | 2014-05-16 11:08:51 +0000 |
| commit | 8b9d54dcb70bb397dae8742cf1a005945102dede (patch) | |
| tree | 8bfe66fd8ff71d11b8fe3e14ee3d3e53fe2403f2 /qpid/java/broker-plugins/amqp-1-0-protocol/src | |
| parent | 4770c709c9a1a28ac2d623a7a476af15f31ecc78 (diff) | |
| download | qpid-python-8b9d54dcb70bb397dae8742cf1a005945102dede.tar.gz | |
QPID-5766: Intitialisation of StatisticsCounter objects can lead to NPE.
Patch Supplied by Andrew MacBean <andymacbean@gmail.com>.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1595155 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/broker-plugins/amqp-1-0-protocol/src')
| -rw-r--r-- | qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Connection_1_0.java | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Connection_1_0.java b/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Connection_1_0.java index 5b8d3a488e..6d780461f4 100644 --- a/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Connection_1_0.java +++ b/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Connection_1_0.java @@ -76,10 +76,7 @@ public class Connection_1_0 implements ConnectionEventListener, AMQConnectionMod private final CopyOnWriteArrayList<SessionModelListener> _sessionListeners = new CopyOnWriteArrayList<SessionModelListener>(); - private StatisticsCounter _messageDeliveryStatistics = new StatisticsCounter(); - private StatisticsCounter _messageReceiptStatistics = new StatisticsCounter(); - private StatisticsCounter _dataDeliveryStatistics = new StatisticsCounter(); - private StatisticsCounter _dataReceiptStatistics = new StatisticsCounter(); + private final StatisticsCounter _messageDeliveryStatistics, _messageReceiptStatistics, _dataDeliveryStatistics, _dataReceiptStatistics; private final LogSubject _logSubject = new LogSubject() { @@ -118,7 +115,10 @@ public class Connection_1_0 implements ConnectionEventListener, AMQConnectionMod _connectionId = connectionId; _subject.getPrincipals().add(new ConnectionPrincipal(this)); _subjectCreator = subjectCreator; - + _messageDeliveryStatistics = new StatisticsCounter("messages-delivered-" + getConnectionId()); + _dataDeliveryStatistics = new StatisticsCounter("data-delivered-" + getConnectionId()); + _messageReceiptStatistics = new StatisticsCounter("messages-received-" + getConnectionId()); + _dataReceiptStatistics = new StatisticsCounter("data-received-" + getConnectionId()); } public Object getReference() @@ -368,15 +368,6 @@ public class Connection_1_0 implements ConnectionEventListener, AMQConnectionMod } @Override - public void initialiseStatistics() - { - _messageDeliveryStatistics = new StatisticsCounter("messages-delivered-" + getConnectionId()); - _dataDeliveryStatistics = new StatisticsCounter("data-delivered-" + getConnectionId()); - _messageReceiptStatistics = new StatisticsCounter("messages-received-" + getConnectionId()); - _dataReceiptStatistics = new StatisticsCounter("data-received-" + getConnectionId()); - } - - @Override public void registerMessageReceived(long messageSize, long timestamp) { _messageReceiptStatistics.registerEvent(1L, timestamp); |
