1 package example; 2 3 import java.io.*; 4 import java.util.*; 5 6 import javax.resource.*; 7 import javax.resource.spi.*; 8 import javax.security.auth.*; 9 10 17 public class ConnectionImpl { 18 private String _name; 19 20 private ManagedConnectionImpl _mConn; 22 23 private volatile boolean _isClosed; 24 25 29 ConnectionImpl(String name, ManagedConnectionImpl mConn) 30 { 31 _name = name; 32 _mConn = mConn; 33 } 34 35 49 public void close() 50 { 51 synchronized (this) { 52 if (_isClosed) 53 return; 54 _isClosed = true; 55 } 56 57 ManagedConnectionImpl mConn = _mConn; 58 _mConn = null; 59 60 mConn.close(this); 61 } 62 63 public String toString() 64 { 65 return "ConnectionImpl[" + _name + "," + _mConn + "]"; 66 } 67 68 public void finalize() 69 { 70 close(); 71 } 72 } 73 | Popular Tags |