1 // ======================================================================== 2 // Copyright (c) 2004-2009 Mort Bay Consulting Pty. Ltd. 3 // ------------------------------------------------------------------------ 4 // All rights reserved. This program and the accompanying materials 5 // are made available under the terms of the Eclipse Public License v1.0 6 // and Apache License v2.0 which accompanies this distribution. 7 // The Eclipse Public License is available at 8 // http://www.eclipse.org/legal/epl-v10.html 9 // The Apache License v2.0 is available at 10 // http://www.opensource.org/licenses/apache2.0.php 11 // You may elect to redistribute this code under either of these licenses. 12 // ======================================================================== 13 14 package org.eclipse.jetty.io; 15 16 import org.eclipse.jetty.util.thread.Timeout; 17 18 public interface AsyncEndPoint extends ConnectedEndPoint 19 { 20 /* ------------------------------------------------------------ */ 21 /** 22 * Dispatch the endpoint to a thread to attend to it. 23 * 24 */ 25 public void asyncDispatch(); 26 27 /* ------------------------------------------------------------ */ 28 /** Schedule a write dispatch. 29 * Set the endpoint to not be writable and schedule a dispatch when 30 * it becomes writable. 31 */ 32 public void scheduleWrite(); 33 34 /* ------------------------------------------------------------ */ 35 /** Callback when idle. 36 * <p>An endpoint is idle if there has been no IO activity for 37 * {@link #getMaxIdleTime()} and {@link #isCheckForIdle()} is true. 38 * @param idleForMs TODO 39 */ 40 public void onIdleExpired(long idleForMs); 41 42 /* ------------------------------------------------------------ */ 43 /** Set if the endpoint should be checked for idleness 44 */ 45 public void setCheckForIdle(boolean check); 46 47 /* ------------------------------------------------------------ */ 48 /** Get if the endpoint should be checked for idleness 49 */ 50 public boolean isCheckForIdle(); 51 52 53 /* ------------------------------------------------------------ */ 54 public boolean isWritable(); 55 56 /* ------------------------------------------------------------ */ 57 /** 58 * @return True if IO has been successfully performed since the last call to {@link #hasProgressed()} 59 */ 60 public boolean hasProgressed(); 61 62 /* ------------------------------------------------------------ */ 63 /** 64 */ 65 public void scheduleTimeout(Timeout.Task task, long timeoutMs); 66 67 /* ------------------------------------------------------------ */ 68 /** 69 */ 70 public void cancelTimeout(Timeout.Task task); 71 }