Coverage Report - org.mule.impl.OptimizedRequestContext
 
Classes in this File Line Coverage Branch Coverage Complexity
OptimizedRequestContext
0%
0/8
N/A
1
 
 1  
 /*
 2  
  * $Id: OptimizedRequestContext.java 7976 2007-08-21 14:26:13Z dirk.olmes $
 3  
  * --------------------------------------------------------------------------------------
 4  
  * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.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.impl;
 12  
 
 13  
 import org.mule.umo.UMOEvent;
 14  
 import org.mule.umo.UMOMessage;
 15  
 
 16  
 /**
 17  
  * NOT FOR POUBLIC USE - please use the interface provided by RequestContext.
 18  
  * This is a temporary interface that helps provide an (optimized) fix for message
 19  
  * scribbling.
 20  
  *
 21  
  * <p>Mutating methods have three versions: default (RequestContext; makes and returns a new copy);
 22  
  * unsafe (doesn't make a copy, use only where certain no threading); critical (as safe, but
 23  
  * documents that threading a known issue).</p>
 24  
  */
 25  
 public final class OptimizedRequestContext
 26  
 {
 27  
 
 28  
     /**
 29  
      * Do not instanciate.
 30  
      */
 31  
     private OptimizedRequestContext()
 32  
     {
 33  0
         super();
 34  0
     }
 35  
 
 36  
     /**
 37  
      * Set an event for out-of-scope thread access.  Unsafe: use only when known to be single threaded.
 38  
      *
 39  
      * @param event - the event to set
 40  
      * @return The event set
 41  
      */
 42  
     public static UMOEvent unsafeSetEvent(UMOEvent event)
 43  
     {
 44  0
         return RequestContext.internalSetEvent(event);
 45  
     }
 46  
 
 47  
     /**
 48  
      * Set an event for out-of-scope thread access.  Critical: thread safety known to be required
 49  
      *
 50  
      * @param event - the event to set
 51  
      * @return A new mutable copy of the event set
 52  
      */
 53  
     public static UMOEvent criticalSetEvent(UMOEvent event)
 54  
     {
 55  0
         return RequestContext.internalSetEvent(RequestContext.newEvent(event, true, true));
 56  
     }
 57  
 
 58  
     /**
 59  
      * Sets a new message payload in the RequestContext but maintains all other
 60  
      * properties (session, endpoint, synchronous, etc.) from the previous event.
 61  
      * Unsafe: use only when known to be single threaded
 62  
      *
 63  
      * @param message - the new message payload
 64  
      * @return The message set
 65  
      */
 66  
     public static UMOMessage unsafeRewriteEvent(UMOMessage message)
 67  
     {
 68  0
         return RequestContext.internalRewriteEvent(message, false, false);
 69  
     }
 70  
 
 71  
     /**
 72  
      * Sets a new message payload in the RequestContext but maintains all other
 73  
      * properties (session, endpoint, synchronous, etc.) from the previous event.
 74  
      * Critical: thread safety known to be required
 75  
      *
 76  
      * @param message - the new message payload
 77  
      * @return A new copy of the message set
 78  
      */
 79  
     public static UMOMessage criticalRewriteEvent(UMOMessage message)
 80  
     {
 81  0
         return RequestContext.internalRewriteEvent(message, true, true);
 82  
     }
 83  
 
 84  
     public static UMOMessage unsafeWriteResponse(UMOMessage message)
 85  
     {
 86  0
         return RequestContext.internalWriteResponse(message, false, false);
 87  
     }
 88  
 
 89  
     public static UMOMessage criticalWriteResponse(UMOMessage message)
 90  
     {
 91  0
         return RequestContext.internalWriteResponse(message, true, true);
 92  
     }
 93  
 
 94  
 }