本文整理汇总了Java中com.alibaba.dubbo.remoting.Channel.removeAttribute方法的典型用法代码示例。如果您正苦于以下问题:Java Channel.removeAttribute方法的具体用法?Java Channel.removeAttribute怎么用?Java Channel.removeAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.alibaba.dubbo.remoting.Channel
的用法示例。
在下文中一共展示了Channel.removeAttribute方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: telnet
import com.alibaba.dubbo.remoting.Channel; //导入方法依赖的package包/类
public String telnet(Channel channel, String message) {
if (message == null || message.length() == 0) {
return "Please input service name, eg: \r\ncd XxxService\r\ncd com.xxx.XxxService";
}
StringBuilder buf = new StringBuilder();
if (message.equals("/") || message.equals("..")) {
String service = (String) channel.getAttribute(SERVICE_KEY);
channel.removeAttribute(SERVICE_KEY);
buf.append("Cancelled default service " + service + ".");
} else {
boolean found = false;
for (Exporter<?> exporter : DubboProtocol.getDubboProtocol().getExporters()) {
if (message.equals(exporter.getInvoker().getInterface().getSimpleName())
|| message.equals(exporter.getInvoker().getInterface().getName())
|| message.equals(exporter.getInvoker().getUrl().getPath())) {
found = true;
break;
}
}
if (found) {
channel.setAttribute(SERVICE_KEY, message);
buf.append("Used the " + message + " as default.\r\nYou can cancel default service by command: cd /");
} else {
buf.append("No such service " + message);
}
}
return buf.toString();
}
示例2: removeTracer
import com.alibaba.dubbo.remoting.Channel; //导入方法依赖的package包/类
public static void removeTracer(Class<?> type, String method, Channel channel) {
channel.removeAttribute(TRACE_MAX);
channel.removeAttribute(TRACE_COUNT);
String key = method != null && method.length() > 0 ? type.getName() + "." + method : type.getName();
Set<Channel> channels = tracers.get(key);
if (channels != null) {
channels.remove(channel);
}
}
示例3: clearReadTimestamp
import com.alibaba.dubbo.remoting.Channel; //导入方法依赖的package包/类
private void clearReadTimestamp(Channel channel) {
channel.removeAttribute(KEY_READ_TIMESTAMP);
}
示例4: clearWriteTimestamp
import com.alibaba.dubbo.remoting.Channel; //导入方法依赖的package包/类
private void clearWriteTimestamp(Channel channel) {
channel.removeAttribute(KEY_WRITE_TIMESTAMP);
}
示例5: removeChannelIfDisconnected
import com.alibaba.dubbo.remoting.Channel; //导入方法依赖的package包/类
static void removeChannelIfDisconnected(Channel ch) {
if (ch != null && ! ch.isConnected()) {
ch.removeAttribute(CHANNEL_KEY);
}
}
示例6: removeAttribute
import com.alibaba.dubbo.remoting.Channel; //导入方法依赖的package包/类
public void removeAttribute(String key) {
Channel channel = getChannel();
if (channel == null)
return;
channel.removeAttribute(key);
}