Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ascherbakoff/7c19da8ba568076221598d9d97e96b77 to your computer and use it in GitHub Desktop.
Save ascherbakoff/7c19da8ba568076221598d9d97e96b77 to your computer and use it in GitHub Desktop.
public static final int GRID_CNT = 3;
static public void main(String... args) {
// -- spark context
SparkConf conf = new SparkConf();
conf.set("spark.executor.instances", String.valueOf(GRID_CNT));
JavaSparkContext sc = new JavaSparkContext("local[" + GRID_CNT + "]", "test", conf);
// -- ignite configuration
IgniteOutClosure cfg = new IgniteOutClosure() {
@Override
public Object apply() {
IgniteConfiguration cfg = new IgniteConfiguration();
return cfg;
}
};
// -- ignite context
JavaIgniteContext<Integer,Integer> ic = new JavaIgniteContext<Integer,Integer>(sc, cfg, false);
final Ignite ignite = ic.ignite();
ignite
.compute()
.broadcast(new IgniteRunnable() {
@Override
public void run() {
System.out.println(">>> Hello Node: " + ignite.cluster().localNode().id());
}
});
ic.close(true);
System.out.println(">>> DONE");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment