示例#1
0
    public void shutdown() {
      if (connectionFactory != null) {
        connectionFactory.shutdown();
        connectionFactory = null;
      }

      if (hazelcast != null) {
        hazelcast.getLifecycleService().shutdown();
        hazelcast = null;
      }
    }
示例#2
0
    public void restart() {
      if (hazelcast != null) {
        shutdown();
      }

      hazelcast = Hazelcast.newHazelcastInstance(config);

      HazelcastMQConfig mqConfig = new HazelcastMQConfig();
      mqConfig.setHazelcastInstance(hazelcast);

      connectionFactory = HazelcastMQ.newHazelcastMQInstance(mqConfig);
      mqContext = connectionFactory.createContext();
    }