From 5bd4b19fabd0c74e4e8aab0f4580d0ca9e0b4d2a Mon Sep 17 00:00:00 2001 From: Robert Davies Date: Mon, 5 Dec 2011 15:49:36 +0000 Subject: [PATCH] commit patch for https://issues.apache.org/jira/browse/AMQ-3618 git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1210506 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/activemq/openwire/OpenWireFormat.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/activemq-core/src/main/java/org/apache/activemq/openwire/OpenWireFormat.java b/activemq-core/src/main/java/org/apache/activemq/openwire/OpenWireFormat.java index a523416446..609b780072 100755 --- a/activemq-core/src/main/java/org/apache/activemq/openwire/OpenWireFormat.java +++ b/activemq-core/src/main/java/org/apache/activemq/openwire/OpenWireFormat.java @@ -59,8 +59,8 @@ public final class OpenWireFormat implements WireFormat { private short nextMarshallCacheIndex; private short nextMarshallCacheEvictionIndex; private Map marshallCacheMap = new HashMap(); - private DataStructure marshallCache[] = new DataStructure[MARSHAL_CACHE_SIZE]; - private DataStructure unmarshallCache[] = new DataStructure[MARSHAL_CACHE_SIZE]; + private DataStructure marshallCache[] = null; + private DataStructure unmarshallCache[] = null; private DataByteArrayOutputStream bytesOut = new DataByteArrayOutputStream(); private DataByteArrayInputStream bytesIn = new DataByteArrayInputStream(); private WireFormatInfo preferedWireFormatInfo; @@ -572,6 +572,10 @@ public final class OpenWireFormat implements WireFormat { } public void setCacheEnabled(boolean cacheEnabled) { + if(cacheEnabled){ + marshallCache = new DataStructure[MARSHAL_CACHE_SIZE]; + unmarshallCache = new DataStructure[MARSHAL_CACHE_SIZE]; + } this.cacheEnabled = cacheEnabled; }