You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by pm...@apache.org on 2011/12/28 17:15:26 UTC
svn commit: r1225216 -
/jmeter/trunk/src/jorphan/org/apache/jorphan/util/HeapDumper.java
Author: pmouawad
Date: Wed Dec 28 16:15:26 2011
New Revision: 1225216
URL: http://svn.apache.org/viewvc?rev=1225216&view=rev
Log:
Removed static field as not thread safe
Modified:
jmeter/trunk/src/jorphan/org/apache/jorphan/util/HeapDumper.java
Modified: jmeter/trunk/src/jorphan/org/apache/jorphan/util/HeapDumper.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/jorphan/org/apache/jorphan/util/HeapDumper.java?rev=1225216&r1=1225215&r2=1225216&view=diff
==============================================================================
--- jmeter/trunk/src/jorphan/org/apache/jorphan/util/HeapDumper.java (original)
+++ jmeter/trunk/src/jorphan/org/apache/jorphan/util/HeapDumper.java Wed Dec 28 16:15:26 2011
@@ -52,8 +52,6 @@ public class HeapDumper {
private static final String HOTSPOT_BEAN_NAME =
"com.sun.management:type=HotSpotDiagnostic";
- private static final SimpleDateFormat TIME_STAMP_FORMAT = new SimpleDateFormat("yyyyMMdd_hhmmss_SSS");
-
// These are needed for invoking the method
private final MBeanServer server;
private final ObjectName hotspotDiagnosticBean;
@@ -167,7 +165,8 @@ public class HeapDumper {
* @throws Exception if the MXBean cannot be found, or if there is a problem during invocation
*/
public static String dumpHeap(File basedir, boolean live) throws Exception {
- String stamp = TIME_STAMP_FORMAT.format(new Date());
+ SimpleDateFormat timestampFormat = new SimpleDateFormat("yyyyMMdd_hhmmss_SSS");
+ String stamp = timestampFormat.format(new Date());
File temp = new File(basedir,"dump_"+stamp+".hprof");
final String path = temp.getPath();
dumpHeap(path, live);
Re: svn commit: r1225216 - /jmeter/trunk/src/jorphan/org/apache/jorphan/util/HeapDumper.java
Posted by sebb <se...@gmail.com>.
On 28 December 2011 16:15, <pm...@apache.org> wrote:
> Author: pmouawad
> Date: Wed Dec 28 16:15:26 2011
> New Revision: 1225216
>
> URL: http://svn.apache.org/viewvc?rev=1225216&view=rev
> Log:
> Removed static field as not thread safe
Not strictly necessary as SimpleDateFormat is only unsafe when called
from multiple threads concurrently, and that is not a requirement
here.
But the change does no harm.
> Modified:
> jmeter/trunk/src/jorphan/org/apache/jorphan/util/HeapDumper.java
>
> Modified: jmeter/trunk/src/jorphan/org/apache/jorphan/util/HeapDumper.java
> URL: http://svn.apache.org/viewvc/jmeter/trunk/src/jorphan/org/apache/jorphan/util/HeapDumper.java?rev=1225216&r1=1225215&r2=1225216&view=diff
> ==============================================================================
> --- jmeter/trunk/src/jorphan/org/apache/jorphan/util/HeapDumper.java (original)
> +++ jmeter/trunk/src/jorphan/org/apache/jorphan/util/HeapDumper.java Wed Dec 28 16:15:26 2011
> @@ -52,8 +52,6 @@ public class HeapDumper {
> private static final String HOTSPOT_BEAN_NAME =
> "com.sun.management:type=HotSpotDiagnostic";
>
> - private static final SimpleDateFormat TIME_STAMP_FORMAT = new SimpleDateFormat("yyyyMMdd_hhmmss_SSS");
> -
> // These are needed for invoking the method
> private final MBeanServer server;
> private final ObjectName hotspotDiagnosticBean;
> @@ -167,7 +165,8 @@ public class HeapDumper {
> * @throws Exception if the MXBean cannot be found, or if there is a problem during invocation
> */
> public static String dumpHeap(File basedir, boolean live) throws Exception {
> - String stamp = TIME_STAMP_FORMAT.format(new Date());
> + SimpleDateFormat timestampFormat = new SimpleDateFormat("yyyyMMdd_hhmmss_SSS");
> + String stamp = timestampFormat.format(new Date());
> File temp = new File(basedir,"dump_"+stamp+".hprof");
> final String path = temp.getPath();
> dumpHeap(path, live);
>
>