public View getCurrentView() { return this.channel.getView(); } }
/** * @return Get the address of all members in the cluster */ public List<Address> getGroupMembership() { final View view = this.channel.getView(); return view.getMembers(); }
Address determineCoordinator() { Vector v=channel != null ? channel.getView().getMembers() : null; return v != null ? (Address) v.elementAt(0) : null; }
private Address getCoordinatorAddress() { List<Address> members = this.dispatcher.getChannel().getView().getMembers(); return members.isEmpty() ? null : members.get(0); }
public void channelDisconnected(Channel channel) { listeners.stream().forEach(listener -> listener.onDisconnected(membersAsString(channel.getView().getMembers()))); } }
/** * Tests whether all members in the list are valid JGroups members. * * @param members * @return */ private List<Address> checkBuddyStatus(List<Address> members) { Channel ch = configuration.getRuntimeConfig().getChannel(); View currentView = ch.getView(); List<Address> deadBuddies = new LinkedList<Address>(); for (Address a : members) if (!currentView.containsMember(a)) deadBuddies.add(a); return deadBuddies; }
public void start() { try { channel=new JChannel(props); disp=new RpcDispatcher(channel, this, this, this); channel.connect(channel_name); System.out.println("\nQuote Server started at " + new Date()); System.out.println("Joined channel '" + channel_name + "' (" + channel.getView().size() + " members)"); channel.getState(null, 0); System.out.println("Ready to serve requests"); } catch(Exception e) { log.error("QuoteServer.start() : " + e); System.exit(-1); } }
public final void start() { if(corr == null) { if(transport_adapter != null) { corr=new RequestCorrelator("MessageDispatcher", transport_adapter, this, deadlock_detection, local_addr, concurrent_processing); } else { corr=new RequestCorrelator("MessageDispatcher", prot_adapter, this, deadlock_detection, local_addr, concurrent_processing); } } correlatorStarted(); corr.start(); if(channel != null) { Vector tmp_mbrs=channel.getView() != null ? channel.getView().getMembers() : null; setMembers(tmp_mbrs); } }
public String joinNetwork() throws NetworkException { this.log.start(); synchronized (this.joinResult) { // always true if the node is the coordinator and so the first node if (this.discoveryCoordinationChannel.getView().getCreator() .equals(this.discoveryCoordinationChannel.getLocalAddress())) { this.joinResult[0] = JOIN_ACCEPTED; } else { this.joinResult[0] = TIMEOUT_REACHED_ERROR; NetworkData joinData = new JoinRequestData( this.containerConfiguration, this.domainConfiguration); try { this.discoveryCoordinationChannel.send( this.discoveryCoordinationChannel.getView() .getCreator(), null, joinData); this.joinResult.wait(LATENTY_MAX_TIME); } catch (InterruptedException e) { // do nothing } catch (ChannelNotConnectedException e) { throw new NetworkException(e); } catch (ChannelClosedException e) { throw new NetworkException(e); } } } this.log.end(); return this.joinResult[0]; }
@Override public void channelConnected(Channel channel) { // Validate view String localName = channel.getName(); Address localAddress = channel.getAddress(); for (Address address: channel.getView()) { String name = channel.getName(address); if ((name != null) && name.equals(localName) && !address.equals(localAddress)) { channel.close(); throw JGroupsMessages.MESSAGES.duplicateNodeName(this.factory.getValue().getProtocolStackConfiguration().getEnvironment().getNodeName()); } } }
meml.viewAccepted(this.channel.getView());
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(); }
public MessageDispatcher(PullPushAdapter adapter, Serializable id, MessageListener l, MembershipListener l2) { this.adapter=adapter; this.id=id; setMembers(((Channel) adapter.getTransport()).getView().getMembers()); setMessageListener(l); setMembershipListener(l2); handler=new PullPushHandler(); transport_adapter=new TransportAdapter(); adapter.addMembershipListener(handler); // remove in stop() if(id == null) { // no other building block around, let's become the main consumer of this PullPushAdapter adapter.setListener(handler); } else { adapter.registerListener(id, handler); } Transport tp; if((tp=adapter.getTransport()) instanceof Channel) { local_addr=((Channel) tp).getLocalAddress(); } start(); }
public MessageDispatcher(PullPushAdapter adapter, Serializable id, MessageListener l, MembershipListener l2, RequestHandler req_handler) { this.adapter=adapter; this.id=id; setMembers(((Channel) adapter.getTransport()).getView().getMembers()); setRequestHandler(req_handler); setMessageListener(l); setMembershipListener(l2); handler=new PullPushHandler(); transport_adapter=new TransportAdapter(); adapter.addMembershipListener(handler); if(id == null) { // no other building block around, let's become the main consumer of this PullPushAdapter adapter.setListener(handler); } else { adapter.registerListener(id, handler); } Transport tp; if((tp=adapter.getTransport()) instanceof Channel) { local_addr=((Channel) tp).getLocalAddress(); // fixed bug #800774 } start(); }
public MessageDispatcher(PullPushAdapter adapter, Serializable id, MessageListener l, MembershipListener l2, RequestHandler req_handler, boolean concurrent_processing) { this.concurrent_processing=concurrent_processing; this.adapter=adapter; this.id=id; setMembers(((Channel) adapter.getTransport()).getView().getMembers()); setRequestHandler(req_handler); setMessageListener(l); setMembershipListener(l2); handler=new PullPushHandler(); transport_adapter=new TransportAdapter(); adapter.addMembershipListener(handler); if(id == null) { // no other building block around, let's become the main consumer of this PullPushAdapter adapter.setListener(handler); } else { adapter.registerListener(id, handler); } Transport tp; if((tp=adapter.getTransport()) instanceof Channel) { local_addr=((Channel) tp).getLocalAddress(); // fixed bug #800774 } start(); }