View Javadoc

1   /*
2    * $Id: Timeout.java 21549 2011-03-11 10:55:11Z pablo.kraan $
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.tck.probe;
12  
13  public class Timeout
14  {
15  
16      private final long duration;
17      private final long start;
18  
19      public Timeout(long duration)
20      {
21          this.duration = duration;
22          this.start = System.currentTimeMillis();
23      }
24  
25      public boolean hasTimedOut()
26      {
27          final long now = System.currentTimeMillis();
28          return (now - start) > duration;
29      }
30  }