Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package com.arjuna.wst11.messaging;
  
  import  org.jboss.ws.api.addressing.MAP;
The Participant processor.

Author(s):
kevin
 
 {
    
The activated object processor.
 
     private final ActivatedObjectProcessor activatedObjectProcessor = new ActivatedObjectProcessor() ;

    
Activate the participant.

Parameters:
participant The participant.
identifier The identifier.
 
     public void activateParticipant(final ParticipantInboundEvents participantfinal String identifier)
     {
         .activateObject(participantidentifier) ;
     }

    
Deactivate the participant.

Parameters:
participant The participant.
 
     public void deactivateParticipant(final ParticipantInboundEvents participant)
     {
         .deactivateObject(participant) ;
     }

    
Check whether a participant with the given id is currently active

Parameters:
identifier The identifier.
 
     public boolean isActive(final String identifier)
     {
         // if there is an entry in the table then it is active or completed and pending delete
 
         return (.getObject(identifier) != null);
     }

    
Get the participant with the specified identifier.

Parameters:
instanceIdentifier The participant identifier.
Returns:
The participant or null if not known.
 
     private ParticipantInboundEvents getParticipant(final InstanceIdentifier instanceIdentifier)
     {
         final String identifier = (instanceIdentifier != null ? instanceIdentifier.getInstanceIdentifier() : null) ;
         return (ParticipantInboundEvents).getObject(identifier) ;
     }

    
Commit.

Parameters:
commit The commit notification.
map The addressing context.
arjunaContext The arjuna context.
 
     public void commit(final Notification commitfinal MAP map,
         final ArjunaContext arjunaContext)
     {
         final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;

        
ensure the AT participant recovery manager is running
 
         XTSATRecoveryManager recoveryManager = XTSATRecoveryManager.getRecoveryManager();
 
         if (recoveryManager == null) {
             // log warning and drop this message -- it will be resent
 
             return;
         }
 
         final ParticipantInboundEvents participant = getParticipant(instanceIdentifier) ;
 
         if (participant != null)
         {
             try
             {
                 participant.commit(commitmaparjunaContext) ;
            }
            catch (final Throwable th) {
            }
        }
        else if (!recoveryManager.isParticipantRecoveryStarted()) {
        }
        else if (recoveryManager.findParticipantRecoveryRecord(instanceIdentifier.getInstanceIdentifier()) != null) {
        }
        else {
            sendCommitted(maparjunaContext);
        }
    }

    
Prepare.

Parameters:
prepare The prepare notification.
map The addressing context.
arjunaContext The arjuna context.
    public void prepare(final Notification preparefinal MAP map,
        final ArjunaContext arjunaContext)
    {
        final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
        final ParticipantInboundEvents participant = getParticipant(instanceIdentifier) ;
        if (participant != null)
        {
            try
            {
                participant.prepare(preparemaparjunaContext) ;
            }
            catch (final Throwable th) {
            }
        }
        else {
            sendAborted(maparjunaContext);
        }
    }

    
Rollback.

Parameters:
rollback The rollback notification.
map The addressing context.
arjunaContext The arjuna context.
    public void rollback(final Notification rollbackfinal MAP map,
        final ArjunaContext arjunaContext)
    {
        final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;

        
ensure the AT participant recovery manager is running
        XTSATRecoveryManager recoveryManager = XTSATRecoveryManager.getRecoveryManager();
        if (recoveryManager == null) {
            // log warning and drop this message -- it will be resent
        }
        final ParticipantInboundEvents participant = getParticipant(instanceIdentifier) ;
        if (participant != null)
        {
            try
            {
                participant.rollback(rollbackmaparjunaContext) ;
            }
            catch (final Throwable th) {
            }
        }
        else if (!recoveryManager.isParticipantRecoveryStarted()) {
        }
        else if (recoveryManager.findParticipantRecoveryRecord(instanceIdentifier.getInstanceIdentifier()) != null) {
        }
        else {
            sendAborted(maparjunaContext);
        }
    }

    
SOAP Fault.

Parameters:
fault The SOAP fault notification.
map The addressing context.
arjunaContext The arjuna context.
    public void soapFault(final SoapFault faultfinal MAP map,
        final ArjunaContext arjunaContext)
    {
        final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
        final ParticipantInboundEvents participant = getParticipant(instanceIdentifier) ;
        if (participant != null)
        {
            try
            {
                participant.soapFault(faultmaparjunaContext) ;
            }
            catch (final Throwable th) {
            }
        }
        else {
        }
    }

    
Send a committed message.

Parameters:
map The addressing context.
arjunaContext The arjuna context.
    private void sendCommitted(final MAP mapfinal ArjunaContext arjunaContext)
    {
        // KEV add check for recovery
        final String messageId = MessageId.getMessageId() ;
        final MAP responseMAP = AddressingHelper.createResponseContext(mapmessageId) ;
        final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
        try
        {
            CoordinatorClient.getClient().sendCommitted(nullresponseMAPinstanceIdentifier) ;
        }
        catch (final Throwable th)
        {
            if (..isTraceEnabled())
            {
                ..tracev("Unexpected exception while sending Committed"th) ;
            }
        }
    }

    
Send an aborted message.

Parameters:
map The addressing context.
arjunaContext The arjuna context.
    private void sendAborted(final MAP mapfinal ArjunaContext arjunaContext)
    {
        // KEV add check for recovery
        final String messageId = MessageId.getMessageId() ;
        final MAP responseMAP = AddressingHelper.createResponseContext(mapmessageId) ;
        final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
        try
        {
            CoordinatorClient.getClient().sendAborted(nullresponseMAPinstanceIdentifier) ;
        }
        catch (final Throwable th)
        {
            if (..isTraceEnabled())
            {
                ..tracev("Unexpected exception while sending Aborted"th) ;
            }
        }
    }
New to GrepCode? Check out our FAQ X