/** * Main function * * @param args */ public static void main(String[] args) { JWhiteBoard whiteBoard = null; String props = null; boolean no_channel = false; boolean jmx = true; boolean use_state = false; String group_name = null; long state_timeout = 5000; boolean use_unicasts = false; String name = null; boolean send_own_state_on_merge = true; AddressGenerator generator = null; // Get startup parameters for JWhiteBoard for (int i = 0; i < args.length; i++) { // Show help if ("-help".equals(args[i])) { help(); return; } // Properties for Channel if ("-props".equals(args[i])) { props = args[++i]; continue; } // If existed, use no channel if ("-no_channel".equals(args[i])) { no_channel = true; continue; } // Use Java Management Extensions or not if ("-jmx".equals(args[i])) { jmx = Boolean.parseBoolean(args[++i]); continue; } // If existed, set name for the Group if ("-clustername".equals(args[i])) { group_name = args[++i]; continue; } // If existed, save Group's state if ("-state".equals(args[i])) { use_state = true; continue; } // If existed, set timeout for state if ("-timeout".equals(args[i])) { state_timeout = Long.parseLong(args[++i]); continue; } if ("-bind_addr".equals(args[i])) { System.setProperty("jgroups.bind_addr", args[++i]); continue; } if ("-use_unicasts".equals(args[i])) { use_unicasts = true; continue; } if ("-name".equals(args[i])) { name = args[++i]; continue; } if ("-send_own_state_on_merge".equals(args[i])) { send_own_state_on_merge = Boolean.getBoolean(args[++i]); continue; } if ("-uuid".equals(args[i])) { generator = new OneTimeAddressGenerator(Long.valueOf(args[++i])); continue; } help(); return; } try { whiteBoard = new JWhiteBoard( props, no_channel, jmx, use_state, state_timeout, use_unicasts, name, send_own_state_on_merge, generator); if (group_name == null) whiteBoard.setGroupName(group_name); whiteBoard.go(); } catch (Throwable e) { e.printStackTrace(System.err); System.exit(0); } }