1 2 18 19 22 package org.quartz; 23 24 import java.util.Date ; 25 26 34 public class SchedulerMetaData implements java.io.Serializable { 35 36 43 44 private String schedName; 45 46 private String schedInst; 47 48 private Class schedClass; 49 50 private boolean isRemote; 51 52 private boolean started; 53 54 private boolean isInStandbyMode; 55 56 private boolean shutdown; 57 58 private Date startTime; 59 60 private int numJobsExec; 61 62 private Class jsClass; 63 64 private boolean jsPersistent; 65 66 private Class tpClass; 67 68 private int tpSize; 69 70 private String version; 71 72 79 80 public SchedulerMetaData(String schedName, String schedInst, 81 Class schedClass, boolean isRemote, boolean started, 82 boolean isInStandbyMode, boolean shutdown, Date startTime, int numJobsExec, 83 Class jsClass, boolean jsPersistent, Class tpClass, int tpSize, 84 String version) { 85 this.schedName = schedName; 86 this.schedInst = schedInst; 87 this.schedClass = schedClass; 88 this.isRemote = isRemote; 89 this.started = started; 90 this.isInStandbyMode = isInStandbyMode; 91 this.shutdown = shutdown; 92 this.startTime = startTime; 93 this.numJobsExec = numJobsExec; 94 this.jsClass = jsClass; 95 this.jsPersistent = jsPersistent; 96 this.tpClass = tpClass; 97 this.tpSize = tpSize; 98 this.version = version; 99 } 100 101 108 109 114 public String getSchedulerName() { 115 return schedName; 116 } 117 118 123 public String getSchedulerInstanceId() { 124 return schedInst; 125 } 126 127 132 public Class getSchedulerClass() { 133 return schedClass; 134 } 135 136 143 public Date runningSince() { 144 return startTime; 145 } 146 147 153 public int numJobsExecuted() { 154 return numJobsExec; 155 } 156 157 163 public boolean isSchedulerRemote() { 164 return isRemote; 165 } 166 167 177 public boolean isStarted() { 178 return started; 179 } 180 181 184 public boolean isInStandbyMode() { 185 return isInStandbyMode; 186 } 187 188 195 public boolean isPaused() { 196 return isInStandbyMode(); 197 } 198 199 204 public boolean isShutdown() { 205 return shutdown; 206 } 207 208 214 public Class getJobStoreClass() { 215 return jsClass; 216 } 217 218 224 public boolean jobStoreSupportsPersistence() { 225 return jsPersistent; 226 } 227 228 234 public Class getThreadPoolClass() { 235 return tpClass; 236 } 237 238 244 public int getThreadPoolSize() { 245 return tpSize; 246 } 247 248 253 public String getVersion() { 254 return version; 255 } 256 257 262 public String toString() { 263 try { 264 return getSummary(); 265 } catch (SchedulerException se) { 266 return "SchedulerMetaData: undeterminable."; 267 } 268 } 269 270 287 public String getSummary() throws SchedulerException { 288 StringBuffer str = new StringBuffer ("Quartz Scheduler (v"); 289 str.append(getVersion()); 290 str.append(") '"); 291 292 str.append(getSchedulerName()); 293 str.append("' with instanceId '"); 294 str.append(getSchedulerInstanceId()); 295 str.append("'\n"); 296 297 str.append(" Scheduler class: '"); 298 str.append(getSchedulerClass().getName()); 299 str.append("'"); 300 if (isSchedulerRemote()) { 301 str.append(" - access via RMI."); 302 } else { 303 str.append(" - running locally."); 304 } 305 str.append("\n"); 306 307 if (!isShutdown()) { 308 if (runningSince() != null) { 309 str.append(" Running since: "); 310 str.append(runningSince()); 311 } else { 312 str.append("NOT STARTED."); 313 } 314 str.append("\n"); 315 316 if (isInStandbyMode()) { 317 str.append(" Currently in standby mode."); 318 } else { 319 str.append(" Not currently in standby mode."); 320 } 321 } else { 322 str.append(" Scheduler has been SHUTDOWN."); 323 } 324 str.append("\n"); 325 326 str.append(" Number of jobs executed: "); 327 str.append(numJobsExecuted()); 328 str.append("\n"); 329 330 str.append(" Using thread pool '"); 331 str.append(getThreadPoolClass().getName()); 332 str.append("' - with "); 333 str.append(getThreadPoolSize()); 334 str.append(" threads."); 335 str.append("\n"); 336 337 str.append(" Using job-store '"); 338 str.append(getJobStoreClass().getName()); 339 str.append("' - which "); 340 if (jobStoreSupportsPersistence()) { 341 str.append("supports persistence."); 342 } else { 343 str.append("does not support persistence."); 344 } 345 str.append("\n"); 346 347 return str.toString(); 348 } 349 350 } 351 | Popular Tags |