1 25 26 package org.objectweb.jonas.jtm; 27 28 import org.objectweb.jonas.management.j2eemanagement.J2EEResource; 30 import org.objectweb.jonas.management.ReconfiguredProp; 31 32 import javax.transaction.xa.Xid ; 33 34 38 public class JTAResource extends J2EEResource { 39 40 43 public static final String SERVICE_NAME = "jtm"; 44 45 49 static final String TIMEOUT = "jonas.service.jtm.timeout"; 50 51 54 private long sequenceNumber = 0; 55 56 59 private Integer timeOut; 60 61 64 private Integer portNumber; 65 66 69 private String hostName; 70 71 74 private Boolean localJtm; 75 76 79 private TransactionServiceImpl jtm; 80 81 90 public JTAResource(String objectName, TransactionServiceImpl jtm, Integer timeOut, Boolean localJtm, 91 Integer portNumber, String hostName) { 92 super(objectName); 93 this.jtm = jtm; 94 this.timeOut = timeOut; 95 this.localJtm = localJtm; 96 this.portNumber = portNumber; 97 this.hostName = hostName; 98 } 99 100 103 public Integer getTimeOut() { 104 return timeOut; 105 } 106 107 110 public void setTimeOut(Integer timeOut) { 111 this.timeOut = timeOut; 112 jtm.setTimeout(timeOut.intValue()); 113 sendReconfigNotification(++sequenceNumber, SERVICE_NAME, new ReconfiguredProp(TIMEOUT, timeOut.toString())); 116 } 117 118 121 public Boolean isLocalJtm() { 122 return localJtm; 123 } 124 125 128 public Integer getPortNumber() { 129 return portNumber; 130 } 131 132 135 public String getHostName() { 136 return hostName; 137 } 138 139 142 public void saveConfig() { 143 sendSaveNotification(++sequenceNumber, SERVICE_NAME); 144 } 145 146 149 public Integer getTotalBegunTransactions() { 150 return new Integer (jtm.getTotalBegunTransactions()); 151 } 152 155 public Integer getTotalCommittedTransactions() { 156 return new Integer (jtm.getTotalCommittedTransactions()); 157 } 158 161 public Integer getTotalCurrentTransactions() { 162 return new Integer (jtm.getTotalCurrentTransactions()); 163 } 164 167 public Integer getTotalExpiredTransactions() { 168 return new Integer (jtm.getTotalExpiredTransactions()); 169 } 170 173 public Integer getTotalRolledbackTransactions() { 174 return new Integer (jtm.getTotalRolledbackTransactions()); 175 } 176 179 public void resetAllCounters() { 180 jtm.resetAllTxTotalCounters(); 181 } 182 183 186 public Xid [] getAllActiveXids() { 187 return jtm.getAllActiveXids(); 188 } 189 190 193 public String [] getAllActiveTx() { 194 String [] mysArray; 195 196 mysArray = jtm.getAllActiveTx(); 197 return mysArray; 198 } 199 200 203 public String [] getAllRecoveryTx() { 204 String [] mysArray; 205 206 mysArray = jtm.getAllRecoveryTx(); 207 return mysArray; 208 } 209 210 213 public String [] getAllXAResource(String xatx) { 214 String [] mysArray; 215 mysArray = jtm.getAllXAResource(xatx); 216 return mysArray; 217 } 218 219 222 public int commitXAResource(String xatx) { 223 int commiterror; 224 commiterror = jtm.commitXAResource(xatx); 225 return commiterror; 226 } 227 228 231 public int rollbackXAResource(String xatx) { 232 int rollbackerror; 233 rollbackerror = jtm.rollbackXAResource(xatx); 234 return rollbackerror; 235 } 236 237 240 public int forgetXAResource(String xatx) { 241 int forgeterror; 242 forgeterror = jtm.forgetXAResource(xatx); 243 return forgeterror; 244 } 245 } | Popular Tags |