|
Line 0
Link Here
|
|
|
1 |
/******************************************************************************* |
| 2 |
* Copyright (c) 2009 SAP AG. |
| 3 |
* All rights reserved. This program and the accompanying materials |
| 4 |
* are made available under the terms of the Eclipse Public License v1.0 |
| 5 |
* which accompanies this distribution, and is available at |
| 6 |
* http://www.eclipse.org/legal/epl-v10.html |
| 7 |
* |
| 8 |
* Contributors: |
| 9 |
* SAP AG - initial API and implementation |
| 10 |
*******************************************************************************/ |
| 11 |
package org.eclipse.mat.snapshot.acquire; |
| 12 |
|
| 13 |
/** |
| 14 |
* Instances of this class are descriptors of locally running Java processes |
| 15 |
* |
| 16 |
* @author ktsvetkov |
| 17 |
* |
| 18 |
*/ |
| 19 |
public final class VmInfo |
| 20 |
{ |
| 21 |
private int pid; |
| 22 |
private String description; |
| 23 |
private boolean heapDumpEnabled; |
| 24 |
private String proposedFileName; |
| 25 |
|
| 26 |
private IHeapDumpProvider heapDumpProvider; |
| 27 |
|
| 28 |
/** |
| 29 |
* An empty constructor |
| 30 |
*/ |
| 31 |
public VmInfo() |
| 32 |
{} |
| 33 |
|
| 34 |
/** |
| 35 |
* Constructor with parameters |
| 36 |
* |
| 37 |
* @param pid |
| 38 |
* the process ID of the process |
| 39 |
* @param description |
| 40 |
* a free text description of the process, usually the process |
| 41 |
* name |
| 42 |
* @param heapDumpEnabled |
| 43 |
* a boolean value indicating if a heap dump from the process can |
| 44 |
* be acquired |
| 45 |
* @param proposedFileName |
| 46 |
* a proposal for the file name, under which the heap dump can be |
| 47 |
* saved. %pid% can be used as a placeholder for the PID. |
| 48 |
* Example: java_pid%pid%.hprof |
| 49 |
* @param heapDumpProvider |
| 50 |
* the {@link IHeapDumpProvider} which can use this VmInfo |
| 51 |
*/ |
| 52 |
public VmInfo(int pid, String description, boolean heapDumpEnabled, String proposedFileName, IHeapDumpProvider heapDumpProvider) |
| 53 |
{ |
| 54 |
super(); |
| 55 |
this.pid = pid; |
| 56 |
this.description = description; |
| 57 |
this.heapDumpEnabled = heapDumpEnabled; |
| 58 |
this.proposedFileName = proposedFileName; |
| 59 |
this.heapDumpProvider = heapDumpProvider; |
| 60 |
} |
| 61 |
|
| 62 |
public int getPid() |
| 63 |
{ |
| 64 |
return pid; |
| 65 |
} |
| 66 |
|
| 67 |
public void setPid(int pid) |
| 68 |
{ |
| 69 |
this.pid = pid; |
| 70 |
} |
| 71 |
|
| 72 |
public String getDescription() |
| 73 |
{ |
| 74 |
return description; |
| 75 |
} |
| 76 |
|
| 77 |
public void setDescription(String description) |
| 78 |
{ |
| 79 |
this.description = description; |
| 80 |
} |
| 81 |
|
| 82 |
public boolean isHeapDumpEnabled() |
| 83 |
{ |
| 84 |
return heapDumpEnabled; |
| 85 |
} |
| 86 |
|
| 87 |
public void setHeapDumpEnabled(boolean heapDumpEnabled) |
| 88 |
{ |
| 89 |
this.heapDumpEnabled = heapDumpEnabled; |
| 90 |
} |
| 91 |
|
| 92 |
public IHeapDumpProvider getHeapDumpProvider() |
| 93 |
{ |
| 94 |
return heapDumpProvider; |
| 95 |
} |
| 96 |
|
| 97 |
public void setHeapDumpProvider(IHeapDumpProvider heapDumpProvider) |
| 98 |
{ |
| 99 |
this.heapDumpProvider = heapDumpProvider; |
| 100 |
} |
| 101 |
|
| 102 |
public String getProposedFileName() |
| 103 |
{ |
| 104 |
return proposedFileName; |
| 105 |
} |
| 106 |
|
| 107 |
public void setProposedFileName(String proposedFileName) |
| 108 |
{ |
| 109 |
this.proposedFileName = proposedFileName; |
| 110 |
} |
| 111 |
|
| 112 |
@Override |
| 113 |
public String toString() |
| 114 |
{ |
| 115 |
return "PID = " + pid + "\t" + description; |
| 116 |
} |
| 117 |
|
| 118 |
} |