Java 类com.hazelcast.config.QueueConfig 实例源码

项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:HazelcastAutoConfigurationTests.java   
@Test
public void systemProperty() throws IOException {
    System.setProperty(HazelcastConfigResourceCondition.CONFIG_SYSTEM_PROPERTY,
            "classpath:org/springframework/boot/autoconfigure/hazelcast/hazelcast-specific.xml");
    try {
        load();
        HazelcastInstance hazelcastInstance = this.context
                .getBean(HazelcastInstance.class);
        Map<String, QueueConfig> queueConfigs = hazelcastInstance.getConfig()
                .getQueueConfigs();
        assertThat(queueConfigs).hasSize(1).containsKey("foobar");
    }
    finally {
        System.clearProperty(HazelcastConfigResourceCondition.CONFIG_SYSTEM_PROPERTY);
    }
}
项目:spring-boot-concourse    文件:HazelcastAutoConfigurationTests.java   
@Test
public void systemProperty() throws IOException {
    System.setProperty(HazelcastConfigResourceCondition.CONFIG_SYSTEM_PROPERTY,
            "classpath:org/springframework/boot/autoconfigure/hazelcast/hazelcast-specific.xml");
    try {
        load();
        HazelcastInstance hazelcastInstance = this.context
                .getBean(HazelcastInstance.class);
        Map<String, QueueConfig> queueConfigs = hazelcastInstance.getConfig()
                .getQueueConfigs();
        assertThat(queueConfigs).hasSize(1).containsKey("foobar");
    }
    finally {
        System.clearProperty(HazelcastConfigResourceCondition.CONFIG_SYSTEM_PROPERTY);
    }
}
项目:contestparser    文件:HazelcastAutoConfigurationTests.java   
@Test
public void systemProperty() throws IOException {
    System.setProperty(HazelcastConfigResourceCondition.CONFIG_SYSTEM_PROPERTY,
            "classpath:org/springframework/boot/autoconfigure/hazelcast/hazelcast-specific.xml");
    try {
        load();
        HazelcastInstance hazelcastInstance = this.context
                .getBean(HazelcastInstance.class);
        Map<String, QueueConfig> queueConfigs = hazelcastInstance.getConfig()
                .getQueueConfigs();
        assertThat(queueConfigs.values(), hasSize(1));
        assertThat(queueConfigs, hasKey("foobar"));
    }
    finally {
        System.clearProperty(HazelcastConfigResourceCondition.CONFIG_SYSTEM_PROPERTY);
    }
}
项目:iticrawler    文件:DistQueueConfig.java   
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;
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:HazelcastAutoConfigurationTests.java   
@Test
public void configInstanceWithoutName() {
    load(HazelcastConfigNoName.class, "spring.hazelcast.config=this-is-ignored.xml");
    HazelcastInstance hazelcastInstance = this.context
            .getBean(HazelcastInstance.class);
    Map<String, QueueConfig> queueConfigs = hazelcastInstance.getConfig()
            .getQueueConfigs();
    assertThat(queueConfigs).hasSize(1).containsKey("another-queue");
}
项目:eet.osslite.cz    文件:HazelcastConfiguration.java   
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);
}
项目:spring-boot-concourse    文件:HazelcastAutoConfigurationTests.java   
@Test
public void configInstanceWithoutName() {
    load(HazelcastConfigNoName.class, "spring.hazelcast.config=this-is-ignored.xml");
    HazelcastInstance hazelcastInstance = this.context
            .getBean(HazelcastInstance.class);
    Map<String, QueueConfig> queueConfigs = hazelcastInstance.getConfig()
            .getQueueConfigs();
    assertThat(queueConfigs).hasSize(1).containsKey("another-queue");
}
项目:contestparser    文件:HazelcastAutoConfigurationTests.java   
@Test
public void configInstanceWithoutName() {
    load(HazelcastConfigNoName.class, "spring.hazelcast.config=this-is-ignored.xml");
    HazelcastInstance hazelcastInstance = this.context
            .getBean(HazelcastInstance.class);
    Map<String, QueueConfig> queueConfigs = hazelcastInstance.getConfig()
            .getQueueConfigs();
    assertThat(queueConfigs.values(), hasSize(1));
    assertThat(queueConfigs, hasKey("another-queue"));
}
项目:hz-queue    文件:Test2.java   
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);
        }
    }
项目:hz-queue    文件:Test7.java   
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;
}
项目:hz-queue    文件:Test6.java   
private static Config createConfig(String name) {
    Config config = new Config(name);

    QueueConfig queueConfig = config.getQueueConfig(QNAME);
    queueConfig.setBackupCount(0);

    return config;
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:HazelcastAutoConfigurationTests.java   
@Bean
public Config anotherHazelcastConfig() {
    Config config = new Config();
    config.addQueueConfig(new QueueConfig("another-queue"));
    return config;
}
项目:spring-boot-concourse    文件:HazelcastAutoConfigurationTests.java   
@Bean
public Config anotherHazelcastConfig() {
    Config config = new Config();
    config.addQueueConfig(new QueueConfig("another-queue"));
    return config;
}
项目:contestparser    文件:HazelcastAutoConfigurationTests.java   
@Bean
public Config anotherHazelcastConfig() {
    Config config = new Config();
    config.addQueueConfig(new QueueConfig("another-queue"));
    return config;
}
项目:hazelcast-archive    文件:QueueMBean.java   
@JMXAttribute("Config")
@JMXDescription("Queue configuration")
public String getConfig() {
    final QueueConfig config = managementService.getInstance().getConfig().getQueueConfig(getName());
    return config.toString();
}
项目:health-and-care-developer-network    文件:QueueMBean.java   
@JMXAttribute("Config")
@JMXDescription("Queue configuration")
public String getConfig() {
    final QueueConfig config = managementService.getInstance().getConfig().getQueueConfig(getName());
    return config.toString();
}
项目:hz-queue    文件:Test3.java   
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();

        }
    }