Package net.jini.core.transaction.server

Examples of net.jini.core.transaction.server.TransactionParticipant


        /*
         * create fake TransactionParticipant which
         * will prevent normal commit completion
         */
        TransactionParticipant tp = new ParticipantImpl();
        ((ServerTransaction) txn).join(tp, System.currentTimeMillis());

        // run thread which will prevent normal commit completion
        Committer committer = new Committer(tp, (ServerTransaction) txn,
                mgr);
View Full Code Here


        /*
         * create fake TransactionParticipant which
         * will prevent normal commit completion
         */
        TransactionParticipant tp = new ParticipantImpl();
        ((ServerTransaction) txn).join(tp, System.currentTimeMillis());

        // run thread which will prevent normal commit completion
        Committer committer = new Committer(tp, (ServerTransaction) txn,
                mgr);
View Full Code Here

        /*
         * create fake TransactionParticipant which
         * will prevent normal commit completion
         */
        TransactionParticipant tp = new ParticipantImpl();
        ((ServerTransaction) txn).join(tp, System.currentTimeMillis());

        // run thread which will prevent normal commit completion
        Committer committer = new Committer(tp, (ServerTransaction) txn,
                mgr);
View Full Code Here

        /*
         * create fake TransactionParticipant which
         * will prevent normal commit completion
         */
        TransactionParticipant tp = new ParticipantImpl();
        ((ServerTransaction) txn).join(tp, System.currentTimeMillis());

        // run thread which will prevent normal commit completion
        Committer committer = new Committer(tp, (ServerTransaction) txn,
                mgr);
View Full Code Here

          new Object[] {new Long(id), part, new Long(crashCount) });
  }
        readyState.check();

               
        TransactionParticipant preparedTarget = null;
        preparedTarget =
            (TransactionParticipant)
                participantPreparer.prepareProxy(part);
       
  if (participantLogger.isLoggable(Level.FINEST)) {
View Full Code Here

        if (operationsLogger.isLoggable(Level.FINER)) {
            operationsLogger.entering(PrepareAndCommitJob.class.getName(),
          "doWork", new Object[] {who, param});
  }
  ParticipantHandle handle = (ParticipantHandle)param;
  TransactionParticipant par = null;

        //check if a vote already exists because it was
        //recovered from the log. In this situation,
        //we do not need to log this info since it
        //exists in the log which was used for recovery...
        int vote = handle.getPrepState();
        switch (vote) {
            case COMMITTED:
            case NOTCHANGED:
            case ABORTED:
            case PREPARED:
                if (operationsLogger.isLoggable(Level.FINER)) {
                    operationsLogger.exiting(
            PrepareAndCommitJob.class.getName(),
                   "doWork", new Integer(vote));
    }
    return new Integer(vote);
        }
        //...otherwise, explicitly instruct the participant to
        //prepare after unpacking it and checking against the
        //max retry threshold
        if (par == null)
            par = handle.getPreParedParticipant();
        //If you have exhausted the max retry threshold
        //stop, so that no further attempts are made.
  try {
            if (attempt(who) > maxtries) {
          if (operationsLogger.isLoggable(Level.FINER)) {
                    operationsLogger.exiting(
      PrepareAndCommitJob.class.getName(),
                  "doWork", new Integer(ABORTED));
    }
          return new Integer(ABORTED);
            }
  } catch (JobException je) {
      if (operationsLogger.isLoggable(Level.FINER)) {
                operationsLogger.exiting(PrepareAndCommitJob.class.getName(),
              "doWork", null);
      }
      return null;
  }
        //At this point, if participant is null, there
        //must be an error unpacking, so retry later
        if (par == null) {
      if (operationsLogger.isLoggable(Level.FINER)) {
                operationsLogger.exiting(PrepareAndCommitJob.class.getName(),
              "doWork", null);
      }
            return null;
        }
        //Here we actually need to ask the participant to
        //prepare.  Note the RemoteException causes a
        //retry. Here we only log info for the cases
        //where a final outcome is available.
        Object response = null;
        try {
            vote = par.prepareAndCommit(tr.mgr, tr.id);
            response = new Integer(vote);
        } catch (UnknownTransactionException ute) {
            if (reCaught != null) {
                notifyClient = true;
            }
View Full Code Here

        if (operationsLogger.isLoggable(Level.FINER)) {
            operationsLogger.entering(PrepareJob.class.getName(),
                "doWork", new Object[] {who, param});
  }
  ParticipantHandle handle = (ParticipantHandle)param;
  TransactionParticipant par = null;

        //check if a vote already exists because it was
        //recovered from the log. In this situation,
        //we do not need to log this info since it
        //exists in the log which was used for recovery...
        int vote = handle.getPrepState();
        switch (vote) {
            case COMMITTED:
            case NOTCHANGED:
            case ABORTED:
            case PREPARED:
                if (operationsLogger.isLoggable(Level.FINER)) {
                    operationsLogger.exiting(
            PrepareJob.class.getName(),
      "doWork", new Integer(vote));
    }
    return new Integer(vote);
        }
        //...otherwise, explicitly instruct the participant to
        //prepare after unpacking it and checking against the
        //max retry threshold
        if (par == null)
            par = handle.getPreParedParticipant();
        //If you have exhausted the max retry threshold
        //stop, so that no further attempts are made.
  try {
            if (attempt(who) > maxtries) {
                if (operationsLogger.isLoggable(Level.FINER)) {
                    operationsLogger.exiting(
            PrepareJob.class.getName(),"doWork",
            new Integer(ABORTED));
    }
          return new Integer(ABORTED);
            }
  } catch (JobException je) {
            if (operationsLogger.isLoggable(Level.FINER)) {
                operationsLogger.exiting(
        PrepareJob.class.getName(),"doWork", null);
      }
      return null;
  }
        //At this point, if participant is null, there
        //must be an error unpacking, so retry later
        if (par == null) {
            if (operationsLogger.isLoggable(Level.FINER)) {
                operationsLogger.exiting(
        PrepareJob.class.getName(),"doWork", null);
      }
            return null;
        }
        //Here we actually need to ask the participant to
        //prepare.  Note the RemoteException causes a
        //retry. Here we only log info for the cases
        //where a final outcome is available.
        Object response = null;
        try {
            vote = par.prepare(tr.mgr, tr.id);
            response = new Integer(vote);
        } catch (TransactionException bte) {
            vote = ABORTED;
            response = new Integer(vote);
        } catch (RemoteException re) {
View Full Code Here

     * @see com.sun.jini.mahalo.Job
     * @see com.sun.jini.thread.TaskManager.Task
     */
    Object doWork(TaskManager.Task who, Object param) {
        ParticipantHandle handle = (ParticipantHandle)param;
        TransactionParticipant par = null;
        //check if a vote already exists because it was
        //recovered from the log. In this situation,
        //we do not need to log this info since it
        //exists in the log which was used for recovery...

        if (logger.isLoggable(Level.FINEST)) {
            logger.log(Level.FINEST,
                "AbortJob:doWork aborting handle: {0}", handle);
  }
  int vote = 0;
        vote = handle.getPrepState();
        switch (vote) {
            case NOTCHANGED:
            case ABORTED:
                return new Integer(ABORTED);
        }
        //Instruct the TransactionParticipant to roll back
        //after unpacking it and checking against the
        //max retry threshold.
        if (par == null)
            par = handle.getPreParedParticipant();
        //If you have exhausted the max retry threshold
        //stop, so that no further attempts are made.
  try {
            if (attempt(who) > maxtries) {
                return new Integer(ABORTED);
            }
  } catch (JobException je) {
      return null;
  }

        //At this point, if participant is null, there
        //must be an error unpacking, so retry later
        if (par == null)
            return null;
        //Here we actually need to instruct the participant to
        //roll back.  Note the RemoteException causes a
        //retry. Here we only log info for the cases
        //where a final outcome is available.
  //
  //Note: handle UnknownHostException and
  //      NoSuchObjectException (activation problem)
        Object response = null;
        try {
            par.abort(tr.mgr, tr.id);
            response = new Integer(ABORTED);
        } catch (TransactionException bte) {
            //The participant doesn't have record of the
            //transaction, so it must have already rolled
            //back.
View Full Code Here

     * @see com.sun.jini.mahalo.Job
     * @see com.sun.jini.thread.TaskManager.Task
     */
    Object doWork(TaskManager.Task who, Object param) {
        ParticipantHandle handle = (ParticipantHandle)param;
        TransactionParticipant par = null;

        //Check to see if participant has state associated
  //with it on account of being recovered from a log

        if (logger.isLoggable(Level.FINEST)) {
            logger.log(Level.FINEST,
                "CommitJob:doWork committing handle: {0}", handle);
  }

        int vote = handle.getPrepState();
        switch (vote) {
      case COMMITTED:
            case NOTCHANGED:
            case ABORTED:
                return new Integer(vote);
        }

        //Instruct the TransactionParticipant to roll forward
        //after unpacking it and checking against the
        //max retry threshold.

        if (par == null)
            par = handle.getPreParedParticipant();
        //If you have exhausted the max retry threshold
        //stop, so that no further attempts are made.
  try {
            if (attempt(who) >= maxtries) {
                return new Integer(COMMITTED);
            }
  } catch (JobException je) {
      return null;
  }
        //At this point, if participant is null, there
        //must be an error unpacking, so retry later
        if (par == null)
            return null;
        //Here we actually need to instruct the participant to
        //roll forward.  Note the RemoteException causes a
        //retry. Here we only log info for the cases
        //where a final outcome is available.
        Object response = null;
        try {
            par.commit(tr.mgr, tr.id);
            response = new Integer(COMMITTED);
        } catch (TransactionException bte) {
            //The participant doesn't have record of the
            //transaction, so it must have already rolled
            //forward.
View Full Code Here

        /*
         * create fake TransactionParticipant which
         * will prevent normal commit completion
         */
        TransactionParticipant tp = new ParticipantImpl();
        ((ServerTransaction) txn).join(tp, System.currentTimeMillis());

        // run thread which will prevent normal commit completion
        Committer committer = new Committer(tp, (ServerTransaction) txn,
                mgr);
View Full Code Here

TOP

Related Classes of net.jini.core.transaction.server.TransactionParticipant

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.