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 Coordinator processor.

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

    
Activate the coordinator.

Parameters:
coordinator The coordinator.
identifier The identifier.
 
     public void activateCoordinator(final CoordinatorInboundEvents coordinatorfinal String identifier)
     {
         .activateObject(coordinatoridentifier) ;
     }

    
Deactivate a coordinator recovered from the log.

Parameters:
coordinator The coordinator.
 
     public void deactivateCoordinator(CoordinatorInboundEvents coordinator) {
         .deactivateObject(coordinator);
     }

    
Get the coordinator with the specified identifier.

Parameters:
identifier The coordinator identifier as a String.
Returns:
The coordinator or null if not known.
 
 
     public CoordinatorInboundEvents getCoordinator(final String identifier)
     {
         return (CoordinatorInboundEvents).getObject(identifier) ;
     }
    
Get the coordinator with the specified identifier.

Parameters:
instanceIdentifier The coordinator identifier as an Instanceidentifier.
Returns:
The coordinator or null if not known.
 
     private CoordinatorInboundEvents getCoordinator(final InstanceIdentifier instanceIdentifier)
     {
         final String identifier = (instanceIdentifier != null ? instanceIdentifier.getInstanceIdentifier() : null) ;
         return getCoordinator(identifier);
     }

    
Aborted.

Parameters:
aborted The aborted notification.
map The addressing context.
arjunaContext The arjuna context.
 
     public void aborted(final Notification abortedfinal MAP map,
         final ArjunaContext arjunaContext)
     {
         final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
         final CoordinatorInboundEvents coordinator = getCoordinator(instanceIdentifier) ;
 
         if (coordinator != null) {
             try {
                 coordinator.aborted(abortedmaparjunaContext);
             }
             catch (final Throwable th) {
             }
         } else {
         }
     }

    
Committed.

Parameters:
committed The committed notification.
map The addressing context.
arjunaContext The arjuna context.
    public void committed(final Notification committedfinal MAP map,
        final ArjunaContext arjunaContext)
    {
        final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
        final CoordinatorInboundEvents coordinator = getCoordinator(instanceIdentifier) ;
        if (coordinator != null) {
            try {
                coordinator.committed(committedmaparjunaContext);
            }
            catch (final Throwable th) {
            }
        } else {
        }
    }

    
Prepared.

Parameters:
prepared The prepared notification.
map The addressing context.
arjunaContext The arjuna context.
    public void prepared(final Notification preparedfinal MAP map,
        final ArjunaContext arjunaContext)
    {
        final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
        final CoordinatorInboundEvents coordinator = getCoordinator(instanceIdentifier) ;
        if (coordinator != null)
        {
            try
            {
                coordinator.prepared(preparedmaparjunaContext) ;
            }
            catch (final Throwable th) {
            }
        }
        else if (areRecoveryLogEntriesAccountedFor()) {
            final String identifierValue = instanceIdentifier.getInstanceIdentifier();
            if ((identifierValue != null) && (identifierValue.length() > 0) && (identifierValue.charAt(0) == 'D')) {
                sendRollback(maparjunaContext);
            } else {
                sendUnknownTransaction(maparjunaContext);
            }
        }
        else {
            // there may be a participant stub waiting to be recovered from the log so drop the
            // message, forcing the caller to retry
        }
    }

    
Read only.

Parameters:
readOnly The read only notification.
map The addressing context.
arjunaContext The arjuna context.
    public void readOnly(final Notification readOnlyfinal MAP map,
        final ArjunaContext arjunaContext)
    {
        final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
        final CoordinatorInboundEvents coordinator = getCoordinator(instanceIdentifier) ;
        if (coordinator != null) {
            try {
                coordinator.readOnly(readOnlymaparjunaContext);
            }
            catch (final Throwable th) {
            }
        } else {
        }
    }

    
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 CoordinatorInboundEvents coordinator = getCoordinator(instanceIdentifier) ;
        if (coordinator != null)
        {
            try
            {
                coordinator.soapFault(faultmaparjunaContext) ;
            }
            catch (final Throwable th) {
            }
        }
        else {
        }
    }

    
Send an unknown transaction fault.

Parameters:
map The addressing context.
arjunaContext The arjuna context.
    private void sendUnknownTransaction(final MAP mapfinal ArjunaContext arjunaContext)
    {
        // KEV add check for recovery
        final MAP faultAddressingContext = AddressingHelper.createFaultContext(map, MessageId.getMessageId()) ;
        final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
        try {
            ParticipantClient.getClient().sendSoapFault(faultAddressingContextsoapFaultinstanceIdentifier) ;
        } catch (final Throwable th) {
            if (..isTraceEnabled())
            {
                ..tracev("Unexpecting exception while sending InvalidState"th) ;
            }
        }
    }

    
Send a rollback message.

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

    
Tests if there may be unknown coordinator entries in the recovery log.

Returns:
false if there may be unknown coordinator entries in the recovery log.
    private static boolean areRecoveryLogEntriesAccountedFor()
    {
        return XTSATRecoveryManager.getRecoveryManager().isCoordinatorRecoveryStarted();
    }
New to GrepCode? Check out our FAQ X