1 16 17 package org.springframework.transaction.jta; 18 19 import javax.naming.NamingException ; 20 21 import org.objectweb.jotm.Current; 22 import org.objectweb.jotm.Jotm; 23 24 import org.springframework.beans.factory.DisposableBean; 25 import org.springframework.beans.factory.FactoryBean; 26 27 80 public class JotmFactoryBean implements FactoryBean, DisposableBean { 81 82 private Current jotmCurrent; 83 84 private Jotm jotm; 85 86 87 public JotmFactoryBean() throws NamingException { 88 this.jotmCurrent = Current.getCurrent(); 90 91 if (this.jotmCurrent == null) { 93 this.jotm = new Jotm(true, false); 96 this.jotmCurrent = Current.getCurrent(); 97 } 98 } 99 100 105 public void setDefaultTimeout(int defaultTimeout) { 106 this.jotmCurrent.setDefaultTimeout(defaultTimeout); 107 } 108 109 114 public Jotm getJotm() { 115 return this.jotm; 116 } 117 118 119 public Object getObject() { 120 return this.jotmCurrent; 121 } 122 123 public Class getObjectType() { 124 return this.jotmCurrent.getClass(); 125 } 126 127 public boolean isSingleton() { 128 return true; 129 } 130 131 132 135 public void destroy() { 136 if (this.jotm != null) { 137 this.jotm.stop(); 138 } 139 } 140 141 } 142 | Popular Tags |