Created
January 31, 2016 09:04
-
-
Save gurbuzali/a87bc828404d9a062267 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 void main(String[] args) { | |
| HazelcastInstance instance1 = Hazelcast.newHazelcastInstance(); | |
| HazelcastInstance instance2 = Hazelcast.newHazelcastInstance(); | |
| HazelcastInstance instance3 = Hazelcast.newHazelcastInstance(); | |
| HazelcastInstance instance4 = Hazelcast.newHazelcastInstance(); | |
| IExecutorService exec = instance1.getExecutorService("exec"); | |
| exec.submitToAllMembers(new MyCallable()); | |
| } | |
| static class MyCallable implements Callable, HazelcastInstanceAware, Serializable { | |
| transient HazelcastInstance instance; | |
| @Override | |
| public Object call() throws Exception { | |
| long threadId = Thread.currentThread().getId(); | |
| System.err.println("instance: " + instance.getName() + ", threadId: " + threadId); | |
| return null; | |
| } | |
| @Override | |
| public void setHazelcastInstance(HazelcastInstance hazelcastInstance) { | |
| this.instance = hazelcastInstance; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment