public DistQueueConfig setup(Config cfg, String name, QueueStore<URLInfo> storeImplementation) { QueueConfig qConfig = new QueueConfig(); //TODO: Refactor the configuration entries qConfig.setName(name); qConfig.setBackupCount(1); if(storeImplementation != null) { QueueStoreConfig storeConfig = new QueueStoreConfig(); storeConfig.setStoreImplementation(storeImplementation); storeConfig.setProperty("memory-limit", "30"); qConfig.setQueueStoreConfig(storeConfig); //todo Refactor to Config } cfg.addQueueConfig(qConfig); return this; }
private void setQueueConfig(Config config) { QueueConfig queue = config.getQueueConfig("cz.eetlite"); queue.setBackupCount(1); queue.setMaxSize(0); queue.setEmptyQueueTtl(0); QueueStoreConfig queueStoreConfig = null; // queue.setQueueStoreConfig(queueStoreConfig); queue.setStatisticsEnabled(true); }
private static void run() { Config config = new Config("queueTest"); QueueConfig queueConfig = config.getQueueConfig(QNAME); QueueStoreConfig queueStoreConfig = new QueueStoreConfig(); queueStoreConfig.setEnabled(true); queueStoreConfig.setStoreImplementation(new MockQueueStore()); queueStoreConfig.getProperties().setProperty("memory-limit", "0"); queueConfig.setQueueStoreConfig(queueStoreConfig); HazelcastInstance hzInstance = Hazelcast.newHazelcastInstance(config); IQueue<Integer> queue = hzInstance.getQueue(QNAME); long startTime = System.currentTimeMillis(); int i = 0; while (i++ < 2000000) { if (i % 10000 == 0) { logger.info(Integer.toString(i) + "\t" + String.format("%8.3f", (double) (System.currentTimeMillis() - startTime) / i)); } queue.add(i); } }
private static Config createConfig(String name) { Config config = new Config(name); QueueConfig queueConfig = config.getQueueConfig(QNAME); queueConfig.setBackupCount(0); QueueStoreConfig queueStoreConfig = new QueueStoreConfig(); queueStoreConfig.setEnabled(true); queueStoreConfig.setStoreImplementation(queueStore); queueStoreConfig.getProperties().setProperty("memory-limit", "0"); queueConfig.setQueueStoreConfig(queueStoreConfig); return config; }
private static void run() { Config config = new Config("queueTest"); QueueConfig queueConfig = config.getQueueConfig(QNAME); QueueStoreConfig queueStoreConfig = new QueueStoreConfig(); queueStoreConfig.setEnabled(true); queueStoreConfig.setStoreImplementation(new MockQueueStore()); queueStoreConfig.getProperties().setProperty("memory-limit", "0"); queueConfig.setQueueStoreConfig(queueStoreConfig); HazelcastInstance hzInstance = Hazelcast.newHazelcastInstance(config); long startTime = System.currentTimeMillis(); int i = 0; while (i++ < 2000000) { if (i % 10000 == 0) { logger.info(Integer.toString(i) + "\t" + String.format("%8.3f", (double) (System.currentTimeMillis() - startTime) / i)); } TransactionOptions options = new TransactionOptions().setTransactionType(TransactionOptions.TransactionType.LOCAL); TransactionContext context = hzInstance.newTransactionContext(options); context.beginTransaction(); TransactionalQueue<Integer> queue = context.getQueue(QNAME); queue.offer(i); context.commitTransaction(); } }