1 /*
2  *  Licensed to the Apache Software Foundation (ASF) under one or more
3  *  contributor license agreements.  See the NOTICE file distributed with
4  *  this work for additional information regarding copyright ownership.
5  *  The ASF licenses this file to You under the Apache License, Version 2.0
6  *  (the "License"); you may not use this file except in compliance with
7  *  the License.  You may obtain a copy of the License at
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
11  *  Unless required by applicable law or agreed to in writing, software
12  *  distributed under the License is distributed on an "AS IS" BASIS,
13  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  *  See the License for the specific language governing permissions and
15  *  limitations under the License.
16  */

17 package org.apache.tomcat.util.net;
18
19 /**
20  * Defines events that occur per socket that require further processing by the
21  * container. Usually these events are triggered by the socket implementation
22  * but they may be triggered by the container.
23  */

24 public enum SocketEvent {
25
26     /**
27      * Data is available to be read.
28      */

29     OPEN_READ,
30
31     /**
32      * The socket is ready to be written to.
33      */

34     OPEN_WRITE,
35
36     /**
37      * The associated Connector/Endpoint is stopping and the connection/socket
38      * needs to be closed cleanly.
39      */

40     STOP,
41
42     /**
43      * A timeout has occurred and the connection needs to be closed cleanly.
44      * Currently this is only used by the Servlet 3.0 async processing.
45      */

46     TIMEOUT,
47
48     /**
49      * The client has disconnected.
50      */

51     DISCONNECT,
52
53     /**
54      * An error has occurred on a non-container thread and processing needs to
55      * return to the container for any necessary clean-up. Examples of where
56      * this is used include:
57      * <ul>
58      * <li>by NIO2 to signal the failure of a completion handler</li>
59      * <li>by the container to signal an I/O error on a non-container thread
60      *     during Servlet 3.0 asynchronous processing.</li>
61      * </ul>
62      */

63     ERROR,
64
65     /**
66      * A client attempted to establish a connection but failed. Examples of
67      * where this is used include:
68      * <ul>
69      * <li>TLS handshake failures</li>
70      * </ul>
71      */

72     CONNECT_FAIL
73 }
74