public byte[] getRecoveryState() throws Exception { OutputObjectState oos = new OutputObjectState(); oos.packString(this.getClass().getName()); this.saveState(oos); return oos.buffer(); }
public final boolean packInto(OutputObjectState os) { boolean result = false; try { os.packInt(_theXid.formatID); os.packInt(_theXid.gtrid_length); os.packInt(_theXid.bqual_length); os.packBytes(_theXid.data); result = true; } catch (Exception e) { e.printStackTrace(); result = false; } return result; }
public String toString () { String val = "OutputObjectState Uid : "+bufferUid+"\n"; if (imageType != null) val += "OutputObjectState Type : "+imageType+"\n"; else val += "OutputObjectState Type : null\n"; val += "OutputObjectState Size : "+size()+"\n"; val += "OutputObjectState Buffer: "; return val; }
return true; OutputObjectState store = new OutputObjectState(); store.packString(entry[i]); throw new ObjectStoreException(tsLogger.i18NLogger.get_objectstore_FileSystemStore_4(), e); store.packString(""); throw new ObjectStoreException(tsLogger.i18NLogger.get_objectstore_FileSystemStore_5(), e); foundTypes.setBuffer(store.buffer());
public final InputObjectState allObjUids () throws ObjectStoreException { OutputObjectState state = new OutputObjectState(); Iterator<Uid> iter = _ids.keySet().iterator(); try { while (iter.hasNext()) { UidHelper.packInto(iter.next(), state); } // don't forget to null terminate UidHelper.packInto(Uid.nullUid(), state); } catch (final IOException ex) { throw new ObjectStoreException(ex); } return new InputObjectState(state); }
public boolean save_state (OutputObjectState os, int ot) { boolean res = true; if ((targetParticipantStore != null) && (objectUid.notEquals(Uid.nullUid()))) { try { UidHelper.packInto(objectUid, os); os.packString(typeName); res = (res && super.save_state(os, ot)); } catch (IOException e) { tsLogger.i18NLogger.warn_DisposeRecord_2(); res = false; } } else { tsLogger.i18NLogger.warn_DisposeRecord_3(); res = false; } return res; }
shadowMade = os.unpackBoolean(); topLevelState = new OutputObjectState(os); res = topLevelState.valid(); tsLogger.i18NLogger.warn_PersistenceRecord_10();
@Test public void testPackUnpack () throws Exception { DummyXA res = new DummyXA(false); XidImple xid = new XidImple(new Uid()); XAOnePhaseResource xares = new XAOnePhaseResource(res, xid, null); OutputObjectState os = new OutputObjectState(); xares.pack(os); InputObjectState is = new InputObjectState(os); xares.unpack(is); } }
private OutputObjectState getParticipantInformationOutputState(final ParticipantInformation participantInformation) throws IOException { final Uid uid = new Uid(participantInformation.getId()); final OutputObjectState state = new OutputObjectState(uid, PARTICIPANT_INFORMATION_RECORD_TYPE); state.packString(participantInformation.getId()); state.packString(participantInformation.getApplicationId()); state.packString(participantInformation.getStatus()); state.packString(participantInformation.getRecoveryURL()); state.packBytes(getParticipantBytes(participantInformation.getParticipant())); return state; }
/** * Write host/port pair to the ObjectStore using * the process Uid as a unique identifier. */ private boolean saveThis() { boolean ret_status = false ; try { OutputObjectState objstate = new OutputObjectState(); if ( save_state(objstate) ) { ret_status = getStore().write_committed ( _pidUid, _typeName, objstate ) ; } } catch ( ObjectStoreException ex ) { tsLogger.i18NLogger.warn_recovery_TransactionStatusManagerItem_2(ex); } return ret_status ; }
private void packString(OutputObjectState store, String s) throws ObjectStoreException { try { store.packString(s); } catch (IOException e) { throw new ObjectStoreException("TypedVolatileStore::packString - could not pack string: " + e.getMessage()); } } }
public OutputObjectState getOOS() { if (getBuff() == null || getBuff().length == 0) return null; Uid u = getNewUid() == null ? Uid.nullUid() : getNewUid(); String t = gettName() == null ? "" : gettName(); byte[] b = getBuff() == null ? new byte[0] : getBuff(); return new OutputObjectState(u, t, b); }
public static final void pack(OutputObjectState os, Xid xid) throws IOException { if (xid instanceof XidImple) { XidImple x = (XidImple) xid; os.packBoolean(true); if (!x.packInto(os)) throw new IOException(jtaLogger.i18NLogger.get_xid_packerror()); } else { os.packBoolean(false); ByteArrayOutputStream s = new ByteArrayOutputStream(); ObjectOutputStream o = new ObjectOutputStream(s); o.writeObject(xid); o.close(); os.packBytes(s.toByteArray()); } }
/** * Save the state of a lock object. * * @return <code>true</code> if successful, <code>false</code> otherwise. */ public boolean save_state (OutputObjectState os, int ot) { if (txojLogger.logger.isTraceEnabled()) { txojLogger.logger.trace("Lock::save_state(" + os + ", " + ot + ")"); } try { os.packInt(currentStatus); os.packInt(lMode); owners.pack(os); return os.valid(); } catch (IOException e) { return false; } }
public boolean moveEntry (Uid newUid) throws ObjectStoreException { InputObjectState state = _recoveryStore.read_committed(newUid, _typeName); boolean res = false; if (state != null) // just in case recovery // kicked-in { boolean moved = _recoveryStore.write_committed(newUid, _movedTypeName, new OutputObjectState(state)); if (!moved) { tsLogger.i18NLogger.info_recovery_ExpiredTransactionStatusManagerScanner_3(newUid); } else res = _recoveryStore.remove_committed(newUid, _typeName); } return res; }
public boolean save_state(final OutputObjectState objectState, final int ot) { final boolean result = super.save_state(objectState, ot); if (result) { lastActiveTime = new Date(); try { objectState.packLong(lastActiveTime.getTime()); } catch (final IOException ex) { } } return result; }
public final int size () { return (length()); }
public boolean save_state (OutputObjectState os, int t) { if (_theXid != null) { try { os.packBoolean(true); ((XidImple) _theXid).packInto(os); } catch (IOException ex) { return false; } } return super.save_state(os, t); }
return true; OutputObjectState store = new OutputObjectState(); store.packString(entry[i]); throw new ObjectStoreException(tsLogger.i18NLogger.get_objectstore_FileSystemStore_4(), e); store.packString(""); throw new ObjectStoreException(tsLogger.i18NLogger.get_objectstore_FileSystemStore_5(), e); foundTypes.setBuffer(store.buffer());