public static final Xid unpack(InputObjectState os) throws IOException { if (os.unpackBoolean()) { XidImple x = new XidImple(); x.unpackFrom(os); return x; } else { try { byte[] b = os.unpackBytes(); ByteArrayInputStream s = new ByteArrayInputStream(b); ObjectInputStream o = new ObjectInputStream(s); Xid x = (Xid) o.readObject(); return x; } catch (Exception e) { jtaLogger.logger.debug("Can't unpack input object state " + os, e); IOException ioException = new IOException(e.toString()); ioException.initCause(e); throw ioException; } } }
public static final Xid unpack(InputObjectState os) throws IOException { if (os.unpackBoolean()) { XidImple x = new XidImple(); x.unpackFrom(os); return x; } else { try { byte[] b = os.unpackBytes(); ByteArrayInputStream s = new ByteArrayInputStream(b); ObjectInputStream o = new ObjectInputStream(s); Xid x = (Xid) o.readObject(); return x; } catch (Exception e) { IOException ioException = new IOException(e.toString()); ioException.initCause(e); throw ioException; } } }
public static final Xid unpack(InputObjectState os) throws IOException { if (os.unpackBoolean()) { XidImple x = new XidImple(); x.unpackFrom(os); return x; } else { try { byte[] b = os.unpackBytes(); ByteArrayInputStream s = new ByteArrayInputStream(b); ObjectInputStream o = new ObjectInputStream(s); Xid x = (Xid) o.readObject(); return x; } catch (Exception e) { jtaLogger.logger.debug("Can't unpack input object state " + os, e); IOException ioException = new IOException(e.toString()); ioException.initCause(e); throw ioException; } } }
public static final Xid unpack(InputObjectState os) throws IOException { if (os.unpackBoolean()) { XidImple x = new XidImple(); x.unpackFrom(os); return x; } else { try { byte[] b = os.unpackBytes(); ByteArrayInputStream s = new ByteArrayInputStream(b); ObjectInputStream o = new ObjectInputStream(s); Xid x = (Xid) o.readObject(); return x; } catch (Exception e) { jtaLogger.logger.debug("Can't unpack input object state " + os, e); IOException ioException = new IOException(e.toString()); ioException.initCause(e); throw ioException; } } }
public static final Xid unpack(InputObjectState os) throws IOException { if (os.unpackBoolean()) { XidImple x = new XidImple(); x.unpackFrom(os); return x; } else { try { byte[] b = os.unpackBytes(); ByteArrayInputStream s = new ByteArrayInputStream(b); ObjectInputStream o = new ObjectInputStream(s); Xid x = (Xid) o.readObject(); return x; } catch (Exception e) { IOException ioException = new IOException(e.toString()); ioException.initCause(e); throw ioException; } } }
public static final Xid unpack(InputObjectState os) throws IOException { if (os.unpackBoolean()) { XidImple x = new XidImple(); x.unpackFrom(os); return x; } else { try { byte[] b = os.unpackBytes(); ByteArrayInputStream s = new ByteArrayInputStream(b); ObjectInputStream o = new ObjectInputStream(s); Xid x = (Xid) o.readObject(); return x; } catch (Exception e) { jtaLogger.logger.debug("Can't unpack input object state " + os, e); IOException ioException = new IOException(e.toString()); ioException.initCause(e); throw ioException; } } }
protected HeaderState unpackHeader(InputObjectState os) throws IOException { wasInvoked = true; if (os.unpackBoolean()) new XidImple().unpackFrom(os); return super.unpackHeader(os); }
public boolean restore_state (InputObjectState os, int ot) { try { _theXid = null; boolean haveXid = os.unpackBoolean(); if (haveXid) { _theXid = new XidImple(); _theXid.unpackFrom(os); } return super.restore_state(os, ot); } catch (IOException ex) { ex.printStackTrace(); } return false; }
public boolean restore_state (InputObjectState os, int t) { try { boolean haveXid = os.unpackBoolean(); if (haveXid) { _theXid = new XidImple(); ((XidImple) _theXid).unpackFrom(os); } } catch (IOException ex) { return false; } return super.restore_state(os, t); }
public boolean restore_state (InputObjectState os, int ot) { try { _theXid = null; boolean haveXid = os.unpackBoolean(); if (haveXid) { _theXid = new XidImple(); _theXid.unpackFrom(os); } return super.restore_state(os, ot); } catch (IOException ex) { jtaxLogger.i18NLogger.warn_cant_restore_state(os, ot, ex); } return false; }
public boolean restore_state (InputObjectState os, int t) { _theXid = null; try { unpackHeader(os, new Header()); boolean haveXid = os.unpackBoolean(); if (haveXid) { _theXid = new XidImple(); ((XidImple) _theXid).unpackFrom(os); _parentNodeName = os.unpackString(); } } catch (IOException ex) { return false; } return super.restore_state(os, t); }
public boolean restore_state (InputObjectState os, int t) { _theXid = null; try { unpackHeader(os, new Header()); boolean haveXid = os.unpackBoolean(); if (haveXid) { _theXid = new XidImple(); ((XidImple) _theXid).unpackFrom(os); _parentNodeName = os.unpackString(); } } catch (IOException ex) { return false; } return super.restore_state(os, t); }
public boolean restore_state (InputObjectState os, int t) { _theXid = null; try { unpackHeader(os, new Header()); boolean haveXid = os.unpackBoolean(); if (haveXid) { _theXid = new XidImple(); ((XidImple) _theXid).unpackFrom(os); _parentNodeName = os.unpackString(); } } catch (IOException ex) { return false; } return super.restore_state(os, t); }
public boolean restore_state (InputObjectState os, int t) { _theXid = null; try { unpackHeader(os, new Header()); boolean haveXid = os.unpackBoolean(); if (haveXid) { _theXid = new XidImple(); ((XidImple) _theXid).unpackFrom(os); _parentNodeName = os.unpackString(); } } catch (IOException ex) { return false; } return super.restore_state(os, t); }
public boolean restore_state (InputObjectState os, int t) { _theXid = null; try { unpackHeader(os, new Header()); boolean haveXid = os.unpackBoolean(); if (haveXid) { _theXid = new XidImple(); ((XidImple) _theXid).unpackFrom(os); _parentNodeName = os.unpackString(); } } catch (IOException ex) { return false; } return super.restore_state(os, t); }
public boolean restore_state (InputObjectState os, int t) { _theXid = null; try { unpackHeader(os, new Header()); boolean haveXid = os.unpackBoolean(); if (haveXid) { _theXid = new XidImple(); ((XidImple) _theXid).unpackFrom(os); _parentNodeName = os.unpackString(); } } catch (IOException ex) { return false; } return super.restore_state(os, t); }
public SubordinateAtomicAction(Uid actId, boolean peekXidOnly) throws ObjectStoreException, IOException { super(actId); if (peekXidOnly) { InputObjectState os = StoreManager.getParticipantStore().read_committed(objectUid, type()); unpackHeader(os, new Header()); boolean haveXid = os.unpackBoolean(); if (haveXid) { _theXid = new XidImple(); ((XidImple) _theXid).unpackFrom(os); _parentNodeName = os.unpackString(); } } else { _activated = activate(); } }
/** * Recovery SAA. If the record is removed and peekXidOnly is true then the Xid will be null. * * @param actId * @param peekXidOnly * @throws ObjectStoreException * @throws IOException */ public SubordinateAtomicAction(Uid actId, boolean peekXidOnly) throws ObjectStoreException, IOException { super(actId); if (peekXidOnly) { InputObjectState os = StoreManager.getParticipantStore().read_committed(objectUid, type()); if (os == null) { // This will have been logged by the ObjectStore during ShadowingStore::read_state as an INFO if there was no content return; } unpackHeader(os, new Header()); boolean haveXid = os.unpackBoolean(); if (haveXid) { _theXid = new XidImple(); ((XidImple) _theXid).unpackFrom(os); _parentNodeName = os.unpackString(); } } else { _activated = activate(); } }
/** * Recovery SAA. If the record is removed and peekXidOnly is true then the Xid will be null. * * @param actId * @param peekXidOnly * @throws ObjectStoreException * @throws IOException */ public SubordinateAtomicAction(Uid actId, boolean peekXidOnly) throws ObjectStoreException, IOException { super(actId); if (peekXidOnly) { InputObjectState os = StoreManager.getParticipantStore().read_committed(objectUid, type()); if (os == null) { // This will have been logged by the ObjectStore during ShadowingStore::read_state as an INFO if there was no content return; } unpackHeader(os, new Header()); boolean haveXid = os.unpackBoolean(); if (haveXid) { _theXid = new XidImple(); ((XidImple) _theXid).unpackFrom(os); _parentNodeName = os.unpackString(); } } else { _activated = activate(); } }
@Test public void testPackUnpack () throws Exception { XidImple xid1 = new XidImple(new Uid()); OutputObjectState os = new OutputObjectState(); assertTrue(xid1.packInto(os)); InputObjectState is = new InputObjectState(os); XidImple xid2 = new XidImple(); assertTrue(xid2.unpackFrom(is)); assertTrue(xid1.equals(xid2)); os = new OutputObjectState(); XidImple.pack(os, xid1); is = new InputObjectState(os); xid2 = (XidImple) XidImple.unpack(is); assertTrue(xid1.equals(xid2)); } }