Author: alessio.soldano(a)jboss.com
Date: 2008-02-12 03:24:03 -0500 (Tue, 12 Feb 2008)
New Revision: 5657
Modified:
framework/trunk/src/main/java/org/jboss/wsf/framework/management/recording/MemoryBufferRecorder.java
Log:
[JBWS-1971] Adding clone method to the MemoryBufferRecorder
Modified:
framework/trunk/src/main/java/org/jboss/wsf/framework/management/recording/MemoryBufferRecorder.java
===================================================================
---
framework/trunk/src/main/java/org/jboss/wsf/framework/management/recording/MemoryBufferRecorder.java 2008-02-11
16:17:14 UTC (rev 5656)
+++
framework/trunk/src/main/java/org/jboss/wsf/framework/management/recording/MemoryBufferRecorder.java 2008-02-12
08:24:03 UTC (rev 5657)
@@ -266,4 +266,28 @@
}
sb.append("</tr>");
}
+
+ @Override
+ public Object clone() throws CloneNotSupportedException
+ {
+ MemoryBufferRecorder cl = (MemoryBufferRecorder)super.clone();
+ cl.recentRecords = Collections.synchronizedMap(new HashMap<String,
List<Record>>());
+ for (String key : this.recentRecords.keySet())
+ {
+ List<Record> list = new LinkedList<Record>();
+ for (Record record : this.recentRecords.get(key))
+ {
+ list.add(record);
+ }
+ cl.recentRecords.put(key, list);
+ }
+ cl.recentRecordGroups = new ConcurrentLinkedQueue<String>();
+ for (String id : this.recentRecordGroups)
+ {
+ cl.recentRecordGroups.add(id);
+ }
+ cl.maxSize = this.maxSize;
+ cl.size = this.size;
+ return cl;
+ }
}