Coverage Report - org.mule.processor.OptionalAsyncInterceptingMessageProcessor
 
Classes in this File Line Coverage Branch Coverage Complexity
OptionalAsyncInterceptingMessageProcessor
0%
0/11
0%
0/8
0
 
 1  
 /*
 2  
  * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
 3  
  * The software in this package is published under the terms of the CPAL v1.0
 4  
  * license, a copy of which has been included with this distribution in the
 5  
  * LICENSE.txt file.
 6  
  */
 7  
 package org.mule.processor;
 8  
 
 9  
 import org.mule.api.MessagingException;
 10  
 import org.mule.api.MuleEvent;
 11  
 import org.mule.api.config.MuleProperties;
 12  
 import org.mule.api.config.ThreadingProfile;
 13  
 import org.mule.api.context.WorkManagerSource;
 14  
 
 15  
 /**
 16  
  * Implementation of {@link AsyncInterceptingMessageProcessor} which continues
 17  
  * processing in the same thread if the inbound endpoint has an exchange pattern that
 18  
  * has a response or if a transaction is present. Execution of the next message
 19  
  * processor is only passed off to another thread if this is not the case.
 20  
  */
 21  
 public class OptionalAsyncInterceptingMessageProcessor extends AsyncInterceptingMessageProcessor
 22  
 {
 23  
     public OptionalAsyncInterceptingMessageProcessor(WorkManagerSource workManagerSource)
 24  
     {
 25  0
         super(workManagerSource);
 26  0
     }
 27  
 
 28  
     @Deprecated
 29  
     public OptionalAsyncInterceptingMessageProcessor(WorkManagerSource workManagerSource, boolean doThreading)
 30  
     {
 31  0
         super(workManagerSource, doThreading);
 32  0
     }
 33  
 
 34  
     public OptionalAsyncInterceptingMessageProcessor(ThreadingProfile threadingProfile,
 35  
                                                      String name,
 36  
                                                      int shutdownTimeout)
 37  
     {
 38  0
         super(threadingProfile, name, shutdownTimeout);
 39  0
     }
 40  
 
 41  
     @Override
 42  
     protected boolean isProcessAsync(MuleEvent event) throws MessagingException
 43  
     {   
 44  0
         Object messageProperty = event.getMessage().getInboundProperty(MuleProperties.MULE_FORCE_SYNC_PROPERTY);
 45  0
         boolean forceSync = Boolean.TRUE.equals(messageProperty);
 46  
         
 47  0
         boolean hasResponse = event.getEndpoint().getExchangePattern().hasResponse();
 48  0
         boolean isTransacted = event.getEndpoint().getTransactionConfig().isTransacted();
 49  
         
 50  0
         return !forceSync && doThreading && !hasResponse && !isTransacted;
 51  
     }
 52  
 
 53  
 }