そのようなことはnettyで行うことができます。
良い出発点はプロキシの例だと思います:
https://github.com/netty/netty/tree/3/src/main/java/org/jboss/netty/example/proxy
上記のように、サーバーを実装するためにプロキシの例を変更しました。設計: netty-3.5.3 を使用
クライアント<->|(s-soc)-MUX_NIO_server-(c-socks) |<->server1(lb)
|<->server2
|<->server3
|<->server4
パイプライン=>framedecoder-->stringdecoder-->clienthandler-->framedecoder-->stringdecoder-->serverHandler--|
+/- 100 tps に達するまで 100% 実行され、クライアントからの同じメッセージがサーバーに何度も送信され、デッドロック状態のように見えます。
両方のハンドラーで、私の channelInterestChanged イベントは次のようになります。
//channelInterestChanged 同期 (trafficLock) {
if (e.getChannel().isWritable()) {
inboundChannel.setReadable(true);
if (inboundChannel != null) {
inboundChannel.setReadable(true);
}
}
}
両方のハンドラー メッセージ rx で、次のように記述します。
同期 (trafficLock) {
final ChannelFutureListener writeListener =
new ChannelFutureListener() {
@Override
public void operationComplete(final ChannelFuture future)
throws Exception {
if (Consts.DEBUG_ENABLED) {
log.debug("Finished Writing message);
}
}
};
/* if channel is write */
if (inboundChannel.isWritable()) {
inboundChannel.write(bufferMsg).addListener(writeListener);
}
// If inboundChannel is saturated, do not read until notified in
if (!inboundChannel.isWritable()) {
e.getChannel().setReadable(false);
}
}
何が間違っている可能性があり、これを修正するためにどこを探すべきか考えていますか?ありがとう