Package com.arjuna.ats.internal.jta.resources

Source Code of com.arjuna.ats.internal.jta.resources.XAResourceErrorHandler

/*    */ package com.arjuna.ats.internal.jta.resources;
/*    */
/*    */ import com.arjuna.ats.jta.common.jtaPropertyManager;
/*    */ import com.arjuna.ats.jta.resources.XAResourceMap;
/*    */ import com.arjuna.common.util.propertyservice.PropertyManager;
/*    */ import java.util.Enumeration;
/*    */ import java.util.HashMap;
/*    */ import java.util.Properties;
/*    */ import javax.transaction.xa.XAException;
/*    */ import javax.transaction.xa.XAResource;
/*    */
/*    */ public class XAResourceErrorHandler
/*    */ {
/* 62 */   private static HashMap _maps = new HashMap();
/*    */
/*    */   public static boolean notAProblem(XAResource res, XAException ex, boolean commit)
/*    */   {
/* 48 */     boolean isNotAProblem = false;
/* 49 */     XAResourceMap theMap = (XAResourceMap)_maps.get(res.getClass().getName());
/*    */
/* 51 */     if (theMap != null) {
/* 52 */       isNotAProblem = theMap.notAProblem(ex, commit);
/*    */     }
/* 54 */     return isNotAProblem;
/*    */   }
/*    */
/*    */   public static void addXAResourceMap(String type, XAResourceMap map)
/*    */   {
/* 59 */     _maps.put(type, map);
/*    */   }
/*    */
/*    */   static
/*    */   {
/* 68 */     Properties props = jtaPropertyManager.propertyManager.getProperties();
/*    */
/* 70 */     if (props != null)
/*    */     {
/* 72 */       Enumeration names = props.propertyNames();
/*    */
/* 74 */       while (names.hasMoreElements())
/*    */       {
/* 76 */         String propName = (String)names.nextElement();
/*    */
/* 78 */         if (propName.startsWith("com.arjuna.ats.jta.xaErrorHandler"))
/*    */         {
/* 85 */           String theClass = jtaPropertyManager.propertyManager.getProperty(propName);
/*    */           try
/*    */           {
/* 89 */             Class c = Thread.currentThread().getContextClassLoader().loadClass(theClass);
/*    */
/* 91 */             XAResourceMap map = (XAResourceMap)c.newInstance();
/*    */
/* 93 */             addXAResourceMap(map.getXAResourceName(), map);
/*    */           }
/*    */           catch (Exception ex)
/*    */           {
/* 97 */             ex.printStackTrace();
/*    */           }
/*    */         }
/*    */       }
/*    */     }
/*    */   }
/*    */ }

/* Location:           /home/mnovotny/projects/EMBEDDED_JBOSS_BETA3_COMMUNITY/embedded/output/lib/embedded-jboss/lib/jboss-embedded-all.jar
* Qualified Name:     com.arjuna.ats.internal.jta.resources.XAResourceErrorHandler
* JD-Core Version:    0.6.0
*/
TOP

Related Classes of com.arjuna.ats.internal.jta.resources.XAResourceErrorHandler

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.