public void destroy() { logger.info( "Shutting down Hazelcast" ); Hazelcast.shutdownAll(); logger.info( "Hazelcast shutdown" ); }
@Override public void shutdown() { Hazelcast.shutdownAll(); }
public static void main(String[] args) { HazelcastInstance hz = Hazelcast.newHazelcastInstance(); Map<String, Person> map = hz.getMap("map"); map.put("Peter", new Person("Peter")); Person person = map.get("Peter"); System.out.println(person); Hazelcast.shutdownAll(); } }
public static void main(String[] args) { HazelcastInstance hz = Hazelcast.newHazelcastInstance(); Map<String, Person> map = hz.getMap("map"); map.put("Peter", new Person("Peter")); Person person = map.get("Peter"); System.out.println(person); Hazelcast.shutdownAll(); } }
public static void main(String[] args) { HazelcastInstance hz = Hazelcast.newHazelcastInstance(); Map<String, Person> map = hz.getMap("map"); map.put("Peter", new Person("Peter")); Person person = map.get("Peter"); System.out.println(person); Hazelcast.shutdownAll(); } }
public static void main(String[] args) { HazelcastInstance hz = Hazelcast.newHazelcastInstance(); Map<String, Person> map = hz.getMap("map"); map.put("Peter", new Person("Peter")); Person person = map.get("Peter"); System.out.println(person); Hazelcast.shutdownAll(); } }
public static void main(String[] args) { HazelcastInstance hz = Hazelcast.newHazelcastInstance(); Map<String, Person> map = hz.getMap("map"); map.put("Peter", new Person("Peter")); Person person = map.get("Peter"); System.out.println(person); Hazelcast.shutdownAll(); } }
/** * Shuts down all running Jet client and member instances. */ public static void shutdownAll() { HazelcastClient.shutdownAll(); Hazelcast.shutdownAll(); }
public static void main(String[] args) { HazelcastInstance hz = Hazelcast.newHazelcastInstance(); Map<String, Person> map = hz.getMap("map"); Person person = new Person("peter"); map.put(person.getName(), person); System.out.println(map.get(person.getName())); Hazelcast.shutdownAll(); } }
public static void main(String[] args) { System.setProperty("hazelcast.jcache.provider.type", "client"); ApplicationContext applicationContext = new AnnotationConfigApplicationContext(AppConfig.class); doInvocation(applicationContext); HazelcastClient.shutdownAll(); Hazelcast.shutdownAll(); } }
public static void main(String[] args) throws Exception { HazelcastInstance[] instances = new HazelcastInstance[2]; for (int i = 0; i < instances.length; i++) { HazelcastInstance instance = Hazelcast.newHazelcastInstance(); instances[i] = instance; } Counter counter = instances[0].getDistributedObject(CounterService.NAME, "counter"); counter.inc(1); System.out.println("Finished"); Hazelcast.shutdownAll(); } }
public static void main(String[] args) { HazelcastInstance hz = Hazelcast.newHazelcastInstance(); test(hz, true); test(hz, false); Hazelcast.shutdownAll(); }
public static void main(String[] args) { HazelcastInstance hz = Hazelcast.newHazelcastInstance(); IAtomicReference<String> ref = hz.getAtomicReference("reference"); ref.set("foo"); System.out.println(ref.get()); Hazelcast.shutdownAll(); } }
public static void main(String[] args) { EchoService echoService = new EchoService(); Config config = new Config(); config.getUserContext().put("echoService", echoService); HazelcastInstance hz = Hazelcast.newHazelcastInstance(config); IExecutorService executor = hz.getExecutorService("echoExecutor"); executor.execute(new EchoTask("hello")); Hazelcast.shutdownAll(); } }
public static void main(String[] args) { HazelcastInstance hz = Hazelcast.newHazelcastInstance(); IMap<String, Customer> map = hz.getMap("map"); map.put("1", new Customer("peter", true, 36)); map.put("2", new Customer("john", false, 40)); map.put("3", new Customer("roger", true, 20)); Set<Customer> employees = (Set<Customer>) map.values(new SqlPredicate("active AND age < 30")); System.out.println("Employees: " + employees); Hazelcast.shutdownAll(); } }
public static void main(String[] args) { HazelcastInstance hz = Hazelcast.newHazelcastInstance(); IMap<String, Employee> employees = hz.getMap("employees"); employees.put("John", new Employee(1000)); employees.put("Mark", new Employee(1000)); employees.put("Spencer", new Employee(1000)); employees.executeOnEntries(new EmployeeRaiseEntryProcessor()); for (Map.Entry<String, Employee> entry : employees.entrySet()) { System.out.println(entry.getKey() + " salary: " + entry.getValue().getSalary()); } Hazelcast.shutdownAll(); }
@Override public void destroy() { LOGGER.debug( "Destroying all active caches and destroying the Cache Manager" ); for ( String cacheId : cacheManager.getCacheNames() ) { cacheManager.destroyCache( CACHE_ID_PREFIX + cacheId ); } cacheManager.close(); cachingProvider.close(); Hazelcast.shutdownAll(); }
public static void main(String[] args) throws Exception { HazelcastInstance instance = Hazelcast.newHazelcastInstance(); IScheduledExecutorService scheduler = instance.getScheduledExecutorService("scheduler"); IScheduledFuture<String> future = scheduler.scheduleOnMember(new EchoTask("My Task"), instance.getCluster().getLocalMember(), 5, TimeUnit.SECONDS); Object result = future.get(); System.out.println("Result: " + result); future.dispose(); Hazelcast.shutdownAll(); } }
public static void main(String[] args) throws Exception { HazelcastInstance instance = Hazelcast.newHazelcastInstance(); IScheduledExecutorService scheduler = instance.getScheduledExecutorService("scheduler"); IScheduledFuture<String> future = scheduler.schedule(named("MyTask", new EchoTask("foobar")), 5, TimeUnit.SECONDS); Object result = future.get(); System.out.println(future.getHandler().getTaskName() + " result: " + result); future.dispose(); Hazelcast.shutdownAll(); } }
public static void main(String[] args) throws ParseException { HazelcastInstance hz = Hazelcast.newHazelcastInstance(); IMap<Integer, Car> map = hz.getMap("cars"); map.put(1, new Car("Audi Q7").setTrip(1000, 3000)); map.put(2, new Car("BMW X5").setTrip(3000, 5000)); map.put(3, new Car("Porsche Cayenne").setTrip(2000, 8000)); // we're using a custom 'tripDistance' attribute which is provided by the 'CarTripDistanceExtractor' Set<Car> cars = (Set<Car>) map.values(new SqlPredicate("tripDistance < 3000")); System.out.println("Cars: " + cars); Hazelcast.shutdownAll(); } }