Search in sources :

Example 1 with LoggingService

use of com.hazelcast.logging.LoggingService in project hazelcast by hazelcast.

the class SelectNow_NioNetworkingFactory method create.

@Override
public NioNetworking create(final MockServerContext serverContext, MetricsRegistry metricsRegistry) {
    LoggingService loggingService = serverContext.loggingService;
    HazelcastProperties properties = serverContext.properties();
    return new NioNetworking(new NioNetworking.Context().loggingService(loggingService).metricsRegistry(metricsRegistry).threadNamePrefix(serverContext.getHazelcastName()).errorHandler(new TcpServerConnectionChannelErrorHandler(loggingService.getLogger(TcpServerConnectionChannelErrorHandler.class))).inputThreadCount(properties.getInteger(IO_INPUT_THREAD_COUNT)).outputThreadCount(properties.getInteger(IO_OUTPUT_THREAD_COUNT)).balancerIntervalSeconds(properties.getInteger(IO_BALANCER_INTERVAL_SECONDS)).selectorMode(SelectorMode.SELECT_NOW));
}
Also used : HazelcastProperties(com.hazelcast.spi.properties.HazelcastProperties) TcpServerConnectionChannelErrorHandler(com.hazelcast.internal.server.tcp.TcpServerConnectionChannelErrorHandler) LoggingService(com.hazelcast.logging.LoggingService)

Example 2 with LoggingService

use of com.hazelcast.logging.LoggingService in project hazelcast by hazelcast.

the class Select_NioNetworkingFactory method create.

@Override
public NioNetworking create(final MockServerContext serverContext, MetricsRegistry metricsRegistry) {
    HazelcastProperties properties = serverContext.properties();
    LoggingService loggingService = serverContext.loggingService;
    return new NioNetworking(new NioNetworking.Context().loggingService(loggingService).metricsRegistry(metricsRegistry).threadNamePrefix(serverContext.getHazelcastName()).errorHandler(new TcpServerConnectionChannelErrorHandler(loggingService.getLogger(TcpServerConnectionChannelErrorHandler.class))).inputThreadCount(properties.getInteger(IO_INPUT_THREAD_COUNT)).outputThreadCount(properties.getInteger(IO_OUTPUT_THREAD_COUNT)).balancerIntervalSeconds(properties.getInteger(IO_BALANCER_INTERVAL_SECONDS)).selectorMode(SelectorMode.SELECT));
}
Also used : HazelcastProperties(com.hazelcast.spi.properties.HazelcastProperties) TcpServerConnectionChannelErrorHandler(com.hazelcast.internal.server.tcp.TcpServerConnectionChannelErrorHandler) LoggingService(com.hazelcast.logging.LoggingService)

Example 3 with LoggingService

use of com.hazelcast.logging.LoggingService in project hazelcast by hazelcast.

the class DiagnosticsTest method mockLoggingService.

private LoggingService mockLoggingService() {
    LoggingService mock = mock(LoggingService.class);
    when(mock.getLogger(Diagnostics.class)).thenReturn(getLogger(Diagnostics.class));
    return mock;
}
Also used : LoggingService(com.hazelcast.logging.LoggingService)

Example 4 with LoggingService

use of com.hazelcast.logging.LoggingService in project hazelcast by hazelcast.

the class HazelcastOSGiInstanceTest method getLoggingServiceCalledSuccessfullyOverOSGiInstance.

@Test
public void getLoggingServiceCalledSuccessfullyOverOSGiInstance() {
    LoggingService mockLoggingService = mock(LoggingService.class);
    HazelcastInstance mockHazelcastInstance = mock(HazelcastInstance.class);
    HazelcastOSGiInstance hazelcastOSGiInstance = createHazelcastOSGiInstance(mockHazelcastInstance);
    when(mockHazelcastInstance.getLoggingService()).thenReturn(mockLoggingService);
    assertEquals(mockLoggingService, hazelcastOSGiInstance.getLoggingService());
    verify(mockHazelcastInstance).getLoggingService();
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) HazelcastOSGiTestUtil.createHazelcastOSGiInstance(com.hazelcast.osgi.impl.HazelcastOSGiTestUtil.createHazelcastOSGiInstance) LoggingService(com.hazelcast.logging.LoggingService) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 5 with LoggingService

use of com.hazelcast.logging.LoggingService in project hazelcast by hazelcast.

the class DefaultClientConnectionManagerFactory method createConnectionManager.

@Override
public ClientConnectionManager createConnectionManager(ClientConfig config, HazelcastClientInstanceImpl client, DiscoveryService discoveryService) {
    LoggingService loggingService = client.getLoggingService();
    ILogger logger = loggingService.getLogger(HazelcastClient.class);
    ClientAwsConfig awsConfig = config.getNetworkConfig().getAwsConfig();
    AddressTranslator addressTranslator;
    if (awsConfig != null && awsConfig.isEnabled()) {
        try {
            addressTranslator = new AwsAddressTranslator(awsConfig, loggingService);
        } catch (NoClassDefFoundError e) {
            logger.warning("hazelcast-aws.jar might be missing!");
            throw e;
        }
    } else if (discoveryService != null) {
        addressTranslator = new DiscoveryAddressTranslator(discoveryService, client.getProperties().getBoolean(ClientProperty.DISCOVERY_SPI_PUBLIC_IP_ENABLED));
    } else {
        addressTranslator = new DefaultAddressTranslator();
    }
    return new ClientConnectionManagerImpl(client, addressTranslator);
}
Also used : AddressTranslator(com.hazelcast.client.connection.AddressTranslator) DefaultAddressTranslator(com.hazelcast.client.spi.impl.DefaultAddressTranslator) AwsAddressTranslator(com.hazelcast.client.spi.impl.AwsAddressTranslator) DiscoveryAddressTranslator(com.hazelcast.client.spi.impl.discovery.DiscoveryAddressTranslator) AwsAddressTranslator(com.hazelcast.client.spi.impl.AwsAddressTranslator) ClientConnectionManagerImpl(com.hazelcast.client.connection.nio.ClientConnectionManagerImpl) DefaultAddressTranslator(com.hazelcast.client.spi.impl.DefaultAddressTranslator) LoggingService(com.hazelcast.logging.LoggingService) ILogger(com.hazelcast.logging.ILogger) DiscoveryAddressTranslator(com.hazelcast.client.spi.impl.discovery.DiscoveryAddressTranslator) ClientAwsConfig(com.hazelcast.client.config.ClientAwsConfig)

Aggregations

LoggingService (com.hazelcast.logging.LoggingService)12 ILogger (com.hazelcast.logging.ILogger)4 HazelcastProperties (com.hazelcast.spi.properties.HazelcastProperties)4 HazelcastInstance (com.hazelcast.core.HazelcastInstance)3 TcpServerConnectionChannelErrorHandler (com.hazelcast.internal.server.tcp.TcpServerConnectionChannelErrorHandler)3 Before (org.junit.Before)3 ClientAwsConfig (com.hazelcast.client.config.ClientAwsConfig)2 Address (com.hazelcast.nio.Address)2 AWSClient (com.hazelcast.aws.AWSClient)1 AddressTranslator (com.hazelcast.client.connection.AddressTranslator)1 ClientConnectionManagerImpl (com.hazelcast.client.connection.nio.ClientConnectionManagerImpl)1 AwsAddressTranslator (com.hazelcast.client.spi.impl.AwsAddressTranslator)1 DefaultAddressTranslator (com.hazelcast.client.spi.impl.DefaultAddressTranslator)1 DiscoveryAddressTranslator (com.hazelcast.client.spi.impl.discovery.DiscoveryAddressTranslator)1 HazelcastThreadGroup (com.hazelcast.instance.HazelcastThreadGroup)1 Node (com.hazelcast.instance.Node)1 MetricsRegistry (com.hazelcast.internal.metrics.MetricsRegistry)1 MetricsRegistryImpl (com.hazelcast.internal.metrics.impl.MetricsRegistryImpl)1 IOThreadingModel (com.hazelcast.internal.networking.IOThreadingModel)1 MockServerContext (com.hazelcast.internal.server.MockServerContext)1