Search in sources :

Example 16 with HazelcastProperties

use of com.hazelcast.spi.properties.HazelcastProperties in project hazelcast by hazelcast.

the class BackpressureRegulatorTest method newCallIdSequence_whenBackPressureEnabled.

// ========================== newCallIdSequence =================
@Test
public void newCallIdSequence_whenBackPressureEnabled() {
    Config config = new Config();
    config.setProperty(BACKPRESSURE_ENABLED.getName(), "true");
    HazelcastProperties hazelcastProperties = new HazelcastProperties(config);
    BackpressureRegulator backpressureRegulator = new BackpressureRegulator(hazelcastProperties, logger);
    CallIdSequence callIdSequence = backpressureRegulator.newCallIdSequence();
    assertInstanceOf(CallIdSequence.CallIdSequenceWithBackpressure.class, callIdSequence);
    assertEquals(backpressureRegulator.getMaxConcurrentInvocations(), callIdSequence.getMaxConcurrentInvocations());
}
Also used : HazelcastProperties(com.hazelcast.spi.properties.HazelcastProperties) Config(com.hazelcast.config.Config) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 17 with HazelcastProperties

use of com.hazelcast.spi.properties.HazelcastProperties in project hazelcast by hazelcast.

the class BackpressureRegulatorTest method testConstruction_OneSyncWindow_syncOnEveryCall.

@Test
public void testConstruction_OneSyncWindow_syncOnEveryCall() {
    Config config = new Config();
    config.setProperty(BACKPRESSURE_ENABLED.getName(), "true");
    config.setProperty(BACKPRESSURE_SYNCWINDOW.getName(), "1");
    HazelcastProperties hazelcastProperties = new HazelcastProperties(config);
    BackpressureRegulator regulator = new BackpressureRegulator(hazelcastProperties, logger);
    for (int k = 0; k < 1000; k++) {
        PartitionSpecificOperation op = new PartitionSpecificOperation(10);
        assertTrue(regulator.isSyncForced(op));
    }
}
Also used : HazelcastProperties(com.hazelcast.spi.properties.HazelcastProperties) Config(com.hazelcast.config.Config) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 18 with HazelcastProperties

use of com.hazelcast.spi.properties.HazelcastProperties in project hazelcast by hazelcast.

the class BackpressureRegulatorTest method newDisabledBackPressureService.

private BackpressureRegulator newDisabledBackPressureService() {
    Config config = new Config();
    config.setProperty(BACKPRESSURE_ENABLED.getName(), "false");
    HazelcastProperties hazelcastProperties = new HazelcastProperties(config);
    return new BackpressureRegulator(hazelcastProperties, logger);
}
Also used : HazelcastProperties(com.hazelcast.spi.properties.HazelcastProperties) Config(com.hazelcast.config.Config)

Example 19 with HazelcastProperties

use of com.hazelcast.spi.properties.HazelcastProperties in project hazelcast by hazelcast.

the class ClusterHeartbeatManager method init.

/**
     * Initializes the {@link ClusterHeartbeatManager}. It will schedule the :
     * <ul>
     * <li>heartbeat operation to the {@link #getHeartbeatInterval(HazelcastProperties)} interval</li>
     * <li>master confirmation to the {@link GroupProperty#MASTER_CONFIRMATION_INTERVAL_SECONDS} interval</li>
     * <li>member list publication to the {@link GroupProperty#MEMBER_LIST_PUBLISH_INTERVAL_SECONDS} interval</li>
     * </ul>
     */
void init() {
    ExecutionService executionService = nodeEngine.getExecutionService();
    HazelcastProperties hazelcastProperties = node.getProperties();
    executionService.scheduleWithRepetition(EXECUTOR_NAME, new Runnable() {

        public void run() {
            heartbeat();
        }
    }, heartbeatIntervalMillis, heartbeatIntervalMillis, TimeUnit.MILLISECONDS);
    long masterConfirmationInterval = hazelcastProperties.getSeconds(GroupProperty.MASTER_CONFIRMATION_INTERVAL_SECONDS);
    masterConfirmationInterval = (masterConfirmationInterval > 0 ? masterConfirmationInterval : 1);
    executionService.scheduleWithRepetition(EXECUTOR_NAME, new Runnable() {

        public void run() {
            sendMasterConfirmation();
        }
    }, masterConfirmationInterval, masterConfirmationInterval, TimeUnit.SECONDS);
    long memberListPublishInterval = hazelcastProperties.getSeconds(GroupProperty.MEMBER_LIST_PUBLISH_INTERVAL_SECONDS);
    memberListPublishInterval = (memberListPublishInterval > 0 ? memberListPublishInterval : 1);
    executionService.scheduleWithRepetition(EXECUTOR_NAME, new Runnable() {

        public void run() {
            sendMemberListToOthers();
        }
    }, memberListPublishInterval, memberListPublishInterval, TimeUnit.SECONDS);
}
Also used : HazelcastProperties(com.hazelcast.spi.properties.HazelcastProperties) ExecutionService(com.hazelcast.spi.ExecutionService)

Example 20 with HazelcastProperties

use of com.hazelcast.spi.properties.HazelcastProperties in project hazelcast by hazelcast.

the class DiagnosticsLogTest method testDisabledByDefault.

@Test
public void testDisabledByDefault() {
    HazelcastProperties hazelcastProperties = new HazelcastProperties(new Config());
    assertFalse(hazelcastProperties.getBoolean(Diagnostics.ENABLED));
}
Also used : HazelcastProperties(com.hazelcast.spi.properties.HazelcastProperties) Config(com.hazelcast.config.Config) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Aggregations

HazelcastProperties (com.hazelcast.spi.properties.HazelcastProperties)29 Config (com.hazelcast.config.Config)12 QuickTest (com.hazelcast.test.annotation.QuickTest)11 Test (org.junit.Test)11 ParallelTest (com.hazelcast.test.annotation.ParallelTest)9 ExecutionService (com.hazelcast.spi.ExecutionService)4 ILogger (com.hazelcast.logging.ILogger)3 Before (org.junit.Before)3 MapConfig (com.hazelcast.config.MapConfig)2 HazelcastThreadGroup (com.hazelcast.instance.HazelcastThreadGroup)2 BatchInvalidator (com.hazelcast.internal.nearcache.impl.invalidation.BatchInvalidator)2 NonStopInvalidator (com.hazelcast.internal.nearcache.impl.invalidation.NonStopInvalidator)2 RecordStore (com.hazelcast.map.impl.recordstore.RecordStore)2 NodeEngine (com.hazelcast.spi.NodeEngine)2 OperationService (com.hazelcast.spi.OperationService)2 Properties (java.util.Properties)2 ClientLoggingService (com.hazelcast.client.impl.ClientLoggingService)1 MapIndexConfig (com.hazelcast.config.MapIndexConfig)1 SSLConfig (com.hazelcast.config.SSLConfig)1 ClusterService (com.hazelcast.internal.cluster.ClusterService)1