git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1210506 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Davies 2011-12-05 15:49:36 +00:00
parent b7e31aca70
commit 5bd4b19fab
1 changed files with 6 additions and 2 deletions

View File

@ -59,8 +59,8 @@ public final class OpenWireFormat implements WireFormat {
private short nextMarshallCacheIndex; private short nextMarshallCacheIndex;
private short nextMarshallCacheEvictionIndex; private short nextMarshallCacheEvictionIndex;
private Map<DataStructure, Short> marshallCacheMap = new HashMap<DataStructure, Short>(); private Map<DataStructure, Short> marshallCacheMap = new HashMap<DataStructure, Short>();
private DataStructure marshallCache[] = new DataStructure[MARSHAL_CACHE_SIZE]; private DataStructure marshallCache[] = null;
private DataStructure unmarshallCache[] = new DataStructure[MARSHAL_CACHE_SIZE]; private DataStructure unmarshallCache[] = null;
private DataByteArrayOutputStream bytesOut = new DataByteArrayOutputStream(); private DataByteArrayOutputStream bytesOut = new DataByteArrayOutputStream();
private DataByteArrayInputStream bytesIn = new DataByteArrayInputStream(); private DataByteArrayInputStream bytesIn = new DataByteArrayInputStream();
private WireFormatInfo preferedWireFormatInfo; private WireFormatInfo preferedWireFormatInfo;
@ -572,6 +572,10 @@ public final class OpenWireFormat implements WireFormat {
} }
public void setCacheEnabled(boolean cacheEnabled) { public void setCacheEnabled(boolean cacheEnabled) {
if(cacheEnabled){
marshallCache = new DataStructure[MARSHAL_CACHE_SIZE];
unmarshallCache = new DataStructure[MARSHAL_CACHE_SIZE];
}
this.cacheEnabled = cacheEnabled; this.cacheEnabled = cacheEnabled;
} }