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.tck.probe;
8   
9   public class Timeout
10  {
11  
12      private final long duration;
13      private final long start;
14  
15      public Timeout(long duration)
16      {
17          this.duration = duration;
18          this.start = System.currentTimeMillis();
19      }
20  
21      public boolean hasTimedOut()
22      {
23          final long now = System.currentTimeMillis();
24          return (now - start) > duration;
25      }
26  }