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