/** {@inheritDoc} */ @Override protected IgniteBiTuple<Long, List<IgniteExceptionRegistry.ExceptionInfo>> run( Map<UUID, Long> arg) { Long lastOrder = arg.get(ignite.localNode().id()); long order = lastOrder != null ? lastOrder : 0; List<IgniteExceptionRegistry.ExceptionInfo> errors = ignite.context().exceptionRegistry().getErrors(order); List<IgniteExceptionRegistry.ExceptionInfo> wrapped = new ArrayList<>(errors.size()); for (IgniteExceptionRegistry.ExceptionInfo error : errors) { if (error.order() > order) order = error.order(); wrapped.add( new IgniteExceptionRegistry.ExceptionInfo( error.order(), new VisorExceptionWrapper(error.error()), error.message(), error.threadId(), error.threadName(), error.time())); } return new IgniteBiTuple<>(order, wrapped); }
/** * Load grid configuration for specified node type. * * @param type Node type to load configuration for. * @return Grid configuration for specified node type. */ static IgniteConfiguration getConfig(String type) { String path = NODE_CFG.get(type); if (path == null) throw new IllegalArgumentException("Unsupported node type: " + type); URL url = U.resolveIgniteUrl(path); BeanFactory ctx = new FileSystemXmlApplicationContext(url.toString()); return (IgniteConfiguration) ctx.getBean("grid.cfg"); }
/** * Example for start/stop node tasks. * * @param args Not used. */ public static void main(String[] args) { String nodeType = "tcp+ssl"; // Start initial node = 1 try (Ignite g = G.start(NODE_CFG.get(nodeType))) { // Change topology. changeTopology(g, 4, 1, nodeType); changeTopology(g, 1, 4, nodeType); // Stop node by id = 0 g.compute().execute(ClientStopNodeTask.class, g.cluster().localNode().id().toString()); // Wait for node stops. // U.sleep(1000); assert G.allGrids().isEmpty(); } catch (Exception e) { System.err.println("Uncaught exception: " + e.getMessage()); e.printStackTrace(System.err); } }