本文整理了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);
}