/** * Starts grid with given configuration. Note that this method will throw and exception if grid with the name * provided in given configuration is already started. * * @param cfg Grid configuration. This cannot be {@code null}. * @param springCtx Optional Spring application context, possibly {@code null}. * Spring bean definitions for bean injection are taken from this context. * If provided, this context can be injected into grid tasks and grid jobs using * {@link SpringApplicationContextResource @SpringApplicationContextResource} annotation. * @return Started grid. * @throws IgniteCheckedException If grid could not be started. This exception will be thrown * also if named grid has already been started. */ public static Ignite start(IgniteConfiguration cfg, @Nullable GridSpringResourceContext springCtx) throws IgniteCheckedException { A.notNull(cfg, "cfg"); return start0(new GridStartContext(cfg, null, springCtx), true).get1().grid(); }
/** * Starts grid with given configuration. If the grid is already started and failIfStarted set to TRUE * an exception will be thrown. * * @param cfg Grid configuration. This cannot be {@code null}. * @param springCtx Optional Spring application context, possibly {@code null}. * Spring bean definitions for bean injection are taken from this context. * If provided, this context can be injected into grid tasks and grid jobs using * {@link SpringApplicationContextResource @SpringApplicationContextResource} annotation. * @param failIfStarted Throw or not an exception if grid is already started. * @return Tuple with: grid instance and flag to indicate the instance is started by this call. * So, when the new ignite instance is started the flag is {@code true}. If an existing instance is returned * the flag is {@code false}. * @throws IgniteCheckedException If grid could not be started. This exception will be thrown * also if named grid has already been started. */ public static T2<Ignite, Boolean> start(IgniteConfiguration cfg, @Nullable GridSpringResourceContext springCtx, boolean failIfStarted) throws IgniteCheckedException { A.notNull(cfg, "cfg"); T2<IgniteNamedInstance, Boolean> res = start0(new GridStartContext(cfg, null, springCtx), failIfStarted); return new T2<>((Ignite)res.get1().grid(), res.get2()); }
IgniteNamedInstance grid = start0( new GridStartContext(cfg, springCfgUrl, springCtx == null ? cfgMap.get2() : springCtx), true).get1();
/** * Starts grid with default configuration. By default this method will * use grid configuration defined in {@code IGNITE_HOME/config/default-config.xml} * configuration file. If such file is not found, then all system defaults will be used. * * @param springCtx Optional Spring application context, possibly {@code null}. * Spring bean definitions for bean injection are taken from this context. * If provided, this context can be injected into grid tasks and grid jobs using * {@link SpringApplicationContextResource @SpringApplicationContextResource} annotation. * @return Started grid. * @throws IgniteCheckedException If default grid could not be started. This exception will be thrown * also if default grid has already been started. */ public static Ignite start(@Nullable GridSpringResourceContext springCtx) throws IgniteCheckedException { URL url = U.resolveIgniteUrl(DFLT_CFG); if (url != null) return start(DFLT_CFG, null, springCtx, null); U.warn(null, "Default Spring XML file not found (is IGNITE_HOME set?): " + DFLT_CFG); return start0(new GridStartContext(new IgniteConfiguration(), null, springCtx), true) .get1().grid(); }
/** * Starts grid with given configuration. Note that this method will throw and exception if grid with the name * provided in given configuration is already started. * * @param cfg Grid configuration. This cannot be {@code null}. * @param springCtx Optional Spring application context, possibly {@code null}. * Spring bean definitions for bean injection are taken from this context. * If provided, this context can be injected into grid tasks and grid jobs using * {@link SpringApplicationContextResource @SpringApplicationContextResource} annotation. * @return Started grid. * @throws IgniteCheckedException If grid could not be started. This exception will be thrown * also if named grid has already been started. */ public static Ignite start(IgniteConfiguration cfg, @Nullable GridSpringResourceContext springCtx) throws IgniteCheckedException { A.notNull(cfg, "cfg"); return start0(new GridStartContext(cfg, null, springCtx), true).get1().grid(); }
/** * Starts grid with given configuration. If the grid is already started and failIfStarted set to TRUE * an exception will be thrown. * * @param cfg Grid configuration. This cannot be {@code null}. * @param springCtx Optional Spring application context, possibly {@code null}. * Spring bean definitions for bean injection are taken from this context. * If provided, this context can be injected into grid tasks and grid jobs using * {@link SpringApplicationContextResource @SpringApplicationContextResource} annotation. * @param failIfStarted Throw or not an exception if grid is already started. * @return Tuple with: grid instance and flag to indicate the instance is started by this call. * So, when the new ignite instance is started the flag is {@code true}. If an existing instance is returned * the flag is {@code false}. * @throws IgniteCheckedException If grid could not be started. This exception will be thrown * also if named grid has already been started. */ public static T2<Ignite, Boolean> start(IgniteConfiguration cfg, @Nullable GridSpringResourceContext springCtx, boolean failIfStarted) throws IgniteCheckedException { A.notNull(cfg, "cfg"); T2<IgniteNamedInstance, Boolean> res = start0(new GridStartContext(cfg, null, springCtx), failIfStarted); return new T2<>((Ignite)res.get1().grid(), res.get2()); }
IgniteNamedInstance grid = start0( new GridStartContext(cfg, springCfgUrl, springCtx == null ? cfgMap.get2() : springCtx), true).get1();
/** * Starts grid with default configuration. By default this method will * use grid configuration defined in {@code IGNITE_HOME/config/default-config.xml} * configuration file. If such file is not found, then all system defaults will be used. * * @param springCtx Optional Spring application context, possibly {@code null}. * Spring bean definitions for bean injection are taken from this context. * If provided, this context can be injected into grid tasks and grid jobs using * {@link SpringApplicationContextResource @SpringApplicationContextResource} annotation. * @return Started grid. * @throws IgniteCheckedException If default grid could not be started. This exception will be thrown * also if default grid has already been started. */ public static Ignite start(@Nullable GridSpringResourceContext springCtx) throws IgniteCheckedException { URL url = U.resolveIgniteUrl(DFLT_CFG); if (url != null) return start(DFLT_CFG, null, springCtx, null); U.warn(null, "Default Spring XML file not found (is IGNITE_HOME set?): " + DFLT_CFG); return start0(new GridStartContext(new IgniteConfiguration(), null, springCtx), true) .get1().grid(); }