コード例 #1
0
  /**
   * Codifies the results of the provided transaction and reports the information to the profiling
   * system.
   *
   * @param txn a finished transaction
   * @param succeeded whether {@code txn} was successful (i.e. did not abort).
   */
  private void reportDetail(Transaction txn, boolean succeeded) {
    AccessedObjectsDetailImpl detail = txnMap.remove(txn);

    // if the task failed try to determine why
    if (!succeeded) {
      // mark the type with an initial guess of unknown and then
      // try to refine it.
      detail.conflictType = ConflictType.UNKNOWN;

      // NOTE: in the current system we don't really see transactions
      // fail because of conflict with another active transaction,
      // so currently this is only for looking through a backlog
      if (backlog != null) {
        // look through the backlog for a conflict
        for (AccessedObjectsDetailImpl oldDetail : backlog) {
          if (detail.conflictsWith(oldDetail)) {
            detail.setConflict(ConflictType.ACCESS_NOT_GRANTED, oldDetail);
            break;
          }
        }
      }
    }

    // if we're keeping a backlog, then add the reported detail...if
    // the backlog is full, then evict old data until there is room
    if (backlog != null) {
      while (!backlog.offer(detail)) {
        backlog.poll();
      }
    }

    profileCollectorHandle.setAccessedObjectsDetail(detail);
  }
コード例 #2
0
 /** {@inheritDoc} */
 public boolean prepare(Transaction txn) {
   AccessedObjectsDetailImpl detail = txnMap.get(txn);
   // TODO: this is the last chance to abort because of conflict,
   // when we're actually managing the contention
   detail.markPrepared();
   return false;
 }
コード例 #3
0
    /** {@inheritDoc} */
    public void setObjectDescription(Transaction txn, T objId, Object description) {
      Objects.checkNull("txn", txn);
      Objects.checkNull("objId", objId);

      AccessedObjectsDetailImpl detail = txnMap.get(txn);
      if (detail == null) {
        throw new IllegalArgumentException("Unknown transaction: " + txn);
      }

      if (description != null) {
        detail.setDescription(source, objId, description);
      }
    }
コード例 #4
0
    /** {@inheritDoc} */
    public void reportObjectAccess(Transaction txn, T objId, AccessType type, Object description) {
      Objects.checkNull("txn", txn);
      Objects.checkNull("objId", objId);
      Objects.checkNull("type", type);

      AccessedObjectsDetailImpl detail = txnMap.get(txn);
      if (detail == null) {
        throw new IllegalArgumentException("Unknown transaction: " + txn);
      }
      detail.addAccess(new AccessedObjectImpl(objId, type, source, detail));
      if (description != null) {
        detail.setDescription(source, objId, description);
      }
    }
コード例 #5
0
 /** {@inheritDoc} */
 public Object getDescription() {
   return parent.getDescription(source, objId);
 }