@Override public boolean isActive() { return channel.isConnected(); }
public void destroy() { System.out.println("DESTROY!!!!!"); if(clusterChannel != null && clusterChannel.isConnected()) { // This calls disconnect() first clusterChannel.close(); } }
void connect() throws ChannelException, ChannelClosedException { if (channel != null && !channel.isConnected()) channel.connect(channelName); }
public void close() throws IOException { if(log.isDebugEnabled()){ log.debug("State reader " + inputStreamOwner + " is closing the socket "); } if(channelOwner != null && channelOwner.isConnected()){ channelOwner.down(new Event(Event.STATE_TRANSFER_INPUTSTREAM_CLOSED)); } inputStreamOwner.close(); }
public void close() throws IOException { if(log.isDebugEnabled()){ log.debug("State writer " + outputStreamOwner + " is closing the socket "); } try{ if(channelOwner != null && channelOwner.isConnected()){ channelOwner.down(new Event(Event.STATE_TRANSFER_OUTPUTSTREAM_CLOSED)); } outputStreamOwner.close(); }catch(IOException e){ throw e; }finally{ if(stats){ avg_state_size = num_bytes_sent.addAndGet(bytesWrittenCounter) / num_state_reqs.doubleValue(); } } }
public void leaveNetwork() { this.log.start(); if (this.jndiHashMapChannel != null && this.jndiHashMapChannel.isConnected()) { this.jndiHashMapChannel.close(); } if (this.discoveryCoordinationChannel.isConnected()) { this.discoveryCoordinationChannel.close(); this.discoveryHashMapChannel.close(); } this.log.end(); }
/** * Starts a new clustering service by forking a channel of an existing JGroups channel. * * @param mainChannel a {@link Channel} instance; may not be null. * @return a {@link org.modeshape.jcr.clustering.ClusteringService} instance, never null */ public static ClusteringService startForked( Channel mainChannel ) { if (!mainChannel.isConnected()) { throw new IllegalStateException(ClusteringI18n.channelNotConnected.text()); } ClusteringService clusteringService = new ForkedClusteringService(mainChannel); clusteringService.init(); return clusteringService; }
/** * Starts a new clustering service by forking a channel of an existing JGroups channel. * * @param mainChannel a {@link Channel} instance; may not be null. * @return a {@link org.modeshape.jcr.clustering.ClusteringService} instance, never null */ public static ClusteringService startForked( Channel mainChannel ) { if (!mainChannel.isConnected()) { throw new IllegalStateException(ClusteringI18n.channelNotConnected.text()); } ClusteringService clusteringService = new ForkedClusteringService(mainChannel); clusteringService.init(); return clusteringService; }
/** * {@inheritDoc} * @see net.sf.hajdbc.Lifecycle#stop() */ @Override public void stop() { Channel channel = this.dispatcher.getChannel(); if (channel.isOpen()) { if (channel.isConnected()) { channel.disconnect(); } } }
if (this.channelSelfConnected && this.channel != null && this.channel.isConnected())
public void onEvent(RuntimeStop event) { if (domainDispatcher != null) { domainDispatcher.stop(); } if (domainChannel != null && domainChannel.isConnected()) { domainChannel.disconnect(); domainChannel.close(); } for (Channel channel : channels.values()) { if (channel.isConnected()) { channel.disconnect(); channel.close(); } } } }
this.dispatcher = new RpcHandler(this.scopeId.shortValue(), this.channel, msgl, meml, new RequestMarshallerImpl(), new ResponseMarshallerImpl()); if (!this.channel.isConnected())
public void start() { if (this.channel == null) { throw ClusteringImplMessages.MESSAGES.channelNotDefined(); } if (!this.channel.isConnected()) { throw ClusteringImplMessages.MESSAGES.channelNotConnected(this.channel.getName()); } this.stateIdPrefix = this.getClass().getName() + "." + this.scopeId + "."; // Subscribe to events generated by the channel MembershipListener meml = new MembershipListenerImpl(); MessageListener msgl = this.stateIdPrefix == null ? null : new MessageListenerImpl(); this.dispatcher = new RpcHandler(this.scopeId, this.channel, msgl, meml, new RequestMarshallerImpl(), new ResponseMarshallerImpl()); meml.viewAccepted(this.channel.getView()); // Since we haven't triggered a flush, we need to manually open the gate to allow rpcs. this.flushBlockGate.open(); this.directlyInvokeLocal = this.channel.getDiscardOwnMessages(); // get current JG group properties this.me = this.nodeFactory.getClusterNode(this.channel.getAddress()); this.verifyNodeIsUnique(); // Start the asynch listener handler thread this.asynchHandler.start(); }
log.tracef("%s: sending message=%s to %s", channel.getAddress(), request, destAddress); if (channel == null || !channel.isOpen() || !channel.isConnected())