Coverage Report - org.mule.util.concurrent.AbstractSynchronizedVariable
 
Classes in this File Line Coverage Branch Coverage Complexity
AbstractSynchronizedVariable
0%
0/11
N/A
1
 
 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.util.concurrent;
 8  
 
 9  
 import edu.emory.mathcs.backport.java.util.concurrent.Executor;
 10  
 
 11  
 // @ThreadSafe
 12  
 public abstract class AbstractSynchronizedVariable implements Executor
 13  
 {
 14  
     // @GuardedBy(itself)
 15  
     protected final Object lock;
 16  
 
 17  
     public AbstractSynchronizedVariable()
 18  
     {
 19  0
         super();
 20  0
         lock = this;
 21  0
     }
 22  
 
 23  
     public AbstractSynchronizedVariable(Object lock)
 24  
     {
 25  0
         super();
 26  0
         this.lock = lock;
 27  0
     }
 28  
 
 29  
     public Object getLock()
 30  
     {
 31  0
         return lock;
 32  
     }
 33  
 
 34  
     public void execute(Runnable command)
 35  
     {
 36  0
         synchronized (lock)
 37  
         {
 38  0
             command.run();
 39  0
         }
 40  0
     }
 41  
 
 42  
 }