private final void listLogs (String type) throws IOException { InputObjectState buff = new InputObjectState(); try { if (StoreManager.getRecoveryStore().allObjUids(type, buff)) { Uid u = null; do { u = UidHelper.unpackFrom(buff); if (Uid.nullUid().notEquals(u)) { System.out.println("Log: " + u); } } while (Uid.nullUid().notEquals(u)); } } catch (final ObjectStoreException ex) { throw new IOException(); } }
/** * Create a container without a name. A name will be assigned automatically. */ public Container () { this(new Uid().stringForm(), TYPE.RECOVERABLE); }
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); }
private int getUidsCountInStore() throws Exception { final InputObjectState uids = new InputObjectState(); recoveryStore.allObjUids(ATOMIC_ACTION_TYPE, uids); int counter = 0; for (Uid uid = UidHelper.unpackFrom(uids); !uid.equals(Uid.nullUid()); uid = UidHelper.unpackFrom(uids)) { counter++; } return counter; }
public boolean doRemove() { try { if (StoreManager.getRecoveryStore().remove_committed(getUid(), _uidWrapper.getType())) return true; if (tsLogger.logger.isDebugEnabled()) tsLogger.logger.debugf("%s %s", REMOVE_NOK_1, getUid().toString()); return false; } catch (ObjectStoreException e) { if (tsLogger.logger.isDebugEnabled()) tsLogger.logger.debugf("%s %s - %s", REMOVE_NOK_1, getUid().toString(), e.getMessage()); return false; } }
public InputObjectState getIOS() { 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 InputObjectState(u, t, b); }
@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); } }
public int nestedPrepare () { if (tsLogger.logger.isTraceEnabled()) { tsLogger.logger.trace("DisposeRecord::nestedPrepare() for " + order()); } if ((targetParticipantStore != null) && (objectUid.notEquals(Uid.nullUid()))) return TwoPhaseOutcome.PREPARE_OK; else return TwoPhaseOutcome.PREPARE_NOTOK; }
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; }
private Collection<Uid> getUids(String type) { Collection<Uid> uids = new ArrayList<Uid>(); ObjectStoreIterator iter = new ObjectStoreIterator(StoreManager.getRecoveryStore(), type); while (true) { Uid u = iter.iterate(); if (u == null || Uid.nullUid().equals(u)) break; uids.add(u); } return uids; }
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 void removeParticipantInformation(final ParticipantInformation participantInformation) { if (LOG.isTraceEnabled()) { LOG.trace("RecoveryManager.removeParticipantInformation: participantInformation=" + participantInformation); } final RecoveryStore recoveryStore = StoreManager.getRecoveryStore(); final Uid uid = new Uid(participantInformation.getId()); try { recoveryStore.remove_committed(uid, PARTICIPANT_INFORMATION_RECORD_TYPE); } catch (ObjectStoreException e) { LOG.warn("Failure while removing participant information from the object store.", e); } }
/** * Same as stringForm() */ public String toString () { return stringForm(); }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; UidWrapper that = (UidWrapper) o; return !(uid != null ? !uid.equals(that.uid) : that.uid != null); }
public String getUid() { return uid.toString(); } }
private final LinkedList getList (Uid objUid) { int index = objUid.hashCode() % HASH_SIZE; synchronized (_workList) { if (_workList[index] == null) _workList[index] = new LinkedList(); return _workList[index]; } }
public UidWrapper(ObjStoreBrowser browser, String beantype, String ostype, String className, Uid uid, boolean allowRegistration) { this.browser = browser; this.ostype = ostype; this.beantype = beantype; this.className = className; this.uid = uid; this.tstamp = 0L; this.name = "jboss.jta:type=ObjectStore,itype=" + ostype + ",uid=" + uid.fileStringForm(); // + ",participant=false"; this.registered = false; this.allowRegistration = allowRegistration; }
public final boolean notEquals (ActionInfo other) { if ((actionUid.notEquals(other.actionUid)) || (actionType != other.actionType)) { return true; } else return false; }