| 1 16 package org.jmanage.testapp.mbeans; 17 18 23 public class Configuration implements ConfigurationMBean { 24 25 private final String appName = "testApp"; 26 private long whenStarted = System.currentTimeMillis(); 27 private int maxConnectionPoolSize = 10; 28 29 30 public String getAppName() { 31 return appName; 32 } 33 34 public long getAppUptime() { 35 return System.currentTimeMillis() - whenStarted; 36 } 37 38 39 public int getMaxConnectionPoolSize() { 40 return maxConnectionPoolSize; 41 } 42 43 public void setMaxConnectionPoolSize(int size) { 44 this.maxConnectionPoolSize = size; 45 } 46 47 48 public long resetAppUptime() { 49 long prevUptime = getAppUptime(); 50 whenStarted = System.currentTimeMillis(); 51 return prevUptime; 52 } 53 54 public void throwError(){ 55 throw new RuntimeException ("This is a test error."); 56 } 57 } 58 | Popular Tags |