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:");
|
System.out.println("Received initial view:");
|
||||||
newView.forEach(System.out::println);
|
newView.forEach(System.out::println);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// Compare to last view
|
// Compare to last view
|
||||||
System.out.println("Received new view.");
|
System.out.println("Received new view.");
|
||||||
|
|
||||||
List<Address> newMembers = View.newMembers(lastView, newView);
|
List<Address> newMembers = View.newMembers(lastView, newView);
|
||||||
if (newMembers.size() > 0) {
|
System.out.println("New members: ");
|
||||||
System.out.println("New members: ");
|
newMembers.forEach(System.out::println);
|
||||||
newMembers.forEach(System.out::println);
|
|
||||||
}
|
|
||||||
|
|
||||||
List<Address> exMembers = View.leftMembers(lastView, newView);
|
List<Address> exMembers = View.leftMembers(lastView, newView);
|
||||||
if (exMembers.size() > 0) {
|
System.out.println("Exited members:");
|
||||||
System.out.println("Exited members:");
|
exMembers.forEach(System.out::println);
|
||||||
exMembers.forEach(System.out::println);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
lastView = newView;
|
lastView = newView;
|
||||||
}
|
}
|
||||||
@ -122,7 +117,7 @@ public class JGroupsMessenger extends ReceiverAdapter {
|
|||||||
/**
|
/**
|
||||||
* Loop on console input until we see 'x' to exit
|
* 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));
|
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
|
||||||
while (running) {
|
while (running) {
|
||||||
@ -138,13 +133,8 @@ public class JGroupsMessenger extends ReceiverAdapter {
|
|||||||
running = false;
|
running = false;
|
||||||
continue;
|
continue;
|
||||||
} else if (!destinationName.isEmpty()) {
|
} else if (!destinationName.isEmpty()) {
|
||||||
Optional<Address> optDestination = getAddress(destinationName);
|
destination = getAddress(destinationName)
|
||||||
if (optDestination.isPresent()) {
|
. orElseThrow(() -> new Exception("Destination not found"));
|
||||||
destination = optDestination.get();
|
|
||||||
} else {
|
|
||||||
System.out.println("Destination not found, try again.");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Accept a string to send
|
// Accept a string to send
|
||||||
|
Loading…
x
Reference in New Issue
Block a user