netty3 future listener for metrics.

This commit is contained in:
Chuanyi Li
2018-08-01 08:17:55 +08:00
parent 50d1ec583b
commit ae0f43d1c7

View File

@@ -0,0 +1,42 @@
package com.alibaba.otter.canal.server.netty.listener;
import com.alibaba.otter.canal.protocol.CanalPacket;
import org.jboss.netty.channel.ChannelFuture;
import org.jboss.netty.channel.ChannelFutureListener;
import java.util.concurrent.ConcurrentHashMap;
/**
* @author Chuanyi Li
*/
public class ChannelFutureAggregator implements ChannelFutureListener {
private String dest;
private CanalPacket.PacketType type;
private int amount;
private int errorCode;
public ChannelFutureAggregator(String dest, CanalPacket.PacketType type, int amount) {
this(dest, type, amount, 0);
}
public ChannelFutureAggregator(String dest, CanalPacket.PacketType type, int amount, int errorCode) {
this.dest = dest;
this.type = type;
this.amount = amount;
this.errorCode = errorCode;
}
@Override
public void operationComplete(ChannelFuture future) throws Exception {
if (future.isSuccess()) {
ConcurrentHashMap map = new ConcurrentHashMap();
map.putIfAbsent("", "");
} else {
Throwable t = future.getCause();
}
}
}