Java Code Examples for io.netty.util.ReferenceCountUtil#touch()

The following examples show how to use io.netty.util.ReferenceCountUtil#touch() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ArrayRedisMessage.java    From netty-4.1.22 with Apache License 2.0 5 votes vote down vote up
@Override
public ArrayRedisMessage touch(Object hint) {
    for (RedisMessage msg : children) {
        ReferenceCountUtil.touch(msg);
    }
    return this;
}
 
Example 2
Source File: EmbeddedChannel.java    From netty-4.1.22 with Apache License 2.0 5 votes vote down vote up
/**
 * Return received data from this {@link Channel} 返回从该通道接收到的数据
 */
@SuppressWarnings("unchecked")
public <T> T readInbound() {
    T message = (T) poll(inboundMessages);
    if (message != null) {
        ReferenceCountUtil.touch(message, "Caller of readInbound() will handle the message from this point");
    }
    return message;
}
 
Example 3
Source File: EmbeddedChannel.java    From netty-4.1.22 with Apache License 2.0 5 votes vote down vote up
/**
 * Read data from the outbound. This may return {@code null} if nothing is readable.从出站读取数据。如果没有可读的,则返回null。
 */
@SuppressWarnings("unchecked")
public <T> T readOutbound() {
    T message =  (T) poll(outboundMessages);
    if (message != null) {
        ReferenceCountUtil.touch(message, "Caller of readOutbound() will handle the message from this point.");
    }
    return message;
}
 
Example 4
Source File: FilteredStreamMessage.java    From armeria with Apache License 2.0 5 votes vote down vote up
@Override
public void onNext(T o) {
    ReferenceCountUtil.touch(o);
    U filtered = filter(o);
    if (!subscribedWithPooledObjects) {
        filtered = PooledObjects.toUnpooled(filtered);
    }
    delegate.onNext(filtered);
}
 
Example 5
Source File: AbstractStreamMessage.java    From armeria with Apache License 2.0 5 votes vote down vote up
T prepareObjectForNotification(SubscriptionImpl subscription, T o) {
    ReferenceCountUtil.touch(o);
    onRemoval(o);
    if (!subscription.withPooledObjects()) {
        o = PooledObjects.toUnpooled(o);
    }
    return o;
}
 
Example 6
Source File: DefaultAddressedEnvelope.java    From netty-4.1.22 with Apache License 2.0 4 votes vote down vote up
@Override
public AddressedEnvelope<M, A> touch() {
    ReferenceCountUtil.touch(message);
    return this;
}
 
Example 7
Source File: DefaultAddressedEnvelope.java    From netty-4.1.22 with Apache License 2.0 4 votes vote down vote up
@Override
public AddressedEnvelope<M, A> touch(Object hint) {
    ReferenceCountUtil.touch(message, hint);
    return this;
}
 
Example 8
Source File: DefaultChannelPipeline.java    From netty-4.1.22 with Apache License 2.0 4 votes vote down vote up
final Object touch(Object msg, AbstractChannelHandlerContext next) {
    return touch ? ReferenceCountUtil.touch(msg, next) : msg;
}