1 22 package org.jboss.ejb3.test.service; 23 24 import org.jboss.annotation.ejb.Service; 25 26 30 @Service 31 public class ServiceSeven implements ServiceSevenLocal, ServiceSevenRemote, ServiceSevenManagement 32 { 33 static int instances = 0; 34 int localMethodCalls; 35 int remoteMethodCalls; 36 int jmxAttribute; 37 int someJmxAttribute; 38 int otherJmxAttribute; 39 int readWriteOnlyAttribute; 40 41 public ServiceSeven() 42 { 43 instances++; 44 } 45 46 public int getInstances() 47 { 48 return instances; 49 } 50 51 public int getRemoteMethodCalls() 52 { 53 return remoteMethodCalls; 54 } 55 56 public void setRemoteMethodCalls(int i) 57 { 58 remoteMethodCalls = i; 59 } 60 61 public int getLocalMethodCalls() 62 { 63 return localMethodCalls; 64 } 65 66 public void setLocalMethodCalls(int i) 67 { 68 localMethodCalls = i; 69 } 70 71 public synchronized void localMethod(String s) 72 { 73 localMethodCalls++; 74 } 75 76 public synchronized void remoteMethod(String s) 77 { 78 remoteMethodCalls++; 79 } 80 81 public String jmxOperation(String s) 82 { 83 return "x" + s + "x"; 84 } 85 86 public String [] jmxOperation(String [] s) 87 { 88 for (int i = 0 ; i < s.length ; i++) 89 { 90 s[i] = jmxOperation(s[i]); 91 } 92 return s; 93 } 94 95 public int getAttribute() 96 { 97 return jmxAttribute; 98 } 99 100 public void setAttribute(int i) 101 { 102 jmxAttribute = i; 103 } 104 105 public int getSomeAttr() 106 { 107 return someJmxAttribute; 108 } 109 110 public void setSomeAttr(int i) 111 { 112 someJmxAttribute = i; 113 } 114 115 public int getOtherAttr() 116 { 117 return otherJmxAttribute; 118 } 119 120 public void setOtherAttr(int i) 121 { 122 otherJmxAttribute = i; 123 } 124 125 public void setWriteOnly(int i) 126 { 127 readWriteOnlyAttribute = i; 128 } 129 130 public int getReadOnly() 131 { 132 return readWriteOnlyAttribute; 133 } 134 135 136 public void create() throws Exception 137 { 138 System.out.println("ServiceSeven - CREATE"); 139 } 141 142 public void start() throws Exception 143 { 144 System.out.println("ServiceSeven - START"); 145 } 147 148 public void stop() 149 { 150 System.out.println("ServiceSeven - STOP"); 151 } 152 153 public void destroy() 154 { 155 System.out.println("ServiceSeven - DESTROY"); 156 } 157 158 } 159 | Popular Tags |