Package com.hazelcast.config

Examples of com.hazelcast.config.Config


public class KnappsackCacheRegionFactory extends KnappsackAbstractCache implements RegionFactory {

    private HazelcastCacheRegionFactory hazelcastCacheRegionFactory;

    public KnappsackCacheRegionFactory() {
        Config config = getConfig();
        this.hazelcastCacheRegionFactory = new HazelcastCacheRegionFactory(Hazelcast.newHazelcastInstance(config));
    }
View Full Code Here


     * @param mapName    name of map which owns near cache.
     * @param nodeEngine node engine.
     */
    public NearCache(String mapName, NodeEngine nodeEngine) {
        this.nodeEngine = nodeEngine;
        Config config = nodeEngine.getConfig();
        NearCacheConfig nearCacheConfig = config.findMapConfig(mapName).getNearCacheConfig();
        maxSize = nearCacheConfig.getMaxSize() <= 0 ? Integer.MAX_VALUE : nearCacheConfig.getMaxSize();
        maxIdleMillis = TimeUnit.SECONDS.toMillis(nearCacheConfig.getMaxIdleSeconds());
        inMemoryFormat = nearCacheConfig.getInMemoryFormat();
        timeToLiveMillis = TimeUnit.SECONDS.toMillis(nearCacheConfig.getTimeToLiveSeconds());
        evictionPolicy = EvictionPolicy.valueOf(nearCacheConfig.getEvictionPolicy());
View Full Code Here

     *
     * @param args none
     * @throws Exception
     */
    public static void main(String[] args) throws Exception {
        Config config;

        try {
            config = new FileSystemXmlConfig("hazelcast.xml");
        } catch (FileNotFoundException e) {
            config = new Config();
        }

        for (int k = 1; k <= LOAD_EXECUTORS_COUNT; k++) {
            config.addExecutorConfig(new ExecutorConfig("e" + k).setPoolSize(k));
        }
        ConsoleApp consoleApp = new ConsoleApp(Hazelcast.newHazelcastInstance(null));
        consoleApp.start(args);
    }
View Full Code Here

    }

    private void createMemState(MemberStateImpl memberState,
                                Collection<DistributedObject> distributedObjects) {
        int count = 0;
        final Config config = instance.getConfig();
        final Iterator<DistributedObject> iterator = distributedObjects.iterator();
        while (iterator.hasNext() && count < maxVisibleInstanceCount) {
            DistributedObject distributedObject = iterator.next();
            if (distributedObject instanceof IMap) {
                count = handleMap(memberState, count, config, (IMap) distributedObject);
View Full Code Here

    }

    private void collectInstanceNames(Set<String> setLongInstanceNames,
                                      Collection<DistributedObject> distributedObjects) {
        int count = 0;
        final Config config = instance.getConfig();
        for (DistributedObject distributedObject : distributedObjects) {
            if (count < maxVisibleInstanceCount) {
                if (distributedObject instanceof MultiMap) {
                    count = collectMultiMapName(setLongInstanceNames, count, config, (MultiMap) distributedObject);
                } else if (distributedObject instanceof IMap) {
View Full Code Here

    private volatile boolean running = true;

    public MulticastService(Node node, MulticastSocket multicastSocket) throws Exception {
        this.node = node;
        logger = node.getLogger(MulticastService.class.getName());
        Config config = node.getConfig();
        this.multicastSocket = multicastSocket;

        sendOutput = node.getSerializationService().createObjectDataOutput(1024);
        datagramPacketReceive = new DatagramPacket(new byte[DATAGRAM_BUFFER_SIZE], DATAGRAM_BUFFER_SIZE);
        final MulticastConfig multicastConfig = config.getNetworkConfig().getJoin().getMulticastConfig();
        datagramPacketSend = new DatagramPacket(new byte[0], 0, InetAddress
                .getByName(multicastConfig.getMulticastGroup()), multicastConfig.getMulticastPort());
        running = true;
    }
View Full Code Here

    @Override
    public void writeResponse(ManagementCenterService mcs, JsonObject root) {
        final JsonObject result = new JsonObject();
        ConfigXmlGenerator configXmlGenerator = new ConfigXmlGenerator(true);
        Config config = mcs.getHazelcastInstance().getConfig();
        String configXmlString = configXmlGenerator.generate(config);
        result.add("configXmlString", configXmlString);
        root.add("result", result);
    }
View Full Code Here

  /**
   * @return Hazelcast configuration; ensures semaphores start with {@link Integer#MAX_VALUE} permits by default
   */
  private static Config getHazelcastConfig(final File configFile) {
    final Config config;
    if (null != configFile && configFile.isFile()) {
      try {
        config = new FileSystemXmlConfig(configFile);
      }
      catch (final FileNotFoundException e) {
        throw new IllegalArgumentException(e.getMessage());
      }
    }
    else {
      config = new XmlConfigBuilder().build();
    }

    config.getSemaphoreConfig("default").setInitialPermits(Integer.MAX_VALUE);
    config.setClassLoader(Hazelcast.class.getClassLoader());

    return config;
  }
View Full Code Here

    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

            this.hazelcastCacheRegionFactory = new HazelcastCacheRegionFactory(instance);
        }
    }

    protected Config getConfig() {
        Config config = new Config();
        GroupConfig groupConfig = new GroupConfig();
        groupConfig.setName("knappsack-integration-test-cache");
        groupConfig.setPassword("password1234");
        config.setGroupConfig(groupConfig);
        config.setInstanceName("integration-test-instance");

        return config;
    }
View Full Code Here

TOP

Related Classes of com.hazelcast.config.Config

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.