View Javadoc
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.transport.servlet.jetty;
8   
9   import org.mortbay.util.ajax.Continuation;
10  
11  /**
12   * This class wraps a continuation object and provides a way to synchronize the access to it by a mutex lock object.
13   */
14  public class ContinuationsReplyTo
15  {
16      private Continuation continuation;
17      private Object mutex;
18  
19      public ContinuationsReplyTo(Continuation continuation, Object mutex)
20      {
21          this.continuation = continuation;
22          this.mutex = mutex;
23      }
24      
25      public void setAndResume(Object value)
26      {
27          synchronized(mutex)
28          {
29              continuation.setObject(value);
30              continuation.resume();
31          }
32      }
33  }
34  
35