热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

org.jgroups.JChannel.isConnected()方法的使用及代码示例

本文整理了Java中org.jgroups.JChannel.isConnected()方法的一些代码示例,展示了JChannel.isConnected(

本文整理了Java中org.jgroups.JChannel.isConnected()方法的一些代码示例,展示了JChannel.isConnected()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JChannel.isConnected()方法的具体详情如下:
包路径:org.jgroups.JChannel
类名称:JChannel
方法名:isConnected

JChannel.isConnected介绍

[英]returns true if the Connect operation has been called successfully
[中]如果已成功调用连接操作,则返回true

代码示例

代码示例来源:origin: wildfly/wildfly

/**
* Determines whether the channel is connected to a group.
* @return true if channel is connected to cluster (group) and can send/receive messages, false otherwise
*/
@ManagedAttribute public boolean isConnected() {return ch.isConnected();}

代码示例来源:origin: wildfly/wildfly

public synchronized void connect() throws Exception {
if (logger.isTraceEnabled()) {
logger.trace(this + ":: Connecting " + channelName, new Exception("Trace"));
}
// It is important to check this otherwise we could reconnect an already connected channel
if (connected) {
return;
}
cOnnected= true;
if (!channel.isConnected()) {
channel.connect(channelName);
}
}

代码示例来源:origin: wildfly/wildfly

public Object down(Message msg) {
if(channel != null) {
if(!(channel.isConnected() || channel.isConnecting())) {
// return null;
throw new IllegalStateException("channel is not connected");
}
return channel.down(msg);
}
return null;
}

代码示例来源:origin: wildfly/wildfly

/** Sets the logical name for the channel. The name will stay associated with this channel for the channel's lifetime
* (until close() is called). This method must be called before calling connect() */
@ManagedAttribute(writable=true, description="The logical name of this channel. Stays with the channel until " +
"the channel is closed")
public JChannel setName(String name) {
if(name != null) {
if(isConnected())
throw new IllegalStateException("name cannot be set if channel is connected (should be done before)");
this.name=name;
if(local_addr != null)
NameCache.add(local_addr, this.name);
}
return this;
}

代码示例来源:origin: wildfly/wildfly

protected void loop() throws Exception {
List lock_names;
while(ch.isConnected()) {
String line=Util.readStringFromStdin(": ");
if(line == null || line.startsWith("quit") || line.startsWith("exit"))

代码示例来源:origin: wildfly/wildfly

public void run() {
if(bridge == null || !bridge.isConnected() || remote_view != null)
return;
Message msg=new Message().putHeader(id, RelayHeader.create(RELAY.RelayHeader.Type.BROADCAST_VIEW));
try {
bridge.send(msg);
}
catch(Exception e) {
}
}
}

代码示例来源:origin: wildfly/wildfly

protected void loop() throws Exception {
while(ch.isConnected()) {
String line=Util.readStringFromStdin(": ");
if(line.startsWith("quit") || line.startsWith("exit"))

代码示例来源:origin: wildfly/wildfly

if(!this.main_channel.isConnected())
throw new IllegalStateException("main channel is not connected");
if(state == State.CONNECTED)

代码示例来源:origin: apache/geode

NetView oldView = this.view;
if (!myChannel.isConnected()) {
logger.info("JGroupsMessenger channel is closed - messaging is not possible");
throw new DistributedSystemDisconnectedException("Distributed System is shutting down");

代码示例来源:origin: wildfly/wildfly

protected void sendViewToRemote(ViewData view_data, boolean use_seperate_thread) {
try {
if(bridge != null && bridge.isConnected()) {
byte[] buf=Util.streamableToByteBuffer(view_data);
final Message msg=new Message(null, buf).putHeader(id, RelayHeader.create(RelayHeader.Type.VIEW));
if(use_seperate_thread) {
timer.execute(() -> {
try {
bridge.send(msg);
}
catch(Exception e) {
log.error(Util.getMessage("FailedSendingViewToRemote"), e);
}
});
}
else
bridge.send(msg);
}
}
catch(Exception e) {
log.error(Util.getMessage("FailedSendingViewToRemote"), e);
}
}

代码示例来源:origin: net.sf.ehcache/ehcache-jgroupsreplication

/**
* @return the {@link Status} of the manager
*/
public Status getStatus() {
if (this.channel == null) {
return Status.STATUS_UNINITIALISED;
}
if (!this.channel.isConnected()) {
return Status.STATUS_SHUTDOWN;
}
return Status.STATUS_ALIVE;
}

代码示例来源:origin: net.segoia/distributed-processor

public boolean isConnected() {
if (channel == null) {
return false;
}
return channel.isConnected();
}

代码示例来源:origin: org.atmosphere/atmosphere-jgroups

/**
* Constructor
*
* @param jchannel unconnected JGroups JChannel object
* @param clusterName name of the group to connect the JChannel to
*/
public JGroupsChannel(JChannel jchannel, String clusterName) {
if (jchannel.isConnected()) throw new IllegalArgumentException("JChannel already connected");

this.jchannel = jchannel;
this.clusterName = clusterName;
}

代码示例来源:origin: jpos/jPOS-EE

private void assertChannel () {
if (!channel.isConnected())
throw new SpaceError ("Channel is not connected");
}
/** Called when a member is suspected */

代码示例来源:origin: net.segoia/distributed-processor

protected void sendMessage(Message msg) throws Exception {
if (channel == null || !channel.isConnected()) {
throw new Exception("The channel is null or not connected");
}
channel.send(msg);
}

代码示例来源:origin: org.apache.activemq/artemis-core-client

public synchronized void connect() throws Exception {
if (logger.isTraceEnabled()) {
logger.trace(this + ":: Connecting " + channelName, new Exception("Trace"));
}
// It is important to check this otherwise we could reconnect an already connected channel
if (connected) {
return;
}
cOnnected= true;
if (!channel.isConnected()) {
channel.connect(channelName);
}
}

代码示例来源:origin: org.jboss.eap/wildfly-client-all

/**
* Determines whether the channel is connected to a group.
* @return true if channel is connected to cluster (group) and can send/receive messages, false otherwise
*/
@ManagedAttribute public boolean isConnected() {return ch.isConnected();}

代码示例来源:origin: net.segoia/distributed-processor

public void advertise() {
if (channel == null || !channel.isConnected()) {
return;
}
Message msg = new Message();
msg.setObject(localServices.keySet().toArray(new DistributedServiceDescription[0]));
try {
sendMessage(msg);
} catch (Exception e) {
Log.error(this, "Error sending advertise message", e);
}
}

代码示例来源:origin: org.jboss.eap/wildfly-client-all

public void run() {
if(bridge == null || !bridge.isConnected() || remote_view != null)
return;
Message msg=new Message().putHeader(id, RelayHeader.create(RELAY.RelayHeader.Type.BROADCAST_VIEW));
try {
bridge.send(msg);
}
catch(Exception e) {
}
}
}

代码示例来源:origin: org.jgroups/com.springsource.org.jgroups

protected void _close(boolean disconnect, boolean close_mq) {
super._close(disconnect, close_mq);
closed=!ch.isOpen();
setConnected(ch.isConnected());
notifyChannelClosed(this);
}

推荐阅读
  • Java中包装类的设计原因以及操作方法
    本文主要介绍了Java中设计包装类的原因以及操作方法。在Java中,除了对象类型,还有八大基本类型,为了将基本类型转换成对象,Java引入了包装类。文章通过介绍包装类的定义和实现,解答了为什么需要包装类的问题,并提供了简单易用的操作方法。通过本文的学习,读者可以更好地理解和应用Java中的包装类。 ... [详细]
  • 本文详细介绍了Java中vector的使用方法和相关知识,包括vector类的功能、构造方法和使用注意事项。通过使用vector类,可以方便地实现动态数组的功能,并且可以随意插入不同类型的对象,进行查找、插入和删除操作。这篇文章对于需要频繁进行查找、插入和删除操作的情况下,使用vector类是一个很好的选择。 ... [详细]
  • Java学习笔记之面向对象编程(OOP)
    本文介绍了Java学习笔记中的面向对象编程(OOP)内容,包括OOP的三大特性(封装、继承、多态)和五大原则(单一职责原则、开放封闭原则、里式替换原则、依赖倒置原则)。通过学习OOP,可以提高代码复用性、拓展性和安全性。 ... [详细]
  • 先看官方文档TheJavaTutorialshavebeenwrittenforJDK8.Examplesandpracticesdescribedinthispagedontta ... [详细]
  • Iamtryingtomakeaclassthatwillreadatextfileofnamesintoanarray,thenreturnthatarra ... [详细]
  • 开发笔记:加密&json&StringIO模块&BytesIO模块
    篇首语:本文由编程笔记#小编为大家整理,主要介绍了加密&json&StringIO模块&BytesIO模块相关的知识,希望对你有一定的参考价值。一、加密加密 ... [详细]
  • Java容器中的compareto方法排序原理解析
    本文从源码解析Java容器中的compareto方法的排序原理,讲解了在使用数组存储数据时的限制以及存储效率的问题。同时提到了Redis的五大数据结构和list、set等知识点,回忆了作者大学时代的Java学习经历。文章以作者做的思维导图作为目录,展示了整个讲解过程。 ... [详细]
  • 本文讨论了如何优化解决hdu 1003 java题目的动态规划方法,通过分析加法规则和最大和的性质,提出了一种优化的思路。具体方法是,当从1加到n为负时,即sum(1,n)sum(n,s),可以继续加法计算。同时,还考虑了两种特殊情况:都是负数的情况和有0的情况。最后,通过使用Scanner类来获取输入数据。 ... [详细]
  • 本文讨论了一个关于cuowu类的问题,作者在使用cuowu类时遇到了错误提示和使用AdjustmentListener的问题。文章提供了16个解决方案,并给出了两个可能导致错误的原因。 ... [详细]
  • 怎么在PHP项目中实现一个HTTP断点续传功能发布时间:2021-01-1916:26:06来源:亿速云阅读:96作者:Le ... [详细]
  • ScrollView嵌套Collectionview无痕衔接四向滚动,支持自定义TitleView
    本文介绍了如何实现ScrollView嵌套Collectionview无痕衔接四向滚动,并支持自定义TitleView。通过使用MainScrollView作为最底层,headView作为上部分,TitleView作为中间部分,Collectionview作为下面部分,实现了滚动效果。同时还介绍了使用runtime拦截_notifyDidScroll方法来实现滚动代理的方法。具体实现代码可以在github地址中找到。 ... [详细]
  • Java SE从入门到放弃(三)的逻辑运算符详解
    本文详细介绍了Java SE中的逻辑运算符,包括逻辑运算符的操作和运算结果,以及与运算符的不同之处。通过代码演示,展示了逻辑运算符的使用方法和注意事项。文章以Java SE从入门到放弃(三)为背景,对逻辑运算符进行了深入的解析。 ... [详细]
  • 本文介绍了在Java中gt、gtgt、gtgtgt和lt之间的区别。通过解释符号的含义和使用例子,帮助读者理解这些符号在二进制表示和移位操作中的作用。同时,文章还提到了负数的补码表示和移位操作的限制。 ... [详细]
  • 本文介绍了如何在给定的有序字符序列中插入新字符,并保持序列的有序性。通过示例代码演示了插入过程,以及插入后的字符序列。 ... [详细]
  • 本文介绍了Oracle数据库中tnsnames.ora文件的作用和配置方法。tnsnames.ora文件在数据库启动过程中会被读取,用于解析LOCAL_LISTENER,并且与侦听无关。文章还提供了配置LOCAL_LISTENER和1522端口的示例,并展示了listener.ora文件的内容。 ... [详细]
author-avatar
Jen覀nyfraaaaa-v-
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有