- java.lang.Object
-
- io.netty5.channel.DefaultChannelPipeline
-
- All Implemented Interfaces:
ChannelInboundInvoker,ChannelOutboundInvoker,ChannelPipeline,FuturePromiseFactory,Iterable<Map.Entry<String,ChannelHandler>>
- Direct Known Subclasses:
AbstractChannel.DefaultAbstractChannelPipeline
public abstract class DefaultChannelPipeline extends Object implements ChannelPipeline
The defaultChannelPipelineimplementation. It is usually created by aChannelimplementation when theChannelis created.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedDefaultChannelPipeline(Channel channel)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description ChannelPipelineaddAfter(String baseName, String name, ChannelHandler handler)Inserts aChannelHandlerafter an existing handler of this pipeline.ChannelPipelineaddBefore(String baseName, String name, ChannelHandler handler)Inserts aChannelHandlerbefore an existing handler of this pipeline.ChannelPipelineaddFirst(ChannelHandler handler)ChannelPipelineaddFirst(ChannelHandler... handlers)InsertsChannelHandlers at the first position of this pipeline.ChannelPipelineaddFirst(String name, ChannelHandler handler)Inserts aChannelHandlerat the first position of this pipeline.ChannelPipelineaddLast(ChannelHandler handler)ChannelPipelineaddLast(ChannelHandler... handlers)InsertsChannelHandlers at the last position of this pipeline.ChannelPipelineaddLast(String name, ChannelHandler handler)Appends aChannelHandlerat the last position of this pipeline.Future<Void>bind(SocketAddress localAddress)Request to bind to the givenSocketAddressand notify theFutureonce the operation completes, either because the operation was successful or because of an error.protected abstract voidbindTransport(SocketAddress localAddress, Promise<Void> promise)Bind theSocketAddressto the transport and notify thePromiseonce the operation was completed.Channelchannel()Returns theChannelthat this pipeline is attached to.Future<Void>close()protected abstract voidcloseTransport(Promise<Void> promise)Close the transport and notify thePromiseonce the operation was completed.Future<Void>connect(SocketAddress remoteAddress)Request to connect to the givenSocketAddressand notify theFutureonce the operation completes, either because the operation was successful or because of an error.Future<Void>connect(SocketAddress remoteAddress, SocketAddress localAddress)Request to connect to the givenSocketAddresswhile bind to the localAddress and notify theFutureonce the operation completes, either because the operation was successful or because of an error.protected abstract voidconnectTransport(SocketAddress remoteAddress, SocketAddress localAddress, Promise<Void> promise)Connect the transport with the given remoteSocketAddress.ChannelHandlerContextcontext(ChannelHandler handler)Returns the context object of the specifiedChannelHandlerin this pipeline.ChannelHandlerContextcontext(Class<? extends ChannelHandler> handlerType)Returns the context object of theChannelHandlerof the specified type in this pipeline.ChannelHandlerContextcontext(String name)Returns the context object of theChannelHandlerwith the specified name in this pipeline.Future<Void>deregister()Request to deregister from the previous assignedEventExecutorand notify theFutureonce the operation completes, either because the operation was successful or because of an error.protected abstract voidderegisterTransport(Promise<Void> promise)Future<Void>disconnect()Request to disconnect from the remote peer and notify theFutureonce the operation completes, either because the operation was successful or because of an error.protected abstract voiddisconnectTransport(Promise<Void> promise)Disconnect the transport and notify thePromiseonce the operation was completed.EventExecutorexecutor()Returns theEventExecutorthat is used to execute the operations of thisChannelOutboundInvoker.ChannelPipelinefireChannelActive()AChannelis active now, which means it is connected.ChannelPipelinefireChannelExceptionCaught(Throwable cause)ChannelPipelinefireChannelInactive()AChannelis inactive now, which means it is closed.ChannelPipelinefireChannelInboundEvent(Object event)AChannelreceived a custom defined inbound event.ChannelPipelinefireChannelRead(Object msg)AChannelreceived a message.ChannelPipelinefireChannelReadComplete()Triggers anChannelHandler.channelReadComplete(ChannelHandlerContext)event to the nextChannelHandlerin theChannelPipeline.ChannelPipelinefireChannelRegistered()ChannelPipelinefireChannelShutdown(ChannelShutdownDirection direction)AChannelwas shutdown in a specific direction.ChannelPipelinefireChannelUnregistered()ChannelPipelinefireChannelWritabilityChanged()Triggers anChannelHandler.channelWritabilityChanged(ChannelHandlerContext)event to the nextChannelHandlerin theChannelPipeline.ChannelHandlerfirst()Returns the firstChannelHandlerin this pipeline.ChannelHandlerContextfirstContext()Returns the context of the firstChannelHandlerin this pipeline.ChannelPipelineflush()Request to flush all pending messages via this ChannelOutboundInvoker.protected abstract voidflushTransport()Flush out all (previous) scheduled write operations, scheduled viawriteTransport(Object, Promise).<T extends ChannelHandler>
Tget(Class<T> handlerType)Returns theChannelHandlerof the specified type in this pipeline.ChannelHandlerget(String name)Returns theChannelHandlerwith the specified name in this pipeline.Iterator<Map.Entry<String,ChannelHandler>>iterator()ChannelHandlerlast()Returns the lastChannelHandlerin this pipeline.ChannelHandlerContextlastContext()Returns the context of the lastChannelHandlerin this pipeline.List<String>names()Returns theListof the handler names.<V> Future<V>newFailedFuture(Throwable cause)Create a newFuturewhich is marked as failed already.<V> Promise<V>newPromise()Return a newPromise.Future<Void>newSucceededFuture()Create a newFuturewhich is marked as succeeded already.<V> Future<V>newSucceededFuture(V value)Create a newFuturewhich is marked as succeeded already.protected voidonUnhandledChannelInboundEvent(Object evt)Called once an user event hit the end of theChannelPipelinewithout been handled by the user inChannelHandler.channelInboundEvent(ChannelHandlerContext, Object).protected voidonUnhandledChannelWritabilityChanged()Called once theChannelHandler.channelWritabilityChanged(ChannelHandlerContext)event hit the end of theChannelPipeline.protected voidonUnhandledInboundChannelActive()Called once theChannelHandler.channelActive(ChannelHandlerContext)event hit the end of theChannelPipeline.protected voidonUnhandledInboundChannelInactive()Called once theChannelHandler.channelInactive(ChannelHandlerContext)event hit the end of theChannelPipeline.protected voidonUnhandledInboundChannelReadComplete()Called once theChannelHandler.channelReadComplete(ChannelHandlerContext)event hit the end of theChannelPipeline.protected voidonUnhandledInboundChannelShutdown(ChannelShutdownDirection direction)Called once theChannelHandler.channelShutdown(ChannelHandlerContext, ChannelShutdownDirection)event hit the end of theChannelPipeline.protected voidonUnhandledInboundException(Throwable cause)Called once aThrowablehit the end of theChannelPipelinewithout been handled by the user inChannelHandler.channelExceptionCaught(ChannelHandlerContext, Throwable).protected voidonUnhandledInboundMessage(ChannelHandlerContext ctx, Object msg)Called once a message hit the end of theChannelPipelinewithout been handled by the user inChannelHandler.channelRead(ChannelHandlerContext, Object).longpendingOutboundBytes()The number of the outbound bytes that are buffered / queued in thisChannelPipeline.protected abstract voidpendingOutboundBytesUpdated(long pendingOutboundBytes)Called once thependingOutboundBytes()were changed.ChannelPipelineread()Request to Read data from theChannelinto the first inbound buffer, triggers anChannelHandler.channelRead(ChannelHandlerContext, Object)event if data was read, and triggers achannelReadCompleteevent so the handler can decide to continue reading.protected abstract voidreadTransport()Schedules a read operation on the transport that fills the inbound buffer of the firstChannelHandlerin theChannelPipeline.Future<Void>register()Request to register on theEventExecutorfor I/O processing.protected abstract voidregisterTransport(Promise<Void> promise)Register the transport and notify thePromiseonce the operation was completed.ChannelPipelineremove(ChannelHandler handler)Removes the specifiedChannelHandlerfrom this pipeline.<T extends ChannelHandler>
Tremove(Class<T> handlerType)Removes theChannelHandlerof the specified type from this pipeline.ChannelHandlerremove(String name)Removes theChannelHandlerwith the specified name from this pipeline.ChannelHandlerremoveFirst()Removes the firstChannelHandlerin this pipeline.<T extends ChannelHandler>
TremoveIfExists(ChannelHandler handler)Removes the specifiedChannelHandlerfrom this pipeline if it exists<T extends ChannelHandler>
TremoveIfExists(Class<T> handlerType)Removes theChannelHandlerof the specified type from this pipeline if it exists.<T extends ChannelHandler>
TremoveIfExists(String name)Removes theChannelHandlerwith the specified name from this pipeline if it exists.ChannelHandlerremoveLast()Removes the lastChannelHandlerin this pipeline.ChannelPipelinereplace(ChannelHandler oldHandler, String newName, ChannelHandler newHandler)Replaces the specifiedChannelHandlerwith a new handler in this pipeline.<T extends ChannelHandler>
Treplace(Class<T> oldHandlerType, String newName, ChannelHandler newHandler)Replaces theChannelHandlerof the specified type with a new handler in this pipeline.ChannelHandlerreplace(String oldName, String newName, ChannelHandler newHandler)Replaces theChannelHandlerof the specified name with a new handler in this pipeline.Future<Void>sendOutboundEvent(Object event)Send a custom outbound event via thisChannelOutboundInvokerthrough theChannelPipeline.protected abstract voidsendOutboundEventTransport(Object event, Promise<Void> promise)Send a custom outbound event on the transport.Future<Void>shutdown(ChannelShutdownDirection direction)protected abstract voidshutdownTransport(ChannelShutdownDirection direction, Promise<Void> promise)Shutdown the given direction of the transport and notify thePromiseonce the operation was completed.Map<String,ChannelHandler>toMap()Converts this pipeline into an orderedMapwhose keys are handler names and whose values are handlers.StringtoString()Returns theStringrepresentation of this pipeline.protected abstract EventExecutortransportExecutor()Returns theEventExecutorthat is used for all the abstract transport operations.Future<Void>write(Object msg)Request to write a message via thisChannelHandlerContextthrough theChannelPipeline.Future<Void>writeAndFlush(Object msg)Shortcut for callChannelOutboundInvoker.write(Object)andChannelOutboundInvoker.flush().protected abstract voidwriteTransport(Object msg, Promise<Void> promise)Schedules a write operation on the transport.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface io.netty5.channel.ChannelPipeline
isEmpty
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
DefaultChannelPipeline
protected DefaultChannelPipeline(Channel channel)
-
-
Method Detail
-
channel
public final Channel channel()
Description copied from interface:ChannelPipelineReturns theChannelthat this pipeline is attached to.- Specified by:
channelin interfaceChannelPipeline- Returns:
- the channel.
nullif this pipeline is not attached yet.
-
executor
public final EventExecutor executor()
Description copied from interface:ChannelOutboundInvokerReturns theEventExecutorthat is used to execute the operations of thisChannelOutboundInvoker.- Specified by:
executorin interfaceChannelOutboundInvoker- Returns:
- the executor.
-
addFirst
public final ChannelPipeline addFirst(String name, ChannelHandler handler)
Description copied from interface:ChannelPipelineInserts aChannelHandlerat the first position of this pipeline.- Specified by:
addFirstin interfaceChannelPipeline- Parameters:
name- the name of the handler to insert firsthandler- the handler to insert first
-
addLast
public final ChannelPipeline addLast(String name, ChannelHandler handler)
Description copied from interface:ChannelPipelineAppends aChannelHandlerat the last position of this pipeline.- Specified by:
addLastin interfaceChannelPipeline- Parameters:
name- the name of the handler to appendhandler- the handler to append
-
addBefore
public final ChannelPipeline addBefore(String baseName, String name, ChannelHandler handler)
Description copied from interface:ChannelPipelineInserts aChannelHandlerbefore an existing handler of this pipeline.- Specified by:
addBeforein interfaceChannelPipeline- Parameters:
baseName- the name of the existing handlername- the name of the handler to insert beforehandler- the handler to insert before
-
addAfter
public final ChannelPipeline addAfter(String baseName, String name, ChannelHandler handler)
Description copied from interface:ChannelPipelineInserts aChannelHandlerafter an existing handler of this pipeline.- Specified by:
addAfterin interfaceChannelPipeline- Parameters:
baseName- the name of the existing handlername- the name of the handler to insert afterhandler- the handler to insert after
-
addFirst
public final ChannelPipeline addFirst(ChannelHandler handler)
-
addFirst
public final ChannelPipeline addFirst(ChannelHandler... handlers)
Description copied from interface:ChannelPipelineInsertsChannelHandlers at the first position of this pipeline.nullhandlers will be skipped.- Specified by:
addFirstin interfaceChannelPipeline- Parameters:
handlers- the handlers to insert first
-
addLast
public final ChannelPipeline addLast(ChannelHandler handler)
-
addLast
public final ChannelPipeline addLast(ChannelHandler... handlers)
Description copied from interface:ChannelPipelineInsertsChannelHandlers at the last position of this pipeline.nullhandlers will be skipped.- Specified by:
addLastin interfaceChannelPipeline- Parameters:
handlers- the handlers to insert last
-
remove
public final ChannelPipeline remove(ChannelHandler handler)
Description copied from interface:ChannelPipelineRemoves the specifiedChannelHandlerfrom this pipeline.- Specified by:
removein interfaceChannelPipeline- Parameters:
handler- theChannelHandlerto remove
-
remove
public final ChannelHandler remove(String name)
Description copied from interface:ChannelPipelineRemoves theChannelHandlerwith the specified name from this pipeline.- Specified by:
removein interfaceChannelPipeline- Parameters:
name- the name under which theChannelHandlerwas stored.- Returns:
- the removed handler
-
remove
public final <T extends ChannelHandler> T remove(Class<T> handlerType)
Description copied from interface:ChannelPipelineRemoves theChannelHandlerof the specified type from this pipeline.- Specified by:
removein interfaceChannelPipeline- Type Parameters:
T- the type of the handler- Parameters:
handlerType- the type of the handler- Returns:
- the removed handler
-
removeIfExists
public final <T extends ChannelHandler> T removeIfExists(String name)
Description copied from interface:ChannelPipelineRemoves theChannelHandlerwith the specified name from this pipeline if it exists.- Specified by:
removeIfExistsin interfaceChannelPipeline- Parameters:
name- the name under which theChannelHandlerwas stored.- Returns:
- the removed handler
-
removeIfExists
public final <T extends ChannelHandler> T removeIfExists(Class<T> handlerType)
Description copied from interface:ChannelPipelineRemoves theChannelHandlerof the specified type from this pipeline if it exists.- Specified by:
removeIfExistsin interfaceChannelPipeline- Type Parameters:
T- the type of the handler- Parameters:
handlerType- the type of the handler- Returns:
- the removed handler or
nullif it didn't exist.
-
removeIfExists
public final <T extends ChannelHandler> T removeIfExists(ChannelHandler handler)
Description copied from interface:ChannelPipelineRemoves the specifiedChannelHandlerfrom this pipeline if it exists- Specified by:
removeIfExistsin interfaceChannelPipeline- Parameters:
handler- theChannelHandlerto remove- Returns:
- the removed handler or
nullif it didn't exist.
-
replace
public final ChannelPipeline replace(ChannelHandler oldHandler, String newName, ChannelHandler newHandler)
Description copied from interface:ChannelPipelineReplaces the specifiedChannelHandlerwith a new handler in this pipeline.- Specified by:
replacein interfaceChannelPipeline- Parameters:
oldHandler- theChannelHandlerto be replacednewName- the name under which the replacement should be addednewHandler- theChannelHandlerwhich is used as replacement- Returns:
- itself
-
replace
public final ChannelHandler replace(String oldName, String newName, ChannelHandler newHandler)
Description copied from interface:ChannelPipelineReplaces theChannelHandlerof the specified name with a new handler in this pipeline.- Specified by:
replacein interfaceChannelPipeline- Parameters:
oldName- the name of theChannelHandlerto be replacednewName- the name under which the replacement should be addednewHandler- theChannelHandlerwhich is used as replacement- Returns:
- the removed handler
-
replace
public final <T extends ChannelHandler> T replace(Class<T> oldHandlerType, String newName, ChannelHandler newHandler)
Description copied from interface:ChannelPipelineReplaces theChannelHandlerof the specified type with a new handler in this pipeline.- Specified by:
replacein interfaceChannelPipeline- Parameters:
oldHandlerType- the type of the handler to be removednewName- the name under which the replacement should be addednewHandler- theChannelHandlerwhich is used as replacement- Returns:
- the removed handler
-
get
public final ChannelHandler get(String name)
Description copied from interface:ChannelPipelineReturns theChannelHandlerwith the specified name in this pipeline.- Specified by:
getin interfaceChannelPipeline- Returns:
- the handler with the specified name.
nullif there's no such handler in this pipeline.
-
get
public final <T extends ChannelHandler> T get(Class<T> handlerType)
Description copied from interface:ChannelPipelineReturns theChannelHandlerof the specified type in this pipeline.- Specified by:
getin interfaceChannelPipeline- Returns:
- the handler of the specified handler type.
nullif there's no such handler in this pipeline.
-
context
public final ChannelHandlerContext context(String name)
Description copied from interface:ChannelPipelineReturns the context object of theChannelHandlerwith the specified name in this pipeline.- Specified by:
contextin interfaceChannelPipeline- Returns:
- the context object of the handler with the specified name.
nullif there's no such handler in this pipeline.
-
context
public final ChannelHandlerContext context(ChannelHandler handler)
Description copied from interface:ChannelPipelineReturns the context object of the specifiedChannelHandlerin this pipeline.- Specified by:
contextin interfaceChannelPipeline- Returns:
- the context object of the specified handler.
nullif there's no such handler in this pipeline.
-
context
public final ChannelHandlerContext context(Class<? extends ChannelHandler> handlerType)
Description copied from interface:ChannelPipelineReturns the context object of theChannelHandlerof the specified type in this pipeline.- Specified by:
contextin interfaceChannelPipeline- Returns:
- the context object of the handler of the specified type.
nullif there's no such handler in this pipeline.
-
names
public final List<String> names()
Description copied from interface:ChannelPipelineReturns theListof the handler names.- Specified by:
namesin interfaceChannelPipeline
-
removeFirst
public ChannelHandler removeFirst()
Description copied from interface:ChannelPipelineRemoves the firstChannelHandlerin this pipeline.- Specified by:
removeFirstin interfaceChannelPipeline- Returns:
- the removed handler
-
removeLast
public ChannelHandler removeLast()
Description copied from interface:ChannelPipelineRemoves the lastChannelHandlerin this pipeline.- Specified by:
removeLastin interfaceChannelPipeline- Returns:
- the removed handler
-
first
public ChannelHandler first()
Description copied from interface:ChannelPipelineReturns the firstChannelHandlerin this pipeline.- Specified by:
firstin interfaceChannelPipeline- Returns:
- the first handler.
nullif this pipeline is empty.
-
firstContext
public ChannelHandlerContext firstContext()
Description copied from interface:ChannelPipelineReturns the context of the firstChannelHandlerin this pipeline.- Specified by:
firstContextin interfaceChannelPipeline- Returns:
- the context of the first handler.
nullif this pipeline is empty.
-
last
public ChannelHandler last()
Description copied from interface:ChannelPipelineReturns the lastChannelHandlerin this pipeline.- Specified by:
lastin interfaceChannelPipeline- Returns:
- the last handler.
nullif this pipeline is empty.
-
lastContext
public ChannelHandlerContext lastContext()
Description copied from interface:ChannelPipelineReturns the context of the lastChannelHandlerin this pipeline.- Specified by:
lastContextin interfaceChannelPipeline- Returns:
- the context of the last handler.
nullif this pipeline is empty.
-
toMap
public Map<String,ChannelHandler> toMap()
Description copied from interface:ChannelPipelineConverts this pipeline into an orderedMapwhose keys are handler names and whose values are handlers.- Specified by:
toMapin interfaceChannelPipeline
-
iterator
public Iterator<Map.Entry<String,ChannelHandler>> iterator()
- Specified by:
iteratorin interfaceIterable<Map.Entry<String,ChannelHandler>>
-
fireChannelRegistered
public final ChannelPipeline fireChannelRegistered()
Description copied from interface:ChannelInboundInvokerAChannelwas registered to itsEventLoop. This will result in having theChannelHandler.channelRegistered(ChannelHandlerContext)method called of the nextChannelHandlercontained in theChannelPipelineof theChannel.- Specified by:
fireChannelRegisteredin interfaceChannelInboundInvoker- Specified by:
fireChannelRegisteredin interfaceChannelPipeline
-
fireChannelUnregistered
public final ChannelPipeline fireChannelUnregistered()
Description copied from interface:ChannelInboundInvokerAChannelwas unregistered from itsEventLoop. This will result in having theChannelHandler.channelUnregistered(ChannelHandlerContext)method called of the nextChannelHandlercontained in theChannelPipelineof theChannel.- Specified by:
fireChannelUnregisteredin interfaceChannelInboundInvoker- Specified by:
fireChannelUnregisteredin interfaceChannelPipeline
-
fireChannelActive
public final ChannelPipeline fireChannelActive()
Description copied from interface:ChannelInboundInvokerAChannelis active now, which means it is connected. This will result in having theChannelHandler.channelActive(ChannelHandlerContext)method called of the nextChannelHandlercontained in theChannelPipelineof theChannel.- Specified by:
fireChannelActivein interfaceChannelInboundInvoker- Specified by:
fireChannelActivein interfaceChannelPipeline
-
fireChannelInactive
public final ChannelPipeline fireChannelInactive()
Description copied from interface:ChannelInboundInvokerAChannelis inactive now, which means it is closed. This will result in having theChannelHandler.channelInactive(ChannelHandlerContext)method called of the nextChannelHandlercontained in theChannelPipelineof theChannel.- Specified by:
fireChannelInactivein interfaceChannelInboundInvoker- Specified by:
fireChannelInactivein interfaceChannelPipeline
-
fireChannelShutdown
public final ChannelPipeline fireChannelShutdown(ChannelShutdownDirection direction)
Description copied from interface:ChannelInboundInvokerAChannelwas shutdown in a specific direction. This will result in having theChannelHandler.channelShutdown(ChannelHandlerContext, ChannelShutdownDirection)method called of the nextChannelHandlercontained in theChannelPipelineof theChannel.- Specified by:
fireChannelShutdownin interfaceChannelInboundInvoker- Specified by:
fireChannelShutdownin interfaceChannelPipeline
-
fireChannelExceptionCaught
public final ChannelPipeline fireChannelExceptionCaught(Throwable cause)
Description copied from interface:ChannelInboundInvokerAChannelreceived anThrowablein one of its inbound operations. This will result in having theChannelHandler.channelExceptionCaught(ChannelHandlerContext, Throwable)method called of the nextChannelHandlercontained in theChannelPipelineof theChannel.- Specified by:
fireChannelExceptionCaughtin interfaceChannelInboundInvoker- Specified by:
fireChannelExceptionCaughtin interfaceChannelPipeline
-
fireChannelInboundEvent
public final ChannelPipeline fireChannelInboundEvent(Object event)
Description copied from interface:ChannelInboundInvokerAChannelreceived a custom defined inbound event. This will result in having theChannelHandler.channelInboundEvent(ChannelHandlerContext, Object)method called of the nextChannelHandlercontained in theChannelPipelineof theChannel.- Specified by:
fireChannelInboundEventin interfaceChannelInboundInvoker- Specified by:
fireChannelInboundEventin interfaceChannelPipeline
-
fireChannelRead
public final ChannelPipeline fireChannelRead(Object msg)
Description copied from interface:ChannelInboundInvokerAChannelreceived a message. This will result in having theChannelHandler.channelRead(ChannelHandlerContext, Object)method called of the nextChannelHandlercontained in theChannelPipelineof theChannel.- Specified by:
fireChannelReadin interfaceChannelInboundInvoker- Specified by:
fireChannelReadin interfaceChannelPipeline
-
fireChannelReadComplete
public final ChannelPipeline fireChannelReadComplete()
Description copied from interface:ChannelInboundInvokerTriggers anChannelHandler.channelReadComplete(ChannelHandlerContext)event to the nextChannelHandlerin theChannelPipeline.- Specified by:
fireChannelReadCompletein interfaceChannelInboundInvoker- Specified by:
fireChannelReadCompletein interfaceChannelPipeline
-
fireChannelWritabilityChanged
public final ChannelPipeline fireChannelWritabilityChanged()
Description copied from interface:ChannelInboundInvokerTriggers anChannelHandler.channelWritabilityChanged(ChannelHandlerContext)event to the nextChannelHandlerin theChannelPipeline.- Specified by:
fireChannelWritabilityChangedin interfaceChannelInboundInvoker- Specified by:
fireChannelWritabilityChangedin interfaceChannelPipeline
-
bind
public final Future<Void> bind(SocketAddress localAddress)
Description copied from interface:ChannelOutboundInvokerRequest to bind to the givenSocketAddressand notify theFutureonce the operation completes, either because the operation was successful or because of an error.This will result in having the
ChannelHandler.bind(ChannelHandlerContext, SocketAddress)method called of the nextChannelHandlercontained in theChannelPipelineof theChannel.- Specified by:
bindin interfaceChannelOutboundInvoker
-
connect
public final Future<Void> connect(SocketAddress remoteAddress)
Description copied from interface:ChannelOutboundInvokerRequest to connect to the givenSocketAddressand notify theFutureonce the operation completes, either because the operation was successful or because of an error.If the connection fails because of a connection timeout, the
Futurewill get failed with aConnectTimeoutException. If it fails because of connection refused aConnectExceptionwill be used.This will result in having the
ChannelHandler.connect(ChannelHandlerContext, SocketAddress, SocketAddress)method called of the nextChannelHandlercontained in theChannelPipelineof theChannel.- Specified by:
connectin interfaceChannelOutboundInvoker
-
connect
public final Future<Void> connect(SocketAddress remoteAddress, SocketAddress localAddress)
Description copied from interface:ChannelOutboundInvokerRequest to connect to the givenSocketAddresswhile bind to the localAddress and notify theFutureonce the operation completes, either because the operation was successful or because of an error.This will result in having the
ChannelHandler.connect(ChannelHandlerContext, SocketAddress, SocketAddress)method called of the nextChannelHandlercontained in theChannelPipelineof theChannel.- Specified by:
connectin interfaceChannelOutboundInvoker
-
disconnect
public final Future<Void> disconnect()
Description copied from interface:ChannelOutboundInvokerRequest to disconnect from the remote peer and notify theFutureonce the operation completes, either because the operation was successful or because of an error.This will result in having the
ChannelHandler.disconnect(ChannelHandlerContext)method called of the nextChannelHandlercontained in theChannelPipelineof theChannel.- Specified by:
disconnectin interfaceChannelOutboundInvoker
-
close
public final Future<Void> close()
Description copied from interface:ChannelOutboundInvokerRequest to close theChanneland notify theFutureonce the operation completes, either because the operation was successful or because of an error. After it is closed it is not possible to reuse it again.This will result in having the
ChannelHandler.close(ChannelHandlerContext)method called of the nextChannelHandlercontained in theChannelPipelineof theChannel.- Specified by:
closein interfaceChannelOutboundInvoker
-
shutdown
public Future<Void> shutdown(ChannelShutdownDirection direction)
Description copied from interface:ChannelOutboundInvokerRequest shutdown one direction of theChanneland notify theFutureonce the operation completes, either because the operation was successful or because of an error.When completed, the channel will either not produce any inbound data anymore, or it will not be possible to write data anymore, depending on the given
ChannelShutdownDirection.Depending on the transport implementation shutting down the
ChannelShutdownDirection.OutboundorChannelShutdownDirection.Inboundmight also result in data transferred over the network. Like for example in case of TCP shutting down theChannelShutdownDirection.Outboundwill result in aFINthat is transmitted to the remote peer that will as a result shutdownChannelShutdownDirection.Inbound.This will result in having the
ChannelHandler.shutdown(ChannelHandlerContext, ChannelShutdownDirection). method called of the nextChannelHandlercontained in theChannelPipelineof theChannel.- Specified by:
shutdownin interfaceChannelOutboundInvoker
-
register
public final Future<Void> register()
Description copied from interface:ChannelOutboundInvokerRequest to register on theEventExecutorfor I/O processing.Futureonce the operation completes, either because the operation was successful or because of an error.This will result in having the
ChannelHandler.register(ChannelHandlerContext)method called of the nextChannelHandlercontained in theChannelPipelineof theChannel.- Specified by:
registerin interfaceChannelOutboundInvoker
-
deregister
public final Future<Void> deregister()
Description copied from interface:ChannelOutboundInvokerRequest to deregister from the previous assignedEventExecutorand notify theFutureonce the operation completes, either because the operation was successful or because of an error.This will result in having the
ChannelHandler.deregister(ChannelHandlerContext)method called of the nextChannelHandlercontained in theChannelPipelineof theChannel.- Specified by:
deregisterin interfaceChannelOutboundInvoker
-
flush
public final ChannelPipeline flush()
Description copied from interface:ChannelOutboundInvokerRequest to flush all pending messages via this ChannelOutboundInvoker.- Specified by:
flushin interfaceChannelOutboundInvoker- Specified by:
flushin interfaceChannelPipeline
-
read
public final ChannelPipeline read()
Description copied from interface:ChannelOutboundInvokerRequest to Read data from theChannelinto the first inbound buffer, triggers anChannelHandler.channelRead(ChannelHandlerContext, Object)event if data was read, and triggers achannelReadCompleteevent so the handler can decide to continue reading. If there's a pending read operation already, this method does nothing.This will result in having the
ChannelHandler.read(ChannelHandlerContext)method called of the nextChannelHandlercontained in theChannelPipelineof theChannel.- Specified by:
readin interfaceChannelOutboundInvoker
-
write
public final Future<Void> write(Object msg)
Description copied from interface:ChannelOutboundInvokerRequest to write a message via thisChannelHandlerContextthrough theChannelPipeline. This method will not request to actual flush, so be sure to callChannelOutboundInvoker.flush()once you want to request to flush all pending data to the actual transport.- Specified by:
writein interfaceChannelOutboundInvoker
-
writeAndFlush
public final Future<Void> writeAndFlush(Object msg)
Description copied from interface:ChannelOutboundInvokerShortcut for callChannelOutboundInvoker.write(Object)andChannelOutboundInvoker.flush().- Specified by:
writeAndFlushin interfaceChannelOutboundInvoker
-
sendOutboundEvent
public final Future<Void> sendOutboundEvent(Object event)
Description copied from interface:ChannelOutboundInvokerSend a custom outbound event via thisChannelOutboundInvokerthrough theChannelPipeline.This will result in having the
ChannelHandler.sendOutboundEvent(ChannelHandlerContext, Object)method called of the nextChannelHandlercontained in theChannelPipelineof theChannel.- Specified by:
sendOutboundEventin interfaceChannelOutboundInvoker
-
newPromise
public final <V> Promise<V> newPromise()
Description copied from interface:FuturePromiseFactoryReturn a newPromise.- Specified by:
newPromisein interfaceChannelOutboundInvoker- Specified by:
newPromisein interfaceFuturePromiseFactory
-
newSucceededFuture
public final Future<Void> newSucceededFuture()
Description copied from interface:FuturePromiseFactoryCreate a newFuturewhich is marked as succeeded already. SoAsynchronousResult.isSuccess()will returntrue. AllFutureListeneradded to it will be notified directly. Also every call of blocking methods will just return without blocking.- Specified by:
newSucceededFuturein interfaceChannelOutboundInvoker- Specified by:
newSucceededFuturein interfaceFuturePromiseFactory
-
newSucceededFuture
public final <V> Future<V> newSucceededFuture(V value)
Description copied from interface:FuturePromiseFactoryCreate a newFuturewhich is marked as succeeded already. SoAsynchronousResult.isSuccess()will returntrue. AllFutureListeneradded to it will be notified directly. Also every call of blocking methods will just return without blocking.- Specified by:
newSucceededFuturein interfaceChannelOutboundInvoker- Specified by:
newSucceededFuturein interfaceFuturePromiseFactory
-
newFailedFuture
public final <V> Future<V> newFailedFuture(Throwable cause)
Description copied from interface:FuturePromiseFactoryCreate a newFuturewhich is marked as failed already. SoAsynchronousResult.isSuccess()will returnfalse. AllFutureListeneradded to it will be notified directly. Also every call of blocking methods will just return without blocking.- Specified by:
newFailedFuturein interfaceChannelOutboundInvoker- Specified by:
newFailedFuturein interfaceFuturePromiseFactory
-
onUnhandledInboundException
protected void onUnhandledInboundException(Throwable cause)
Called once aThrowablehit the end of theChannelPipelinewithout been handled by the user inChannelHandler.channelExceptionCaught(ChannelHandlerContext, Throwable).
-
onUnhandledInboundChannelActive
protected void onUnhandledInboundChannelActive()
Called once theChannelHandler.channelActive(ChannelHandlerContext)event hit the end of theChannelPipeline.
-
onUnhandledInboundChannelInactive
protected void onUnhandledInboundChannelInactive()
Called once theChannelHandler.channelInactive(ChannelHandlerContext)event hit the end of theChannelPipeline.
-
onUnhandledInboundChannelShutdown
protected void onUnhandledInboundChannelShutdown(ChannelShutdownDirection direction)
Called once theChannelHandler.channelShutdown(ChannelHandlerContext, ChannelShutdownDirection)event hit the end of theChannelPipeline.
-
onUnhandledInboundMessage
protected void onUnhandledInboundMessage(ChannelHandlerContext ctx, Object msg)
Called once a message hit the end of theChannelPipelinewithout been handled by the user inChannelHandler.channelRead(ChannelHandlerContext, Object). This method is responsible to callResource.dispose(Object)on the given msg at some point.
-
onUnhandledInboundChannelReadComplete
protected void onUnhandledInboundChannelReadComplete()
Called once theChannelHandler.channelReadComplete(ChannelHandlerContext)event hit the end of theChannelPipeline.
-
onUnhandledChannelInboundEvent
protected void onUnhandledChannelInboundEvent(Object evt)
Called once an user event hit the end of theChannelPipelinewithout been handled by the user inChannelHandler.channelInboundEvent(ChannelHandlerContext, Object). This method is responsible to callResource.dispose(Object)on the given event at some point.
-
onUnhandledChannelWritabilityChanged
protected void onUnhandledChannelWritabilityChanged()
Called once theChannelHandler.channelWritabilityChanged(ChannelHandlerContext)event hit the end of theChannelPipeline.
-
pendingOutboundBytesUpdated
protected abstract void pendingOutboundBytesUpdated(long pendingOutboundBytes)
Called once thependingOutboundBytes()were changed.- Parameters:
pendingOutboundBytes- the newpendingOutboundBytes().
-
pendingOutboundBytes
public final long pendingOutboundBytes()
Description copied from interface:ChannelPipelineThe number of the outbound bytes that are buffered / queued in thisChannelPipeline. This number will affect the writability of theChanneltogether the buffered / queued bytes in theChannelitself.- Specified by:
pendingOutboundBytesin interfaceChannelPipeline- Returns:
- the number of buffered / queued bytes.
-
transportExecutor
protected abstract EventExecutor transportExecutor()
Returns theEventExecutorthat is used for all the abstract transport operations.- Returns:
- executor.
-
registerTransport
protected abstract void registerTransport(Promise<Void> promise)
Register the transport and notify thePromiseonce the operation was completed. This method is guaranteed to be called from thetransportExecutor().
-
bindTransport
protected abstract void bindTransport(SocketAddress localAddress, Promise<Void> promise)
Bind theSocketAddressto the transport and notify thePromiseonce the operation was completed. This method is guaranteed to be called from thetransportExecutor().
-
connectTransport
protected abstract void connectTransport(SocketAddress remoteAddress, SocketAddress localAddress, Promise<Void> promise)
Connect the transport with the given remoteSocketAddress. If a specific localSocketAddressshould be used it needs to be given as argument. Otherwise just passnullto it. ThePromisewill get notified once the operation was completed. This method is guaranteed to be called from thetransportExecutor().
-
disconnectTransport
protected abstract void disconnectTransport(Promise<Void> promise)
Disconnect the transport and notify thePromiseonce the operation was completed. This method is guaranteed to be called from thetransportExecutor().
-
closeTransport
protected abstract void closeTransport(Promise<Void> promise)
Close the transport and notify thePromiseonce the operation was completed. This method is guaranteed to be called from thetransportExecutor().
-
shutdownTransport
protected abstract void shutdownTransport(ChannelShutdownDirection direction, Promise<Void> promise)
Shutdown the given direction of the transport and notify thePromiseonce the operation was completed. This method is guaranteed to be called from thetransportExecutor().
-
deregisterTransport
protected abstract void deregisterTransport(Promise<Void> promise)
Deregister the transport of theEventLoopand notify thePromiseonce the operation was completed. This method is guaranteed to be called from thetransportExecutor().
-
readTransport
protected abstract void readTransport()
Schedules a read operation on the transport that fills the inbound buffer of the firstChannelHandlerin theChannelPipeline. If there's already a pending read operation, this method does nothing. This method is guaranteed to be called from thetransportExecutor().
-
writeTransport
protected abstract void writeTransport(Object msg, Promise<Void> promise)
Schedules a write operation on the transport. The givenPromisewill be notified once the write was either successful or failed. This method is guaranteed to be called from thetransportExecutor().
-
flushTransport
protected abstract void flushTransport()
Flush out all (previous) scheduled write operations, scheduled viawriteTransport(Object, Promise). This method is guaranteed to be called from thetransportExecutor().
-
sendOutboundEventTransport
protected abstract void sendOutboundEventTransport(Object event, Promise<Void> promise)
Send a custom outbound event on the transport. This method is guaranteed to be called from thetransportExecutor().
-
-