public class NetListen extends AttributeChannel<NetListen>
| 限定符和类型 | 字段和说明 |
|---|---|
protected AsynchronousServerSocketChannel |
channel |
protected net.hasor.cobble.concurrent.future.Future<NetListen> |
closeFuture |
protected AtomicBoolean |
closeStatus |
| 限定符和类型 | 方法和说明 |
|---|---|
NetListen |
addListener(NetListener listener)
add
NetListener |
net.hasor.cobble.concurrent.future.Future<NetListen> |
close()
close this channel.
|
net.hasor.cobble.concurrent.future.Future<NetListen> |
closeNow()
close this channel now.
|
NetChannel |
findChannel(long channelID)
Search for NetChannel by id,
return null if NetChannel is not from this NetListen
|
<T> T |
findPipeContext(Class<T> serviceType)
Get the attachment for
PipeContext |
long |
getChannelCount()
get channel Count
|
long |
getChannelID()
channel id
|
SoContext |
getContext()
get context
|
long |
getCreatedTime()
channel accept time
|
long |
getLastAcceptTime()
The last time for accepted channel.
|
long |
getLastActiveTime()
The last time data was received or sent
|
int |
getListenPort()
return this listener bind socket port.
|
SocketAddress |
getLocalAddr()
local
SocketAddress |
SocketAddress |
getRemoteAddr()
get remote address of the channel
|
boolean |
isClient()
a connect
NetChannel |
boolean |
isClose()
return close status.
|
boolean |
isListen()
|
boolean |
isServer()
an accept
NetChannel |
boolean |
isSuspend()
Returns the listener current suspend status.
|
void |
notifyError(Throwable e) |
NetListen |
removeListener(NetListener listener)
remove
NetListener |
NetListen |
resume()
set suspend is false
all new accept socket will be closed when suspend = true.
|
NetListen |
suspend()
set suspend is true
all new accept socket will be closed when suspend = true.
|
boolean |
waitAnyAccept()
Wait for an incoming.
|
boolean |
waitAnyNewAccept()
Wait for an new incoming.
|
boolean |
waitIdle()
Wait for all disconnection.
|
getAttribute, setAttributeprotected final AsynchronousServerSocketChannel channel
protected final AtomicBoolean closeStatus
protected final net.hasor.cobble.concurrent.future.Future<NetListen> closeFuture
public long getChannelID()
SoChannelpublic long getCreatedTime()
SoChannelpublic long getLastActiveTime()
SoChannelpublic long getLastAcceptTime()
public long getChannelCount()
public boolean isListen()
SoChannelpublic boolean isServer()
SoChannelNetChannelpublic boolean isClient()
SoChannelNetChannelpublic SocketAddress getLocalAddr()
SoChannelSocketAddresspublic SocketAddress getRemoteAddr()
SoChannelpublic NetChannel findChannel(long channelID)
public <T> T findPipeContext(Class<T> serviceType)
SoChannelPipeContextpublic boolean isSuspend()
all new accept socket will be closed when suspend = true.
public NetListen suspend()
all new accept socket will be closed when suspend = true.
public NetListen resume()
all new accept socket will be closed when suspend = true.
public int getListenPort()
public NetListen addListener(NetListener listener)
NetListenerpublic NetListen removeListener(NetListener listener)
NetListenerpublic boolean isClose()
SoChannelpublic net.hasor.cobble.concurrent.future.Future<NetListen> close()
SoChannelThe SoChannel.closeNow() and SoChannel.close() methods are valid if they are called first
public net.hasor.cobble.concurrent.future.Future<NetListen> closeNow()
SoChannelpublic void notifyError(Throwable e)
public boolean waitAnyAccept()
public boolean waitAnyNewAccept()
public boolean waitIdle()
Copyright © 2022–2024. All rights reserved.