1 23 package com.sun.enterprise.resource; 24 25 import java.util.*; 26 import java.util.logging.*; 27 28 import javax.transaction.Transaction ; 29 import javax.transaction.SystemException ; 30 31 import com.sun.logging.*; 32 import com.sun.enterprise.*; 33 import com.sun.enterprise.log.Log; 34 35 40 public class SystemResourceManagerImpl implements ResourceManager { 41 42 43 static Logger _logger = null; 44 static { 45 _logger = LogDomains.getLogger(LogDomains.RSR_LOGGER); 46 } 47 48 49 56 public Transaction getTransaction() throws PoolingException{ 57 try { 58 J2EETransactionManager tm = 59 Switch.getSwitch().getTransactionManager(); 60 return tm.getTransaction(); 61 } catch (Exception ex) { 62 _logger.log(Level.SEVERE,"poolmgr.unexpected_exception",ex); 63 throw new PoolingException(ex.toString(), ex); 64 } 65 } 66 67 70 public Object getComponent() { 71 return null; 72 } 73 74 81 public void enlistResource(ResourceHandle handle) throws PoolingException{ 82 try { 83 J2EETransactionManager tm = 84 Switch.getSwitch().getTransactionManager(); 85 Transaction tran = tm.getTransaction(); 86 if (tran != null) { 87 tm.enlistResource(tran, handle); 88 } 89 } catch (Exception ex) { 90 _logger.log(Level.SEVERE,"poolmgr.unexpected_exception",ex); 91 throw new PoolingException(ex.toString(), ex); 92 } 93 } 94 95 98 public void registerResource(ResourceHandle handle) 99 throws PoolingException { 100 } 101 102 public void rollBackTransaction() { 103 try { 104 J2EETransactionManager tm = 105 Switch.getSwitch().getTransactionManager(); 106 Transaction tran = tm.getTransaction(); 107 if ( tran != null ) { 108 tran.setRollbackOnly(); 109 } 110 } catch (SystemException ex) { 111 _logger.log(Level.WARNING,"poolmgr.system_exception",ex); 112 } catch (IllegalStateException ex) { 113 } 115 } 116 117 125 public void delistResource(ResourceHandle h, int xaresFlag) { 126 try { 127 J2EETransactionManager tm = 128 Switch.getSwitch().getTransactionManager(); 129 Transaction tran = tm.getTransaction(); 130 if (tran != null) { 131 tm.delistResource(tran, h, xaresFlag); 132 } 133 } catch (SystemException ex) { 134 _logger.log(Level.WARNING,"poolmgr.system_exception",ex); 135 } catch (IllegalStateException ex) { 136 } 138 } 139 140 143 public void unregisterResource(ResourceHandle resource, 144 int xaresFlag) { 145 } 146 } 147 | Popular Tags |