org.jboss.netty.channel.ChannelState Maven / Gradle / Ivy
Show all versions of netty Show documentation
/*
* Copyright 2012 The Netty Project
*
* The Netty Project licenses this file to you under the Apache License,
* version 2.0 (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
package org.jboss.netty.channel;
import java.net.SocketAddress;
/**
* The current or future state of a {@link Channel}.
*
* The state of a {@link Channel} is interpreted differently depending on the
* {@linkplain ChannelStateEvent#getValue() value} of a {@link ChannelStateEvent}
* and the direction of the event in a {@link ChannelPipeline}:
*
*
*
* Direction State Value Meaning
*
*
* Upstream {@link #OPEN}
* {@code true} The channel is open.
*
*
* Upstream {@link #OPEN}
* {@code false} The channel is closed.
*
*
* Upstream {@link #BOUND}
* {@link SocketAddress} The channel is bound to a local address.
*
*
* Upstream {@link #BOUND}
* {@code null} The channel is unbound to a local address.
*
*
* Upstream {@link #CONNECTED}
* {@link SocketAddress} The channel is connected to a remote address.
*
*
* Upstream {@link #CONNECTED}
* {@code null} The channel is disconnected from a remote address.
*
*
* Upstream {@link #INTEREST_OPS}
* an integer The channel interestOps has been changed.
*
*
* Downstream {@link #OPEN}
* {@code true} N/A
*
*
* Downstream {@link #OPEN}
* {@code false} Close the channel.
*
*
* Downstream {@link #BOUND}
* {@link SocketAddress} Bind the channel to the specified local address.
*
*
* Downstream {@link #BOUND}
* {@code null} Unbind the channel from the current local address.
*
*
* Downstream {@link #CONNECTED}
* {@link SocketAddress} Connect the channel to the specified remote address.
*
*
* Downstream {@link #CONNECTED}
* {@code null} Disconnect the channel from the current remote address.
*
*
* Downstream {@link #INTEREST_OPS}
* an integer Change the interestOps of the channel.
*
*
*
* To see how an event is interpreted further, please refer to {@link ChannelEvent}.
*/
public enum ChannelState {
/**
* Represents a {@link Channel}'s {@link Channel#isOpen() open} property
*/
OPEN,
/**
* Represents a {@link Channel}'s {@link Channel#isBound() bound} property
*/
BOUND,
/**
* Represents a {@link Channel}'s {@link Channel#isConnected() connected}
* property
*/
CONNECTED,
/**
* Represents a {@link Channel}'s {@link Channel#getInterestOps() interestOps}
* property
*/
INTEREST_OPS
}