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());
}
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));
}
}
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);
}
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);
}
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));
}
Aggregations