本文整理了Java中io.netty.channel.Channel.compareTo()
方法的一些代码示例,展示了Channel.compareTo()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Channel.compareTo()
方法的具体详情如下:
包路径:io.netty.channel.Channel
类名称:Channel
方法名:compareTo
暂无
代码示例来源:origin: alibaba/fescar
/**
* Release channel.
*
* @param channel the channel
* @param serverAddress the server address
*/
public void releaseChannel(Channel channel, String serverAddress) {
if (null == channel || null == serverAddress) { return; }
try {
Object connectLock = channelLocks.get(serverAddress);
synchronized (connectLock) {
Channel ch = channels.get(serverAddress);
if (null == ch) {
nettyClientKeyPool.returnObject(poolKeyMap.get(serverAddress), channel);
return;
}
if (ch.compareTo(channel) == 0) {
if (LOGGER.isInfoEnabled()) {
LOGGER.info("return to pool, tm channel:" + channel);
}
destroyChannel(serverAddress, channel);
} else {
nettyClientKeyPool.returnObject(poolKeyMap.get(serverAddress), channel);
}
}
} catch (Exception exx) {
LOGGER.error(exx.getMessage());
}
}
代码示例来源:origin: alibaba/fescar
/**
* Release channel.
*
* @param channel the channel
* @param serverAddress the server address
*/
public void releaseChannel(Channel channel, String serverAddress) {
if (null == channel || null == serverAddress) { return; }
Object connectLock = channelLocks.get(serverAddress);
try {
synchronized (connectLock) {
Channel ch = channels.get(serverAddress);
if (null == ch) {
nettyClientKeyPool.returnObject(poolKeyMap.get(serverAddress), channel);
return;
}
if (ch.compareTo(channel) == 0) {
if (LOGGER.isInfoEnabled()) {
LOGGER.info("return to pool, rm channel:" + channel);
}
destroyChannel(serverAddress, channel);
} else {
nettyClientKeyPool.returnObject(poolKeyMap.get(serverAddress), channel);
}
}
} catch (Exception exx) {
LOGGER.error(exx.getMessage());
}
}
代码示例来源:origin: waarp/WaarpFtp
/**
*
* @param channel
* @return True if the given channel is the same as the one currently registered
*/
public boolean checkCorrectChannel(Channel channel) {
if (this.dataChannel == null || channel == null) {
return false;
}
return dataChannel.compareTo(channel) == 0;
}
代码示例来源:origin: aadnk/ProtocolLib
@Override
public int compareTo(Channel o) {
return delegate.compareTo(o);
}
代码示例来源:origin: com.alibaba.fescar/fescar-core
/**
* Release channel.
*
* @param channel the channel
* @param serverAddress the server address
*/
public void releaseChannel(Channel channel, String serverAddress) {
if (null == channel || null == serverAddress) { return; }
Object connectLock = channelLocks.get(serverAddress);
try {
synchronized (connectLock) {
Channel ch = channels.get(serverAddress);
if (null == ch) {
nettyClientKeyPool.returnObject(poolKeyMap.get(serverAddress), channel);
return;
}
if (ch.compareTo(channel) == 0) {
if (LOGGER.isInfoEnabled()) {
LOGGER.info("return to pool, rm channel:" + channel);
}
destroyChannel(serverAddress, channel);
} else {
nettyClientKeyPool.returnObject(poolKeyMap.get(serverAddress), channel);
}
}
} catch (Exception exx) {
LOGGER.error(exx.getMessage());
}
}
代码示例来源:origin: com.alibaba.fescar/fescar-core
/**
* Release channel.
*
* @param channel the channel
* @param serverAddress the server address
*/
public void releaseChannel(Channel channel, String serverAddress) {
if (null == channel || null == serverAddress) { return; }
try {
Object connectLock = channelLocks.get(serverAddress);
synchronized (connectLock) {
Channel ch = channels.get(serverAddress);
if (null == ch) {
nettyClientKeyPool.returnObject(poolKeyMap.get(serverAddress), channel);
return;
}
if (ch.compareTo(channel) == 0) {
if (LOGGER.isInfoEnabled()) {
LOGGER.info("return to pool, tm channel:" + channel);
}
destroyChannel(serverAddress, channel);
} else {
nettyClientKeyPool.returnObject(poolKeyMap.get(serverAddress), channel);
}
}
} catch (Exception exx) {
LOGGER.error(exx.getMessage());
}
}
内容来源于网络,如有侵权,请联系作者删除!