All Downloads are FREE. Search and download functionalities are using the official Maven repository.

es.codeurjc.squirrel.drey.Node Maven / Gradle / Ivy

Go to download

Java framework aimed to support distributed execution of algorithms thanks to Hazelcast technology

There is a newer version: 2.0.0
Show newest version
package es.codeurjc.squirrel.drey;

import java.io.FileNotFoundException;

import com.hazelcast.config.Config;
import com.hazelcast.config.EntryListenerConfig;
import com.hazelcast.config.FileSystemXmlConfig;
import com.hazelcast.config.MapConfig;
import com.hazelcast.core.Hazelcast;
import com.hazelcast.core.HazelcastInstance;

public class Node {

	HazelcastInstance hc;
	QueuesManager queuesManager;

	public void start(String HAZELCAST_CONFIG, Mode mode) {

		Config cfg = new Config();
		try {
			cfg = new FileSystemXmlConfig(HAZELCAST_CONFIG);
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		}

		this.queuesManager = new QueuesManager(mode);

		MapOfQueuesListener mapOfQueuesListener = new MapOfQueuesListener(queuesManager);

		MapConfig mapConfig = new MapConfig();
		mapConfig.setName("QUEUES");
		mapConfig.addEntryListenerConfig(new EntryListenerConfig(mapOfQueuesListener, false, true));
		cfg.addMapConfig(mapConfig);
		
		this.hc = Hazelcast.newHazelcastInstance(cfg);
		this.queuesManager.initializeHazelcast(hc);
		
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy