Your browser does not support JavaScript and this site utilizes JavaScript to build content and provide links to additional information. You should either enable JavaScript in your browser settings or use a browser that supports JavaScript in order to take full advantage of this site.
1 4 package com.tc; 5 6 public class ProcessStatus { 7 private String m_processName; 8 private int m_status; 9 private boolean m_restarting; 10 11 public static final int READY = 1; 12 public static final int WAITING = 2; 13 public static final int FAILED = 3; 14 public static final int INACTIVE = 4; 15 16 public ProcessStatus(String processName) { 17 m_processName = processName; 18 setStatus(INACTIVE); 19 } 20 21 public String getProcessName() { 22 return m_processName; 23 } 24 25 public int getStatus() { 26 return m_status; 27 } 28 29 public void setStatus(int status) { 30 m_status = status; 31 } 32 33 public boolean isRestarting() { 34 return m_restarting; 35 } 36 37 public void setRestarting(boolean restarting) { 38 m_restarting = restarting; 39 } 40 41 public void setReady() { 42 setStatus(READY); 43 setRestarting(false); 44 } 45 46 public boolean isReady() { 47 return getStatus() == READY; 48 } 49 50 public void setWaiting() { 51 setStatus(WAITING); 52 } 53 54 public boolean isWaiting() { 55 return getStatus() == WAITING; 56 } 57 58 public void setFailed() { 59 setStatus(FAILED); 60 setRestarting(false); 61 } 62 63 public boolean isFailed() { 64 return getStatus() == FAILED; 65 } 66 67 public void setInactive() { 68 setStatus(INACTIVE); 69 } 70 71 public boolean isInactive() { 72 return getStatus() == INACTIVE; 73 } 74 75 public String getStatusString() { 76 String s; 77 78 switch(getStatus()) { 79 case READY: {s = "ready"; break;} 80 case WAITING: {s = "waiting"; break;} 81 case FAILED: {s = "failed"; break;} 82 case INACTIVE: {s = "inactive"; break;} 83 default: {s = "invalid status"; break;} 84 } 85 86 if(isRestarting()) { 87 s += ", restarting"; 88 } 89 90 return s; 91 } 92 93 public String toString() { 94 return getProcessName() + " is " + getStatusString(); 95 } 96 } 97
| Popular Tags
|