@Test public void testQueueConfig() { QueueConfig testQConfig = config.getQueueConfig("testQ"); assertNotNull(testQConfig); assertEquals("testQ", testQConfig.getName()); assertEquals(1000, testQConfig.getMaxSize()); QueueConfig qConfig = config.getQueueConfig("q"); assertNotNull(qConfig); assertEquals("q", qConfig.getName()); assertEquals(2500, qConfig.getMaxSize()); assertEquals(1, testQConfig.getItemListenerConfigs().size()); ItemListenerConfig listenerConfig = testQConfig.getItemListenerConfigs().get(0); assertEquals("com.hazelcast.spring.DummyItemListener", listenerConfig.getClassName()); assertTrue(listenerConfig.isIncludeValue()); }
public QueueConfig(QueueConfig config) { this(); this.name = config.name; this.backupCount = config.backupCount; this.asyncBackupCount = config.asyncBackupCount; this.maxSize = config.maxSize; this.emptyQueueTtl = config.emptyQueueTtl; this.statisticsEnabled = config.statisticsEnabled; this.queueStoreConfig = config.queueStoreConfig != null ? new QueueStoreConfig(config.queueStoreConfig) : null; this.listenerConfigs = new ArrayList<ItemListenerConfig>(config.getItemListenerConfigs()); }
@Override public void initialize() { final NodeEngine nodeEngine = getNodeEngine(); final List<ItemListenerConfig> itemListenerConfigs = config.getItemListenerConfigs(); for (ItemListenerConfig itemListenerConfig : itemListenerConfigs) { ItemListener listener = itemListenerConfig.getImplementation(); if (listener == null && itemListenerConfig.getClassName() != null) { try { listener = ClassLoaderUtil.newInstance( nodeEngine.getConfigClassLoader(), itemListenerConfig.getClassName()); } catch (Exception e) { throw ExceptionUtil.rethrow(e); } } if (listener != null) { if (listener instanceof HazelcastInstanceAware) { ((HazelcastInstanceAware) listener) .setHazelcastInstance(nodeEngine.getHazelcastInstance()); } addItemListener(listener, itemListenerConfig.isIncludeValue()); } } }