Created
June 15, 2016 15:28
-
-
Save ascherbakoff/7c19da8ba568076221598d9d97e96b77 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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