Package org.eclipse.ecf.core.sharedobject

Examples of org.eclipse.ecf.core.sharedobject.SharedObjectAddAbortException


public class SharedObjectAddAbortExceptionTest extends TestCase {

  public void testGetTimeout() {
    try {
      throw new SharedObjectAddAbortException(null, (Throwable) null, 10);
    } catch (SharedObjectAddAbortException e) {
      assertEquals(10, e.getTimeout());
    }

    try {
      // Regression test for bug #167019
      throw new SharedObjectAddAbortException(null, (Map) null, 10);
    } catch (SharedObjectAddAbortException e) {
      assertEquals(10, e.getTimeout());
    }

    try {
      // Regression test for bug #167019
      throw new SharedObjectAddAbortException(null, (List) null,
          (Map) null, 10);
    } catch (SharedObjectAddAbortException e) {
      assertEquals(10, e.getTimeout());
    }
  }
View Full Code Here


      long end = System.currentTimeMillis() + timeout;
      try {
        while (!votingCompleted()) {
          long wait = end - System.currentTimeMillis();
          if (wait <= 0L)
            throw new SharedObjectAddAbortException(
                Messages.TransactionSharedObject_EXCEPTION_TIMEOUT);
          // Actually wait right here
          lock.wait(wait);
        }
      } catch (InterruptedException e) {
        throw new SharedObjectAddAbortException(Messages.TransactionSharedObject_EXCEPTION_INTERUPTED);
      } catch (SharedObjectAddAbortException e1) {
        // Aborted for some reason. Clean up.
        doAbort(e1);
      }
      // Success. Send commit to remotes and clean up before returning.
View Full Code Here

      // Send replicaCommit message to all remote clients
      try {
        forwardMsgTo(null, SharedObjectMsg.createMsg((String) null,
            REPLICA_COMMIT_MSG));
      } catch (Exception e2) {
        doAbort(new SharedObjectAddAbortException(
            Messages.TransactionSharedObject_EXCEPTION_ON_COMMIT_MESSAGE, e2));
      }
    }
    // Set state variable to committed.
    state = ISharedObjectContainerTransaction.COMMITTED;
View Full Code Here

    // the transaction. If so, we throw.
    if (failedParticipants != null && failedParticipants.size() > 0) {
      ID remoteID = (ID) failedParticipants.keys().nextElement();
      Exception e = (Exception) failedParticipants.get(remoteID);
      // Abort!
      throw new SharedObjectAddAbortException(Messages.TransactionSharedObject_EXCEPTION_FROM_ABORT, e);
      // If no problems, and the number of participants to here from is 0,
      // then we're done
    } else if (state == ISharedObjectContainerTransaction.VOTING
        && participantIDs.size() == 0) {
      // Success!
View Full Code Here

TOP

Related Classes of org.eclipse.ecf.core.sharedobject.SharedObjectAddAbortException

Copyright © 2018 www.massapicom. 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.