netty5/transport/src/main/java/io/netty/channel/ChannelOutboundHandler.java
Trustin Lee 7884574c7b Remove freeInboundBuffer() and freeOutboundBuffer() which has no value
- Fixes #1308

freeInboundBuffer() and freeOutboundBuffer() were introduced in the early days of the new API when we did not have reference counting mechanism in the buffer. A user did not want Netty to free the handler buffers had to override these methods.

However, now that we have reference counting mechanism built into the buffer, a user who wants to retain the buffers beyond handler's life cycle can simply return the buffer whose reference count is greater than 1 in newInbound/OutboundBuffer().
2013-04-25 09:15:55 +09:00

34 lines
1.4 KiB
Java

/*
* 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 io.netty.channel;
import io.netty.buffer.Buf;
/**
* {@link ChannelOperationHandler} which handles outbound data.
*/
interface ChannelOutboundHandler extends ChannelOperationHandler {
/**
* Returns a new buffer which will be used to transfer outbound data for the given {@link ChannelHandlerContext}.
* <p>
* Please note that this method can be called from any thread repeatatively, and thus you should neither perform
* stateful operation nor keep the reference of the created buffer as a member variable. Get it always using
* {@link ChannelHandlerContext#outboundByteBuffer()} or {@link ChannelHandlerContext#outboundMessageBuffer()}.
* </p>
*/
Buf newOutboundBuffer(ChannelHandlerContext ctx) throws Exception;
}