Examples of AccessedObjectsDetail


Examples of com.sun.sgs.profile.AccessedObjectsDetail

    /**
     * {@inheritDoc}
     */
    public void report(ProfileReport profileReport) {
        // get the access detail, or return if there is none available
  AccessedObjectsDetail detail = profileReport.getAccessedObjectsDetail();
  if (detail == null) {
            return;
        }

        // if a backlog is in use, then store the new detail
        TransactionId txnId = null;
        if (backlogMap != null) {
            txnId = new TransactionId(profileReport.getTransactionId());
            backlogMap.put(txnId, detail);
        }

        // if there was conflict, then figure out what to display
        if (detail.getConflictType() != ConflictType.NONE) {
            if (txnId == null) {
                txnId = new TransactionId(profileReport.getTransactionId());
            }
            // print out the detail for the failed transaction
      System.out.printf("Task type %s failed due to conflict.  Details:"
            + "%n  accessor id: %s, try count %d; objects "
            + "accessed ordered by first access:%n%s"
            + "conflict type: %s%n",
            profileReport.getTask().getBaseTaskType(),
            txnId, profileReport.getRetryCount(),
            formatAccesses(detail.getAccessedObjects()),
            detail.getConflictType());

            // see if the conflicting transaction is known, otherwise we've
            // shown all the detail we know
            byte [] conflictingBytes = detail.getConflictingId();
            if (conflictingBytes == null) {
                System.out.printf("%n");
                return;
            }

            TransactionId conflictingId = new TransactionId(conflictingBytes);

            // if we're keeping a backlog, look through it to see if we
            // have the detail on the conflicting id
            if (backlogMap != null) {
                // look to see if we know about the conflicting transaction,
                // and add the new detail to the backlog
                AccessedObjectsDetail conflictingDetail =
                    backlogMap.get(conflictingId);

                // if we found the conflicting detail, display it and return
                if (conflictingDetail != null) {
                    System.out.printf("Conflicting transaction id: %s, objects"
                                      + " accessed, ordered by first access:"
                                      + "%n%s%n", conflictingId,
                                      formatAccesses(conflictingDetail.
                                                     getAccessedObjects()));

                    return;
                }
            }
View Full Code Here

Examples of com.sun.sgs.profile.AccessedObjectsDetail

    @Test
    public void testAccessedObjectsDetailNone() throws Exception {
  txn.commit();
  txn = null;
  AccessedObjectsDetail detail =
      profileCollector.getAccessedObjectsDetail();
  assertObjectDetails(detail);
  assertEquals(ConflictType.NONE, detail.getConflictType());
  assertEquals(null, detail.getConflictingId());
    }
View Full Code Here

Examples of com.sun.sgs.profile.AccessedObjectsDetail

    public void testAccessedObjectsDetailNoConflict() throws Exception {
  reporter.reportObjectAccess("o1", AccessType.READ);
  reporter.reportObjectAccess("o2", AccessType.WRITE);
  txn.commit();
  txn = null;
  AccessedObjectsDetail detail =
      profileCollector.getAccessedObjectsDetail();
  assertObjectDetails(detail,
          "s", "o1", AccessType.READ, null,
          "s", "o2", AccessType.WRITE, null);
  assertEquals(ConflictType.NONE, detail.getConflictType());
  assertEquals(null, detail.getConflictingId());
    }
View Full Code Here

Examples of com.sun.sgs.profile.AccessedObjectsDetail

    txn2, "o1", AccessType.WRITE, "Object 1");
      fail("Expected TransactionTimeoutException");
  } catch (TransactionTimeoutException e) {
      System.err.println(e);
  }
  AccessedObjectsDetail detail =
      profileCollector.getAccessedObjectsDetail();
  assertObjectDetails(detail, "s", "o1", AccessType.WRITE, "Object 1");
  assertEquals(ConflictType.ACCESS_NOT_GRANTED,
         detail.getConflictType());
  assertArrayEquals(txn.getId(), detail.getConflictingId());
  txn.abort(ABORT_EXCEPTION);
  txn = null;
  detail = profileCollector.getAccessedObjectsDetail();
  assertObjectDetails(detail, "s", "o1", AccessType.WRITE, null);
  assertEquals(ConflictType.NONE, detail.getConflictType());
  assertEquals(null, detail.getConflictingId());
    }
View Full Code Here

Examples of com.sun.sgs.profile.AccessedObjectsDetail

      fail("Expected TransactionConflictException");
  } catch (TransactionConflictException e) {
      System.err.println(e);
  }
  assertEquals(null, attempt.get());
  AccessedObjectsDetail detail =
      profileCollector.getAccessedObjectsDetail();
  assertObjectDetails(detail,
          "s", "o2", AccessType.READ, null,
          "s", "o1", AccessType.WRITE, null);
  assertEquals(ConflictType.DEADLOCK, detail.getConflictType());
  assertArrayEquals(txn.getId(), detail.getConflictingId());
  txn.commit();
  txn = null;
  detail = profileCollector.getAccessedObjectsDetail();
  assertObjectDetails(detail,
          "s", "o1", AccessType.READ, null,
          "s", "o2", AccessType.WRITE, null);
  assertEquals(ConflictType.NONE, detail.getConflictType());
  assertEquals(null, detail.getConflictingId());
    }
View Full Code Here

Examples of com.sun.sgs.profile.AccessedObjectsDetail

        // size.  The system identity is pinned to a node.
        if (owner instanceof SystemIdentity) {
            return;
        }
       
        AccessedObjectsDetail detail = profileReport.getAccessedObjectsDetail();
        if (detail == null) {
            return;
        }

        builder.updateGraph(owner, detail);
View Full Code Here

Examples of com.sun.sgs.profile.AccessedObjectsDetail

    /**
     * {@inheritDoc}
     */
    public void report(ProfileReport profileReport) {
        // get the access detail, or return if there is none available
  AccessedObjectsDetail detail = profileReport.getAccessedObjectsDetail();
  if (detail == null) {
            return;
        }

        // if a backlog is in use, then store the new detail
        TransactionId txnId = null;
        if (backlogMap != null) {
            txnId = new TransactionId(profileReport.getTransactionId());
            backlogMap.put(txnId, detail);
        }

        // if there was conflict, then figure out what to display
        if (detail.getConflictType() != ConflictType.NONE) {
            if (txnId == null) {
                txnId = new TransactionId(profileReport.getTransactionId());
            }
            // print out the detail for the failed transaction
      System.out.printf("Task type %s failed due to conflict.  Details:"
            + "%n  accessor id: %s, try count %d; objects "
            + "accessed ordered by first access:%n%s"
            + "conflict type: %s%n",
            profileReport.getTask().getBaseTaskType(),
            txnId, profileReport.getRetryCount(),
            formatAccesses(detail.getAccessedObjects()),
            detail.getConflictType());

            // see if the conflicting transaction is known, otherwise we've
            // shown all the detail we know
            byte [] conflictingBytes = detail.getConflictingId();
            if (conflictingBytes == null) {
                System.out.printf("%n");
                return;
            }

            TransactionId conflictingId = new TransactionId(conflictingBytes);

            // if we're keeping a backlog, look through it to see if we
            // have the detail on the conflicting id
            if (backlogMap != null) {
                // look to see if we know about the conflicting transaction,
                // and add the new detail to the backlog
                AccessedObjectsDetail conflictingDetail =
                    backlogMap.get(conflictingId);

                // if we found the conflicting detail, display it and return
                if (conflictingDetail != null) {
                    System.out.printf("Conflicting transaction id: %s, objects"
                                      + " accessed, ordered by first access:"
                                      + "%n%s%n", conflictingId,
                                      formatAccesses(conflictingDetail.
                                                     getAccessedObjects()));

                    return;
                }
            }
View Full Code Here

Examples of com.sun.sgs.profile.AccessedObjectsDetail

    /**
     * Returns the AccessedObjectsDetail last supplied to a call to
     * setAccessedObjectsDetail.
     */
    public synchronized AccessedObjectsDetail getAccessedObjectsDetail() {
  AccessedObjectsDetail result = detail;
  detail = null;
  return result;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.