/** * @return the XAResource associated with the current XAConnection. */ protected final XAResource getXAResource() { try { return _recoveryConnection.getResource(); } catch (Exception e) { return null; } }
private final void removeConnection() { /* * Should only be called once. Remove the connection so that user can * reuse the driver as though it were fresh (e.g., can do read only * optimisation). */ if (_recoveryObject != null) { _recoveryObject.close(); } if (_theTransaction != null) _theTransaction = null; }
if (recoverableXAConnection != null) os.packInt(RecoverableXAConnection.AUTO_RECOVERY); os.packString(recoverableXAConnection.getClass().getName()); recoverableXAConnection.packInto(os); os.packInt(RecoverableXAConnection.OBJECT_RECOVERY) ; final byte[] data ; try final ByteArrayOutputStream baos = new ByteArrayOutputStream() ; final ObjectOutputStream oos = new ObjectOutputStream(baos) ; oos.writeObject(xaResource) ; oos.flush() ; oos.close() ; data = baos.toByteArray() ; final String message = jtaLogger.i18NLogger.get_resources_arjunacore_XAOnePhaseResource_pack(); IOException ioException = new IOException(message); ioException.initCause(ioe);
os.packInt(_heuristic); os.packBoolean(_committed); os.packInt(RecoverableXAConnection.OBJECT_RECOVERY); os.packString(_productName); ByteArrayOutputStream s = new ByteArrayOutputStream(); ObjectOutputStream o = new ObjectOutputStream(s); o.writeObject(_theXAResource); o.close(); os.packBoolean(true); os.packString(name); os.packBytes(s.toByteArray()); jtaLogger.i18NLogger.warn_resources_arjunacore_savestate(); os.packString(_recoveryObject.getClass().getName()); _recoveryObject.packInto(os); jtaLogger.i18NLogger.warn_resources_arjunacore_savestateerror(_theXAResource.toString(), XAHelper.xidToString(_tranID), e);
final int recoveryType = is.unpackInt() ; switch(recoveryType) final String recoverableXAConnectionClassName = is.unpackString() ; recoverableXAConnection.unpackFrom(is) ; try xaResource = recoverableXAConnection.getResource() ; final byte[] data = is.unpackBytes() ; try final ByteArrayInputStream bais = new ByteArrayInputStream(data) ; final ObjectInputStream ois = new ObjectInputStream(bais) ; xaResource = (XAResource)ois.readObject() ; final String message = jtaLogger.i18NLogger.get_resources_arjunacore_XAOnePhaseResource_unpackType(Integer.toString(recoveryType)); throw new IOException(message);
_heuristic = os.unpackInt(); _committed = os.unpackBoolean(); _recoveryObject = null; if (os.unpackInt() == RecoverableXAConnection.OBJECT_RECOVERY) _productName = os.unpackString(); byte[] b = os.unpackBytes(); ByteArrayInputStream s = new ByteArrayInputStream(b); ObjectInputStream o = new ObjectInputStream(s); _theXAResource = (XAResource) o.readObject(); o.close(); jtaLogger.i18NLogger.warn_resources_arjunacore_restorestate(ex); jtaLogger.i18NLogger.warn_resources_arjunacore_norecoveryxa( toString() ); _recoveryObject.unpackFrom(os); _theXAResource = _recoveryObject.getResource(); jtaLogger.i18NLogger.warn_resources_arjunacore_restorestateerror(_theXAResource.toString(), XAHelper.xidToString(_tranID), e);
if (!_recoveryConnection.inuse()) if (_recoveryConnection.validTransaction(tx)) XAResource xares = _recoveryConnection.getResource(); _recoveryConnection.closeCloseCurrentConnection(); if (_theConnection != null && !_theConnection.isClosed()) _theConnection.close();
if (!_recoveryConnection.setTransaction(tx)) throw new SQLException( jdbcLogger.i18NLogger.get_alreadyassociated() ); xares = _recoveryConnection.getResource();
public synchronized XAResource getXAResource () throws SQLException { JDBC2RecoveryConnection conn = null; if (hasMoreResources()) { connectionIndex++; conn = getConnection(); if (conn == null) { jdbcLogger.i18NLogger.warn_recovery_basic_xarec("BasicXARecovery.getConnection -"); } } return conn.recoveryConnection().getConnection().getXAResource(); }
/** * Can only set readonly before we use the connection in a given * transaction! * * @message com.arjuna.ats.internal.jdbc.setreadonly Cannot set readonly * when within a transaction! */ public void setReadOnly(boolean ro) throws SQLException { if (!_recoveryConnection.inuse()) { getConnection().setReadOnly(ro); } else throw new SQLException(jdbcLogger.logMesg .getString("com.arjuna.ats.internal.jdbc.setreadonly")); }
public void afterCompletion(int status) { try { _theConnection.close(); } catch (Exception ex) { } try { _recoveryConnection.closeCloseCurrentConnection(); } catch (Exception ex) { } }
if (!_recoveryConnection.validTransaction(tx)) throw new SQLException( jdbcLogger.i18NLogger.get_alreadyassociatedcheck());
os.packInt(_heuristic); os.packBoolean(_committed); os.packInt(RecoverableXAConnection.OBJECT_RECOVERY); os.packString(_productName); ByteArrayOutputStream s = new ByteArrayOutputStream(); ObjectOutputStream o = new ObjectOutputStream(s); o.writeObject(_theXAResource); o.close(); os.packBoolean(true); os.packString(name); os.packBytes(s.toByteArray()); jtaLogger.i18NLogger.warn_resources_arjunacore_savestate(); os.packString(_recoveryObject.getClass().getName()); _recoveryObject.packInto(os); jtaLogger.i18NLogger.warn_resources_arjunacore_savestateerror(_theXAResource.toString(), XAHelper.xidToString(_tranID), e);
final int recoveryType = is.unpackInt() ; switch(recoveryType) final String recoverableXAConnectionClassName = is.unpackString() ; recoverableXAConnection.unpackFrom(is) ; try xaResource = recoverableXAConnection.getResource() ; final byte[] data = is.unpackBytes() ; try final ByteArrayInputStream bais = new ByteArrayInputStream(data) ; final ObjectInputStream ois = new ObjectInputStream(bais) ; xaResource = (XAResource)ois.readObject() ; final String message = jtaLogger.i18NLogger.get_resources_arjunacore_XAOnePhaseResource_unpackType(Integer.toString(recoveryType)); throw new IOException(message);
_heuristic = os.unpackInt(); _committed = os.unpackBoolean(); _recoveryObject = null; if (os.unpackInt() == RecoverableXAConnection.OBJECT_RECOVERY) _productName = os.unpackString(); byte[] b = os.unpackBytes(); ByteArrayInputStream s = new ByteArrayInputStream(b); ObjectInputStream o = new ObjectInputStream(s); jtaLogger.i18NLogger.warn_resources_arjunacore_classnotfound(className); haveXAResource = false; o.close(); jtaLogger.i18NLogger.warn_resources_arjunacore_restorestate(ex); jtaLogger.i18NLogger.warn_resources_arjunacore_norecoveryxa( toString() ); _recoveryObject.unpackFrom(os); _theXAResource = _recoveryObject.getResource(); jtaLogger.i18NLogger.warn_resources_arjunacore_restorestateerror(_theXAResource.toString(), XAHelper.xidToString(_tranID), e);
if (!_recoveryConnection.inuse()) if (_recoveryConnection.validTransaction(tx)) XAResource xares = _recoveryConnection.getResource(); _recoveryConnection.closeCloseCurrentConnection(); if (_theConnection != null && !_theConnection.isClosed()) _theConnection.close();
if (!_recoveryConnection.setTransaction(tx)) throw new SQLException( jdbcLogger.i18NLogger.get_alreadyassociated() ); xares = _recoveryConnection.getResource();
public synchronized XAResource getXAResource () throws SQLException { JDBC2RecoveryConnection conn = null; if (hasMoreResources()) { connectionIndex++; conn = getConnection(); if (conn == null) { jdbcLogger.i18NLogger.warn_recovery_basic_xarec("BasicXARecovery.getConnection -"); } } return conn.recoveryConnection().getConnection().getXAResource(); }
/** * Can only set readonly before we use the connection in a given * transaction! */ public void setReadOnly(boolean ro) throws SQLException { if (!_recoveryConnection.inuse()) { getConnection().setReadOnly(ro); } else throw new SQLException(jdbcLogger.i18NLogger.get_setreadonly()); }
public void afterCompletion(int status) { try { _theConnection.close(); } catch (Exception ex) { } try { _recoveryConnection.closeCloseCurrentConnection(); } catch (Exception ex) { } }