Search in sources :

Example 1 with HazelcastProperties

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

the class MapDataStores method newWriteBehindQueue.

private static WriteBehindQueue newWriteBehindQueue(MapServiceContext mapServiceContext, boolean writeCoalescing) {
    HazelcastProperties hazelcastProperties = mapServiceContext.getNodeEngine().getProperties();
    final int capacity = hazelcastProperties.getInteger(GroupProperty.MAP_WRITE_BEHIND_QUEUE_CAPACITY);
    final AtomicInteger counter = mapServiceContext.getWriteBehindQueueItemCounter();
    return (writeCoalescing ? createDefaultWriteBehindQueue() : createBoundedWriteBehindQueue(capacity, counter));
}
Also used : HazelcastProperties(com.hazelcast.spi.properties.HazelcastProperties) AtomicInteger(java.util.concurrent.atomic.AtomicInteger)

Example 2 with HazelcastProperties

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

the class ClientConnectionManagerImpl method initIOThreads.

protected void initIOThreads(HazelcastClientInstanceImpl client) {
    HazelcastProperties properties = client.getProperties();
    boolean directBuffer = properties.getBoolean(SOCKET_CLIENT_BUFFER_DIRECT);
    SSLConfig sslConfig = client.getClientConfig().getNetworkConfig().getSSLConfig();
    boolean sslEnabled = sslConfig != null && sslConfig.isEnabled();
    int configuredInputThreads = properties.getInteger(ClientProperty.IO_INPUT_THREAD_COUNT);
    int configuredOutputThreads = properties.getInteger(ClientProperty.IO_OUTPUT_THREAD_COUNT);
    int inputThreads;
    if (configuredInputThreads == -1) {
        inputThreads = sslEnabled ? DEFAULT_SSL_THREAD_COUNT : 1;
    } else {
        inputThreads = configuredInputThreads;
    }
    int outputThreads;
    if (configuredOutputThreads == -1) {
        outputThreads = sslEnabled ? DEFAULT_SSL_THREAD_COUNT : 1;
    } else {
        outputThreads = configuredOutputThreads;
    }
    ioThreadingModel = new NonBlockingIOThreadingModel(client.getLoggingService(), client.getMetricsRegistry(), new HazelcastThreadGroup(client.getName(), logger, client.getClientConfig().getClassLoader()), outOfMemoryHandler, inputThreads, outputThreads, properties.getInteger(ClientProperty.IO_BALANCER_INTERVAL_SECONDS), new ClientSocketWriterInitializer(getBufferSize(), directBuffer), new ClientSocketReaderInitializer(getBufferSize(), directBuffer));
}
Also used : HazelcastProperties(com.hazelcast.spi.properties.HazelcastProperties) SSLConfig(com.hazelcast.config.SSLConfig) HazelcastThreadGroup(com.hazelcast.instance.HazelcastThreadGroup) NonBlockingIOThreadingModel(com.hazelcast.internal.networking.nonblocking.NonBlockingIOThreadingModel)

Example 3 with HazelcastProperties

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

the class DefaultAddressPickerTest method setup.

@Before
public void setup() throws UnknownHostException {
    properties = new HazelcastProperties(config);
    InetAddress publicAddress = null;
    try {
        loopback = InetAddress.getByName("127.0.0.1");
        publicAddress = InetAddress.getByName(PUBLIC_HOST);
    } catch (UnknownHostException e) {
        e.printStackTrace();
    }
    assumeNotNull(loopback, publicAddress);
    localAddressValue = System.getProperty(HAZELCAST_LOCAL_ADDRESS_PROP);
    System.clearProperty(HAZELCAST_LOCAL_ADDRESS_PROP);
}
Also used : HazelcastProperties(com.hazelcast.spi.properties.HazelcastProperties) UnknownHostException(java.net.UnknownHostException) InetAddress(java.net.InetAddress) Before(org.junit.Before)

Example 4 with HazelcastProperties

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

the class AsyncInboundResponseHandlerTest method setup.

@Before
public void setup() {
    ILogger logger = Logger.getLogger(getClass());
    HazelcastThreadGroup threadGroup = new HazelcastThreadGroup("test", logger, getClass().getClassLoader());
    responsePacketHandler = mock(PacketHandler.class);
    asyncHandler = new AsyncInboundResponseHandler(threadGroup, logger, responsePacketHandler, new HazelcastProperties(new Config()));
    asyncHandler.start();
    serializationService = new DefaultSerializationServiceBuilder().build();
}
Also used : DefaultSerializationServiceBuilder(com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder) HazelcastProperties(com.hazelcast.spi.properties.HazelcastProperties) PacketHandler(com.hazelcast.spi.impl.PacketHandler) Config(com.hazelcast.config.Config) ILogger(com.hazelcast.logging.ILogger) HazelcastThreadGroup(com.hazelcast.instance.HazelcastThreadGroup) Before(org.junit.Before)

Example 5 with HazelcastProperties

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

the class MembershipManager method init.

/**
 * Initializes the {@link MembershipManager}.
 * It will schedule the member list publication to the {@link ClusterProperty#MEMBER_LIST_PUBLISH_INTERVAL_SECONDS} interval.
 */
void init() {
    ExecutionService executionService = nodeEngine.getExecutionService();
    HazelcastProperties hazelcastProperties = node.getProperties();
    executionService.register(MASTERSHIP_CLAIM_EXECUTOR_NAME, 1, Integer.MAX_VALUE, ExecutorType.CACHED);
    long memberListPublishInterval = hazelcastProperties.getSeconds(ClusterProperty.MEMBER_LIST_PUBLISH_INTERVAL_SECONDS);
    memberListPublishInterval = (memberListPublishInterval > 0 ? memberListPublishInterval : 1);
    executionService.scheduleWithRepetition(CLUSTER_EXECUTOR_NAME, this::publishMemberList, memberListPublishInterval, memberListPublishInterval, SECONDS);
}
Also used : HazelcastProperties(com.hazelcast.spi.properties.HazelcastProperties) ExecutionService(com.hazelcast.spi.impl.executionservice.ExecutionService)

Aggregations

HazelcastProperties (com.hazelcast.spi.properties.HazelcastProperties)71 Config (com.hazelcast.config.Config)31 QuickTest (com.hazelcast.test.annotation.QuickTest)29 Test (org.junit.Test)29 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)25 ILogger (com.hazelcast.logging.ILogger)15 Address (com.hazelcast.cluster.Address)11 JoinConfig (com.hazelcast.config.JoinConfig)8 MulticastConfig (com.hazelcast.config.MulticastConfig)8 InetAddress (java.net.InetAddress)8 InetSocketAddress (java.net.InetSocketAddress)8 MulticastSocket (java.net.MulticastSocket)8 Before (org.junit.Before)8 ExecutionService (com.hazelcast.spi.impl.executionservice.ExecutionService)7 Properties (java.util.Properties)7 Node (com.hazelcast.instance.impl.Node)4 LoggingService (com.hazelcast.logging.LoggingService)4 MapConfig (com.hazelcast.config.MapConfig)3 TcpServerConnectionChannelErrorHandler (com.hazelcast.internal.server.tcp.TcpServerConnectionChannelErrorHandler)3 ClientConfig (com.hazelcast.client.config.ClientConfig)2