Package co.paralleluniverse.galaxy

Examples of co.paralleluniverse.galaxy.Grid


                props.setProperty("galaxy.port", Integer.toString(7050 + peerNum));
                props.setProperty("galaxy.slave_port", Integer.toString(8050 + peerNum));
                props.setProperty("galaxy.multicast.address", "225.0.0.1");
                props.setProperty("galaxy.multicast.port", Integer.toString(7050));

                final Grid grid = Grid.getInstance(pathToResource(configpeerxml), props);
                grid.goOnline();
                final SettableFuture<Short> future = SettableFuture.create();
                grid.cluster().addNodeChangeListener(new NodeChangeListener() {
                    @Override
                    public void nodeAdded(short id) {
                        if (id > grid.cluster().getMyNodeId()) {
                            System.out.println("Larger peer added !!");
                            future.set(id);
                        }
                    }

                    @Override
                    public void nodeSwitched(short id) {
                    }

                    @Override
                    public void nodeRemoved(short id) {
                    }
                });
                for (Short node : grid.cluster().getNodes()) {
                    if (node > grid.cluster().getMyNodeId()) {
                        System.out.println("Larger peer have already up !!");
                        return node;
                    }
                }
                return future.get();
View Full Code Here

TOP

Related Classes of co.paralleluniverse.galaxy.Grid

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.