Esempio n. 1
0
  private void setStatus(int aStatus, TransactionException aTE) {
    // Make sure we only do this once
    //
    synchronized (this) {
      if (theStatus == DECEASED) return;

      theStatus = aStatus;
      theException = aTE;
    }

    if (shouldUpdate) theDynamicView.getSearchTask().taint();

    if (theTxn.isNull()) {
      try {
        TxnDispatcher.get().prepareAndCommit(theTxn);
      } catch (UnknownTransactionException aUTE) {
        /*
          Don't care much...if we got here, we're defining state
          and everyone else will fail at the status test above
        */
        synchronized (this) {
          theException = aUTE;
        }
      }
    }
  }
Esempio n. 2
0
  EntryViewImpl(
      Transaction aTxn, MangledEntry[] aTemplates, boolean holdLocks, boolean doUpdate, long aLimit)
      throws TransactionException, IOException {

    shouldUpdate = doUpdate;

    theTxn = TxnDispatcher.get().resolve(aTxn);

    /*
     Basic process is to assemble a set of fully matching Entry UID's which we
     then step through ascertaining whether these UID's are still valid and possibly
     asserting locks transactionally.

     Full matching is done in each view and the matching tuples are then
     logged/merged in the UIDSet

     These tuple ids are then scanned through using EntryReposImpl::find to load
     the entry, verify it's valid etc after which we may or may not maintain a
     transaction lock (these steps are done in EntryRx).
    */
    theUIDs = new UIDSet(aLimit);

    theBuffer = new EntryRx(theTxn, holdLocks);
    theDynamicView = new NewView(this, aTemplates, theUIDs);

    if (shouldUpdate) EventQueue.get().insert(theDynamicView.getSearchTask());

    /*
     For each template do a full tree search and assemble all matches
    */
    for (int i = 0; i < aTemplates.length; i++) {
      if (theUIDs.isFull()) break;

      DiskView myFixedView = new DiskView(aTemplates[i], theUIDs);

      EntryRepository myRepos = EntryRepositoryFactory.get().find(aTemplates[i].getType());

      if (myRepos != null) {
        myRepos.find(aTemplates[i], myFixedView);

        // Try subtypes
        Set<String> mySubtypes = myRepos.getSubtypes();

        for (String t : mySubtypes) {
          myRepos = EntryRepositoryFactory.get().find(t);

          if (myRepos != null) {
            myRepos.find(aTemplates[i], myFixedView);
          }
        }
      }
    }
  }