| Method from org.jboss.tm.TransactionManagerService Detail: |
void formatXAException(XAException xae,
Logger log) {
Class clazz = xae.getClass();
while (clazz != XAException.class)
{
XAExceptionFormatter formatter = (XAExceptionFormatter) xaExceptionFormatters.get(clazz);
if (formatter != null)
{
formatter.formatXAException(xae, log);
return;
} // end of if ()
clazz = clazz.getSuperclass();
}
}
|
public long getCommitCount() {
return tm.getCommitCount();
}
|
public Object getObjectInstance(Object obj,
Name name,
Context nameCtx,
Hashtable environment) throws Exception {
// Return the transaction manager
return tm;
}
|
public long getRollbackCount() {
return tm.getRollbackCount();
}
|
public long getTransactionCount() {
return tm.getTransactionCount();
}
Counts the number of transactions |
public TransactionManager getTransactionManager() {
return tm;
}
mbean get-set pair for field transactionManager
Get the value of transactionManager |
public int getTransactionTimeout() {
if (tm != null) // Get timeout value from TM (in case it was changed).
timeout = tm.getDefaultTransactionTimeout();
return timeout;
}
Describe getTransactionTimeout method here. |
public ObjectName getXidFactory() {
return xidFactory;
}
mbean get-set pair for field xidFactory
Get the value of xidFactory |
public void registerXAExceptionFormatter(Class clazz,
XAExceptionFormatter formatter) {
xaExceptionFormatters.put(clazz, formatter);
}
The registerXAExceptionFormatter method |
public void setTransactionTimeout(int timeout) {
this.timeout = timeout;
if (tm != null) // Update TM default timeout
tm.setDefaultTransactionTimeout(timeout);
}
Describe setTransactionTimeout method here. |
public void setXidFactory(ObjectName xidFactory) {
this.xidFactory = xidFactory;
}
Set the value of xidFactory |
protected void startService() throws Exception {
// ServiceMBeanSupport overrides ---------------------------------
XidFactoryMBean xidFactoryObj = (XidFactoryMBean) getServer().getAttribute(xidFactory, "Instance");
TransactionImpl.xidFactory = xidFactoryObj;
TransactionImpl.txManagerService = this;
// Get a reference to the TxManager singleton.
tm = TxManager.getInstance();
// Set its default timeout.
tm.setDefaultTransactionTimeout(timeout);
// Bind reference to TM in JNDI
// Our TM also implement the tx importer and exporter
// interfaces, so we bind it under those names too.
// Other transaction managers may have seperate
// implementations of these objects, so they are
// accessed under seperate names.
bindRef(JNDI_NAME, "org.jboss.tm.TxManager");
bindRef(JNDI_IMPORTER, "org.jboss.tm.TransactionPropagationContextImporter");
bindRef(JNDI_EXPORTER, "org.jboss.tm.TransactionPropagationContextFactory");
}
|
protected void stopService() {
try
{
// Remove TM, importer and exporter from JNDI
Context ctx = new InitialContext();
ctx.unbind(JNDI_NAME);
ctx.unbind(JNDI_IMPORTER);
ctx.unbind(JNDI_EXPORTER);
}
catch (Exception e)
{
log.error("Failed to clear JNDI bindings", e);
}
}
|
public void unregisterXAExceptionFormatter(Class clazz) {
xaExceptionFormatters.remove(clazz);
}
The unregisterXAExceptionFormatter method |