Search in sources :

Example 21 with HazelcastProperties

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

the class ProxyManager method getRetryCountLimit.

private long getRetryCountLimit() {
    HazelcastProperties hazelcastProperties = client.getProperties();
    int waitTime = hazelcastProperties.getSeconds(INVOCATION_TIMEOUT_SECONDS);
    long retryTimeoutInSeconds = waitTime > 0 ? waitTime : Integer.parseInt(INVOCATION_TIMEOUT_SECONDS.getDefaultValue());
    return retryTimeoutInSeconds / ClientInvocation.RETRY_WAIT_TIME_IN_SECONDS;
}
Also used : HazelcastProperties(com.hazelcast.spi.properties.HazelcastProperties)

Example 22 with HazelcastProperties

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

the class CacheEventHandler method createInvalidator.

private Invalidator createInvalidator() {
    HazelcastProperties hazelcastProperties = nodeEngine.getProperties();
    int batchSize = hazelcastProperties.getInteger(CACHE_INVALIDATION_MESSAGE_BATCH_SIZE);
    int batchFrequencySeconds = hazelcastProperties.getInteger(CACHE_INVALIDATION_MESSAGE_BATCH_FREQUENCY_SECONDS);
    boolean batchingEnabled = hazelcastProperties.getBoolean(CACHE_INVALIDATION_MESSAGE_BATCH_ENABLED) && batchSize > 1;
    if (batchingEnabled) {
        return new BatchInvalidator(SERVICE_NAME, batchSize, batchFrequencySeconds, TRUE_FILTER, nodeEngine);
    } else {
        return new NonStopInvalidator(SERVICE_NAME, TRUE_FILTER, nodeEngine);
    }
}
Also used : HazelcastProperties(com.hazelcast.spi.properties.HazelcastProperties) BatchInvalidator(com.hazelcast.internal.nearcache.impl.invalidation.BatchInvalidator) NonStopInvalidator(com.hazelcast.internal.nearcache.impl.invalidation.NonStopInvalidator)

Example 23 with HazelcastProperties

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

the class PartitionContainer method createRecordStore.

private RecordStore createRecordStore(String name) {
    MapServiceContext serviceContext = mapService.getMapServiceContext();
    MapContainer mapContainer = serviceContext.getMapContainer(name);
    MapConfig mapConfig = mapContainer.getMapConfig();
    NodeEngine nodeEngine = serviceContext.getNodeEngine();
    IPartitionService ps = nodeEngine.getPartitionService();
    OperationService opService = nodeEngine.getOperationService();
    ExecutionService execService = nodeEngine.getExecutionService();
    HazelcastProperties hazelcastProperties = nodeEngine.getProperties();
    MapKeyLoader keyLoader = new MapKeyLoader(name, opService, ps, nodeEngine.getClusterService(), execService, mapContainer.toData());
    keyLoader.setMaxBatch(hazelcastProperties.getInteger(GroupProperty.MAP_LOAD_CHUNK_SIZE));
    keyLoader.setMaxSize(getMaxSizePerNode(mapConfig.getMaxSizeConfig()));
    keyLoader.setHasBackup(mapConfig.getTotalBackupCount() > 0);
    keyLoader.setMapOperationProvider(serviceContext.getMapOperationProvider(name));
    RecordStore recordStore = serviceContext.createRecordStore(mapContainer, partitionId, keyLoader);
    recordStore.init();
    return recordStore;
}
Also used : NodeEngine(com.hazelcast.spi.NodeEngine) HazelcastProperties(com.hazelcast.spi.properties.HazelcastProperties) IPartitionService(com.hazelcast.spi.partition.IPartitionService) RecordStore(com.hazelcast.map.impl.recordstore.RecordStore) MapConfig(com.hazelcast.config.MapConfig) OperationService(com.hazelcast.spi.OperationService) ExecutionService(com.hazelcast.spi.ExecutionService)

Example 24 with HazelcastProperties

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

the class ClientExecutionServiceImplTest method setUp.

@BeforeClass
public static void setUp() {
    String name = "ClientExecutionServiceImplTest";
    ThreadGroup threadGroup = new ThreadGroup(name);
    ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
    HazelcastProperties properties = new HazelcastProperties(new Config());
    ClientLoggingService loggingService = new ClientLoggingService(name, "jdk", BuildInfoProvider.BUILD_INFO, name);
    executionService = new ClientExecutionServiceImpl(name, threadGroup, classLoader, properties, 1, loggingService);
}
Also used : ClientLoggingService(com.hazelcast.client.impl.ClientLoggingService) HazelcastProperties(com.hazelcast.spi.properties.HazelcastProperties) Config(com.hazelcast.config.Config) BeforeClass(org.junit.BeforeClass)

Example 25 with HazelcastProperties

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

the class QueryResultSizeLimiterTest method initMocksWithConfiguration.

private void initMocksWithConfiguration(int maxResultSizeLimit, int maxLocalPartitionLimitForPreCheck, int partitionCount) {
    Config config = new Config();
    config.setProperty(QUERY_RESULT_SIZE_LIMIT.getName(), valueOf(maxResultSizeLimit));
    config.setProperty(QUERY_MAX_LOCAL_PARTITION_LIMIT_FOR_PRE_CHECK.getName(), valueOf(maxLocalPartitionLimitForPreCheck));
    config.setProperty(PARTITION_COUNT.getName(), valueOf(partitionCount));
    HazelcastProperties hazelcastProperties = new HazelcastProperties(config);
    InternalPartitionService partitionService = mock(InternalPartitionService.class);
    when(partitionService.getPartitionCount()).thenReturn(partitionCount);
    NodeEngine nodeEngine = mock(NodeEngine.class);
    when(nodeEngine.getProperties()).thenReturn(hazelcastProperties);
    when(nodeEngine.getPartitionService()).thenReturn(partitionService);
    RecordStore recordStore = mock(RecordStore.class);
    when(recordStore.size()).then(new RecordStoreAnswer(localPartitions.values()));
    MapServiceContext mapServiceContext = mock(MapServiceContext.class);
    when(mapServiceContext.getNodeEngine()).thenReturn(nodeEngine);
    when(mapServiceContext.getRecordStore(anyInt(), anyString())).thenReturn(recordStore);
    when(mapServiceContext.getOwnedPartitions()).thenReturn(localPartitions.keySet());
    limiter = new QueryResultSizeLimiter(mapServiceContext, Logger.getLogger(QueryResultSizeLimiterTest.class));
}
Also used : NodeEngine(com.hazelcast.spi.NodeEngine) HazelcastProperties(com.hazelcast.spi.properties.HazelcastProperties) InternalPartitionService(com.hazelcast.internal.partition.InternalPartitionService) Config(com.hazelcast.config.Config) RecordStore(com.hazelcast.map.impl.recordstore.RecordStore) MapServiceContext(com.hazelcast.map.impl.MapServiceContext)

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