BAEL-1486 - small changes to JGroups (#3590)
* BAEL-1486 - sample code for JGroups. Fixed a typo in InfluxDB. * BAEL-1486 - updates for JGroups.
This commit is contained in:
parent
d75f6fc58a
commit
372cba10bb
|
@ -100,21 +100,16 @@ public class JGroupsMessenger extends ReceiverAdapter {
|
|||
System.out.println("Received initial view:");
|
||||
newView.forEach(System.out::println);
|
||||
} else {
|
||||
|
||||
// Compare to last view
|
||||
System.out.println("Received new view.");
|
||||
|
||||
List<Address> newMembers = View.newMembers(lastView, newView);
|
||||
if (newMembers.size() > 0) {
|
||||
System.out.println("New members: ");
|
||||
newMembers.forEach(System.out::println);
|
||||
}
|
||||
System.out.println("New members: ");
|
||||
newMembers.forEach(System.out::println);
|
||||
|
||||
List<Address> exMembers = View.leftMembers(lastView, newView);
|
||||
if (exMembers.size() > 0) {
|
||||
System.out.println("Exited members:");
|
||||
exMembers.forEach(System.out::println);
|
||||
}
|
||||
System.out.println("Exited members:");
|
||||
exMembers.forEach(System.out::println);
|
||||
}
|
||||
lastView = newView;
|
||||
}
|
||||
|
@ -122,7 +117,7 @@ public class JGroupsMessenger extends ReceiverAdapter {
|
|||
/**
|
||||
* Loop on console input until we see 'x' to exit
|
||||
*/
|
||||
private void processInput() {
|
||||
private void processInput() throws Exception {
|
||||
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
|
||||
while (running) {
|
||||
|
@ -138,13 +133,8 @@ public class JGroupsMessenger extends ReceiverAdapter {
|
|||
running = false;
|
||||
continue;
|
||||
} else if (!destinationName.isEmpty()) {
|
||||
Optional<Address> optDestination = getAddress(destinationName);
|
||||
if (optDestination.isPresent()) {
|
||||
destination = optDestination.get();
|
||||
} else {
|
||||
System.out.println("Destination not found, try again.");
|
||||
continue;
|
||||
}
|
||||
destination = getAddress(destinationName)
|
||||
. orElseThrow(() -> new Exception("Destination not found"));
|
||||
}
|
||||
|
||||
// Accept a string to send
|
||||
|
|
Loading…
Reference in New Issue