Mercurial Hosting > luan
view src/org/eclipse/jetty/util/thread/Timeout.java @ 942:c157a786ed0b
remove Timeout.Task
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 11 Oct 2016 00:41:39 -0600 |
parents | c948f674a2d5 |
children |
line wrap: on
line source
// // ======================================================================== // Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd. // ------------------------------------------------------------------------ // All rights reserved. This program and the accompanying materials // are made available under the terms of the Eclipse Public License v1.0 // and Apache License v2.0 which accompanies this distribution. // // The Eclipse Public License is available at // http://www.eclipse.org/legal/epl-v10.html // // The Apache License v2.0 is available at // http://www.opensource.org/licenses/apache2.0.php // // You may elect to redistribute this code under either of these licenses. // ======================================================================== // package org.eclipse.jetty.util.thread; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /* ------------------------------------------------------------ */ /** Timeout queue. * This class implements a timeout queue for timers that are at least as likely to be cancelled as they are to expire. * Unlike the util timeout class, the duration of the timeouts is shared by all scheduled tasks and if the duration * is changed, this affects all scheduled tasks. * <p> * The nested class Task should be extended by users of this class to obtain call back notification of * expires. */ public class Timeout { private static final Logger LOG = LoggerFactory.getLogger(Timeout.class); private Object _lock; private long _duration; private volatile long _now=System.currentTimeMillis(); /* ------------------------------------------------------------ */ public Timeout(Object lock) { _lock=lock; } /* ------------------------------------------------------------ */ /** * @return Returns the duration. */ public long getDuration() { return _duration; } /* ------------------------------------------------------------ */ /** * @param duration The duration to set. */ public void setDuration(long duration) { _duration = duration; } /* ------------------------------------------------------------ */ public long setNow() { return _now=System.currentTimeMillis(); } public long getNow() { return _now; } public void setNow(long now) { _now=now; } }