1 16 17 package org.springframework.jmx.export.annotation; 18 19 import org.springframework.jmx.IJmxTestBean; 20 21 24 @ManagedResource(objectName = "bean:name=testBean4", description = "My Managed Bean", log = true, 25 logFile = "jmx.log", currencyTimeLimit = 15, persistPolicy = "OnUpdate", persistPeriod = 200, 26 persistLocation = "./foo", persistName = "bar.jmx") 27 public class AnnotationTestBean implements IJmxTestBean { 28 29 private String name; 30 31 private String nickName; 32 33 private int age; 34 35 private boolean isSuperman; 36 37 38 @ManagedAttribute(description = "The Age Attribute", currencyTimeLimit = 15) 39 public int getAge() { 40 return age; 41 } 42 43 public void setAge(int age) { 44 this.age = age; 45 } 46 47 @ManagedOperation(currencyTimeLimit = 30) 48 public long myOperation() { 49 return 1L; 50 } 51 52 @ManagedAttribute(description = "The Name Attribute", 53 currencyTimeLimit = 20, 54 defaultValue = "bar", 55 persistPolicy = "OnUpdate") 56 public void setName(String name) { 57 this.name = name; 58 } 59 60 @ManagedAttribute(defaultValue = "foo", persistPeriod = 300) 61 public String getName() { 62 return name; 63 } 64 65 @org.springframework.jmx.export.annotation.ManagedAttribute(description = "The Nick Name Attribute") 66 public String getNickName() { 67 return this.nickName; 68 } 69 70 public void setNickName(String nickName) { 71 this.nickName = nickName; 72 } 73 74 @org.springframework.jmx.export.annotation.ManagedAttribute(description = "The Is Superman Attribute") 75 public void setSuperman(boolean superman) { 76 this.isSuperman = superman; 77 } 78 79 public boolean isSuperman() { 80 return isSuperman; 81 } 82 83 @org.springframework.jmx.export.annotation.ManagedOperation(description = "Add Two Numbers Together") 84 @ManagedOperationParameters({@ManagedOperationParameter(name="x", description="Left operand"), 85 @ManagedOperationParameter(name="y", description="Right operand")}) 86 public int add(int x, int y) { 87 return x + y; 88 } 89 90 93 public void dontExposeMe() { 94 throw new RuntimeException (); 95 } 96 97 } 98 | Popular Tags |