Package com.hazelcast.core

Examples of com.hazelcast.core.HazelcastInstance


        try {
            clientConfig = new XmlClientConfigBuilder("hazelcast-client.xml").build();
        } catch (IllegalArgumentException e) {
            clientConfig = new ClientConfig();
        }
        final HazelcastInstance client = HazelcastClient.newHazelcastClient(clientConfig);
        ClientConsoleApp clientConsoleApp = new ClientConsoleApp(client);
        clientConsoleApp.start(args);
    }
View Full Code Here


    private static final long serialVersionUID = -5507109519171389464L;

    protected HazelcastCacheRegionFactory hazelcastCacheRegionFactory;

    public KnappsackIntegrationTestCacheRegionFactory() {
        HazelcastInstance instance = Hazelcast.getHazelcastInstanceByName("integration-test-instance");
        if(instance == null) {
            Config config = getConfig();
            this.hazelcastCacheRegionFactory = new HazelcastCacheRegionFactory(Hazelcast.newHazelcastInstance(config));
        } else {
            this.hazelcastCacheRegionFactory = new HazelcastCacheRegionFactory(instance);
View Full Code Here

    @Test
    public void testDefaultInstance() throws InterruptedException {
        HazelcastServiceFactory factory = new HazelcastServiceFactory();
        factory.init();
        factory.getInstance();
        HazelcastInstance defaultInstance = Hazelcast.newHazelcastInstance(null);

        HazelcastInstance factoryInstance = factory.getInstance();
        Assert.assertEquals(true, factoryInstance.getCluster().getMembers().size() >= 2);
    }
View Full Code Here

public class RegistryTestCase {

    @Test
    public void test1() throws UnknownHostException {

        HazelcastInstance h1 = create("54327", 9001);

        IMap<Object, Object> h1map = h1.getMap("mymap");
        h1map.put("key1", "bla1");
        Assert.assertEquals("bla1", h1map.get("key1"));

        HazelcastInstance h2 = create("false", 9002, 9001);
        IMap<Object, Object> h2map = h2.getMap("mymap");
        Assert.assertEquals("bla1", h2map.get("key1"));

        HazelcastInstance h3 = create("false", 9003, 9002);
        IMap<Object, Object> h3map = h3.getMap("mymap");
        Assert.assertEquals("bla1", h3map.get("key1"));

        h3map.put("k3", "v3");
        h2map.put("k2", "v2");
       
        Assert.assertEquals("v2", h1map.get("k2"));
        Assert.assertEquals("v3", h1map.get("k3"));
        Assert.assertEquals("v2", h2map.get("k2"));
        Assert.assertEquals("v3", h2map.get("k3"));
        Assert.assertEquals("v2", h3map.get("k2"));
        Assert.assertEquals("v3", h3map.get("k3"));
       
        HazelcastInstance h4 = create("54328", 9004, 9001);
        IMap<Object, Object> h4map = h4.getMap("mymap");
//        Assert.assertNull(h4map.get("k2"));
//        Assert.assertNull(h4map.get("k3"));
        Assert.assertEquals("v2", h4map.get("k2"));
        Assert.assertEquals("v3", h4map.get("k3"));

//        HazelcastInstance h5 = create("false", 9005, 9003, 9004);
        HazelcastInstance h5 = create("54328", 9005);

//        Assert.assertEquals("v2", h4map.get("k2"));
//        Assert.assertEquals("v3", h4map.get("k3"));
       
        IMap<Object, Object> h5map = h5.getMap("mymap");
        Assert.assertEquals("v2", h5map.get("k2"));
        Assert.assertEquals("v3", h5map.get("k3"));
       
        h1.shutdown();
       
View Full Code Here

    private MultiMap<String, Object> map;

    @Override
    protected void doPostSetup() throws Exception {
        HazelcastComponent component = context().getComponent("hazelcast", HazelcastComponent.class);
        HazelcastInstance hazelcastInstance = component.getHazelcastInstance();
        this.map = hazelcastInstance.getMultiMap("bar");
        this.map.clear();
    }
View Full Code Here

    private IMap<String, Object> map;

    @Override
    protected void doPostSetup() throws Exception {
        HazelcastComponent component = context().getComponent("hazelcast", HazelcastComponent.class);
        HazelcastInstance hazelcastInstance = component.getHazelcastInstance();
        map = hazelcastInstance.getMap("foo");
        map.clear();
    }
View Full Code Here

    private MultiMap<String, Object> map;
   
    @Override
    protected void doPostSetup() throws Exception {
        HazelcastComponent component = context().getComponent("hazelcast", HazelcastComponent.class);
        HazelcastInstance hazelcastInstance = component.getHazelcastInstance();
        this.map = hazelcastInstance.getMultiMap("foo");
        this.map.clear();
    }
View Full Code Here

    @Override
    protected void doPostSetup() throws Exception {
        super.doPostSetup();
        HazelcastComponent component = context().getComponent("hazelcast", HazelcastComponent.class);
        HazelcastInstance hazelcastInstance = component.getHazelcastInstance();
        this.map = hazelcastInstance.getMap("foo");
        this.map.clear();
    }
View Full Code Here

  private IMap<K, V> map;
 
  public MapHandler(String ip, String mapName) {
   
    if (CommonTools.isLocal(ip)) {
      HazelcastInstance hzI = Hazelcast.getHazelcastInstanceByName(E3Constant.HAZELCAST_NAME);
     
      if (hzI != null) {
        map = hzI.getMap(mapName);
      }
      else {
        logger.error("No HazelcastInstance found");
      }
    } else {
View Full Code Here

  protected IQueue<V> queue;
 
  public QueueHandler(String ip, String queueName) {

    if (CommonTools.isLocal(ip)) {
      HazelcastInstance hzI = Hazelcast.getHazelcastInstanceByName(E3Constant.HAZELCAST_NAME);
     
      if (hzI != null) {
        queue = hzI.getQueue(queueName);
      }
      else {
        // TODO log
        System.out.println("QueueHandler: HazelcastInstance not found");
      }
View Full Code Here

TOP

Related Classes of com.hazelcast.core.HazelcastInstance

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.