![JAR search and dependency download from the Maven repository](/logo.png)
com.github.netty.protocol.dubbo.ProxyBackendHandler Maven / Gradle / Ivy
package com.github.netty.protocol.dubbo;
import com.github.netty.core.AbstractChannelHandler;
import io.netty.buffer.ByteBuf;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;
import java.util.Collection;
@ChannelHandler.Sharable
public class ProxyBackendHandler extends AbstractChannelHandler {
private final Collection applicationNames;
private final Channel frontendChannel;
private Channel backendChannel;
public ProxyBackendHandler(Collection applicationNames, Channel frontendChannel) {
super(false);
this.applicationNames = applicationNames;
this.frontendChannel = frontendChannel;
}
public Collection getApplicationNames() {
return applicationNames;
}
public Channel getBackendChannel() {
return backendChannel;
}
public Channel getFrontendChannel() {
return frontendChannel;
}
@Override
public void channelActive(ChannelHandlerContext ctx) throws Exception {
this.backendChannel = ctx.channel();
}
@Override
protected void onMessageReceived(ChannelHandlerContext ctx, ByteBuf msg) throws Exception {
frontendChannel.write(msg);
}
@Override
public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
frontendChannel.flush();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy