1 /* 2 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 package utils; 24 25 import java.util.HashMap; 26 27 /** 28 * 29 * Represents stack of all threads + some extra information 30 * 31 */ 32 public class JStack { 33 34 private String date; 35 private String vmVersion; 36 private HashMap<String, ThreadStack> threads = new HashMap<String, ThreadStack>(); 37 private String jniGlobalReferences; 38 getDate()39 public String getDate() { 40 return date; 41 } 42 setDate(String date)43 public void setDate(String date) { 44 this.date = date; 45 } 46 getVmVersion()47 public String getVmVersion() { 48 return vmVersion; 49 } 50 setVmVersion(String vmVersion)51 public void setVmVersion(String vmVersion) { 52 this.vmVersion = vmVersion; 53 } 54 getThreads()55 public HashMap<String, ThreadStack> getThreads() { 56 return threads; 57 } 58 setThreads(HashMap<String, ThreadStack> threads)59 public void setThreads(HashMap<String, ThreadStack> threads) { 60 this.threads = threads; 61 } 62 addThreadStack(String threadName, ThreadStack ts)63 public void addThreadStack(String threadName, ThreadStack ts) { 64 System.out.println("Adding thread stack for thread: " + threadName); 65 threads.put(threadName, ts); 66 } 67 getJniGlobalReferences()68 public String getJniGlobalReferences() { 69 return jniGlobalReferences; 70 } 71 setJniGlobalReferences(String jniGlobalReferences)72 public void setJniGlobalReferences(String jniGlobalReferences) { 73 this.jniGlobalReferences = jniGlobalReferences; 74 } 75 getThreadStack(String threadName)76 public ThreadStack getThreadStack(String threadName) { 77 return threads.get(threadName); 78 } 79 80 } 81