com.hazelcast.core.Hazelcast.shutdownAll()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(7.8k)|赞(0)|评价(0)|浏览(211)

本文整理了Java中com.hazelcast.core.Hazelcast.shutdownAll()方法的一些代码示例,展示了Hazelcast.shutdownAll()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Hazelcast.shutdownAll()方法的具体详情如下:
包路径:com.hazelcast.core.Hazelcast
类名称:Hazelcast
方法名:shutdownAll

Hazelcast.shutdownAll介绍

[英]Shuts down all member HazelcastInstances running on this JVM. It doesn't shutdown all members of the cluster but just the ones running on this JVM.
[中]关闭在此JVM上运行的所有成员实例。它不会关闭集群的所有成员,只关闭在此JVM上运行的成员。

代码示例

代码示例来源:origin: apache/usergrid

public void destroy() {
  logger.info( "Shutting down Hazelcast" );
  Hazelcast.shutdownAll();
  logger.info( "Hazelcast shutdown" );
}

代码示例来源:origin: tfredrich/Domain-Eventing

@Override
public void shutdown()
{
  Hazelcast.shutdownAll();
}

代码示例来源:origin: hazelcast/hazelcast-code-samples

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();
  }
}

代码示例来源:origin: hazelcast/hazelcast-code-samples

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();
  }
}

代码示例来源:origin: hazelcast/hazelcast-code-samples

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();
  }
}

代码示例来源:origin: hazelcast/hazelcast-code-samples

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();
  }
}

代码示例来源:origin: hazelcast/hazelcast-code-samples

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();
  }
}

代码示例来源:origin: hazelcast/hazelcast-jet

/**
 * Shuts down all running Jet client and member instances.
 */
public static void shutdownAll() {
  HazelcastClient.shutdownAll();
  Hazelcast.shutdownAll();
}

代码示例来源:origin: hazelcast/hazelcast-code-samples

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();
  }
}

代码示例来源:origin: hazelcast/hazelcast-code-samples

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();
  }
}

代码示例来源:origin: hazelcast/hazelcast-code-samples

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();
  }
}

代码示例来源:origin: hazelcast/hazelcast-code-samples

public static void main(String[] args) {
  HazelcastInstance hz = Hazelcast.newHazelcastInstance();
  test(hz, true);
  test(hz, false);
  Hazelcast.shutdownAll();
}

代码示例来源:origin: hazelcast/hazelcast-code-samples

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();
  }
}

代码示例来源:origin: hazelcast/hazelcast-code-samples

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();
  }
}

代码示例来源:origin: hazelcast/hazelcast-code-samples

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();
  }
}

代码示例来源:origin: hazelcast/hazelcast-code-samples

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();
}

代码示例来源:origin: net.di2e.ecdr.libs/cdr-libs-cache

@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();
}

代码示例来源:origin: hazelcast/hazelcast-code-samples

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();
  }
}

代码示例来源:origin: hazelcast/hazelcast-code-samples

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();
  }
}

代码示例来源:origin: hazelcast/hazelcast-code-samples

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();
  }
}

相关文章