Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * JBoss, Home of Professional Open Source
   * Copyright 2006, Red Hat Middleware LLC, and individual contributors
   * as indicated by the @author tags. 
   * See the copyright.txt in the distribution for a full listing 
   * of individual contributors.
   * This copyrighted material is made available to anyone wishing to use,
   * modify, copy, or redistribute it subject to the terms and conditions
   * of the GNU Lesser General Public License, v. 2.1.
  * This program is distributed in the hope that it will be useful, but WITHOUT A
  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
  * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
  * You should have received a copy of the GNU Lesser General Public License,
  * v.2.1 along with this distribution; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  * MA  02110-1301, USA.
  * 
  * (C) 2005-2006,
  * @author JBoss Inc.
  */
 /*
  * Copyright (C) 2002,
  *
  * Arjuna Technologies Limited,
  * Newcastle upon Tyne,
  * Tyne and Wear,
  * UK.
  *
  * $Id: ACCoordinator.java,v 1.7 2005/06/09 09:41:27 nmcl Exp $
  */
 
 package com.arjuna.mwlabs.wscf.model.twophase.arjunacore;
 
 
 
 
 
 
 
 
This class represents a specific coordination instance. It is essentially an ArjunaCore TwoPhaseCoordinator, which gives us access to two-phase with synchronization support but without thread management.

Author(s):
Mark Little (mark.little@arjuna.com)
Version:
$Id: ACCoordinator.java,v 1.7 2005/06/09 09:41:27 nmcl Exp $
Since:
1.0.
 
 
 public class ATCoordinator extends TwoPhaseCoordinator
 {
 
 	private final static int ROLLEDBACK = 0;
 	private final static int READONLY = 1;
 
 	public ATCoordinator()
 	{
 		super();
 	
 	}
 
 	public ATCoordinator(Uid recovery)
 	{
 		super(recovery);
 				
 	}

    
If the application requires and if the coordination protocol supports it, then this method can be used to execute a coordination protocol on the currently enlisted participants at any time prior to the termination of the coordination scope. This implementation only supports coordination at the end of the activity.

Returns:
The result of executing the protocol, or null.
Throws:
WrongStateException Thrown if the coordinator is in a state the does not allow coordination to occur.
ProtocolViolationException Thrown if the protocol is violated in some manner during execution.
SystemException Thrown if any other error occurs.
	{
		return null;
	}

Enrol the specified participant with the coordinator associated with the current thread.

Parameters:
act The participant.
Throws:
WrongStateException Thrown if the coordinator is not in a state that allows participants to be enrolled.
DuplicateParticipantException Thrown if the participant has already been enrolled and the coordination protocol does not support multiple entries.
InvalidParticipantException Thrown if the participant is invalid.
SystemException Thrown if any other error occurs.
	public void enlistParticipant (Participant actthrows WrongStateException,
	{		
		if (act == null)
		AbstractRecord rec = new ParticipantRecord(actnew Uid());
		if (add(rec) != .)
			throw new WrongStateException();
	}

Remove the specified participant from the coordinator's list.

Throws:
InvalidParticipantException Thrown if the participant is not known of by the coordinator.
WrongStateException Thrown if the state of the coordinator does not allow the participant to be removed (e.g., in a two-phase protocol the coordinator is committing.)
SystemException Thrown if any other error occurs.
	public void delistParticipant (Participant act)
	{
		if (act == null)
		else
                    ..get_model_twophase_arjunacore_ATCoordinator_1());
	}

Enrol the specified synchronization with the coordinator associated with the current thread.

Parameters:
act The synchronization to add.
Throws:
WrongStateException Thrown if the coordinator is not in a state that allows participants to be enrolled.
DuplicateSynchronizationException Thrown if the participant has already been enrolled and the coordination protocol does not support multiple entries.
InvalidSynchronizationException Thrown if the participant is invalid.
SystemException Thrown if any other error occurs.
	{
		if (act == null)
		SynchronizationRecord rec = new SynchronizationRecord(actnew Uid());
			throw new WrongStateException();
	}

Remove the specified synchronization from the coordinator's list.

Throws:
InvalidSynchronizationException Thrown if the participant is not known of by the coordinator.
WrongStateException Thrown if the state of the coordinator does not allow the participant to be removed (e.g., in a two-phase protocol the coordinator is committing.)
SystemException Thrown if any other error occurs.
	{
		if (act == null)
		else
                    ..get_model_twophase_arjunacore_ATCoordinator_1());
	}

Returns:
the complete list of qualifiers that have been registered with the current coordinator.
Throws:
SystemException Thrown if any error occurs.
	public Qualifier[] qualifiers () throws SystemException
	{
		return null;
	}

Returns:
The unique identity of the current coordinator.
Throws:
SystemException Thrown if any error occurs.
	{
		return ;
	}
	public synchronized void participantRolledBack (String participantId)
	{
		if (participantId == null)
			throw new SystemException(
                    ..get_model_twophase_arjunacore_ATCoordinator_2());
		else
			throw new WrongStateException();
	}
	public synchronized void participantReadOnly (String participantId)
	{
		if (participantId == null)
			throw new SystemException(
                    ..get_model_twophase_arjunacore_ATCoordinator_2());
		{
		}
		else
			throw new SystemException(
                    ..get_model_twophase_arjunacore_ATCoordinator_3());
	}
    @Override
    public String type ()
	{
		return "/StateManager/BasicAction/AtomicAction/TwoPhaseCoordinator/TwoPhase/ATCoordinator";
	}
	private final void changeParticipantStatus (String participantIdint status)
	{
		/*
		 * Transaction is active, so we can look at the pendingList only.
		 */
		// TODO allow transaction status to be changed during commit - exit
		// could come in late
		boolean found = false;
		if ( != null)
		{
			AbstractRecord absRec = iter.iterate();
			try
			{
				while ((absRec != null) && !found)
				{
					if (absRec instanceof ParticipantRecord)
					{
						Participant participant = (Participantpr.value();
						if (participantId.equals(participant.id()))
						{
							found = true;
							if (status == )
							else
						}
					}
					absRec = iter.iterate();
				}
			}
			catch (Exception ex)
			{
				throw new SystemException(ex.toString());
			}
		}
		if (!found)
	}
New to GrepCode? Check out our FAQ X