Search in sources :

Example 6 with LoggingService

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

the class AwsAddressTranslatorTest method setUp.

@Before
public void setUp() throws Exception {
    privateAddress = new Address("127.0.0.1", 5701);
    publicAddress = new Address("192.168.0.1", 5701);
    awsClient = mock(AWSClient.class);
    when(awsClient.getAddresses()).thenReturn(lookup);
    config = new ClientAwsConfig();
    config.setIamRole("anyRole");
    ILogger logger = Logger.getLogger(AwsAddressTranslatorTest.class);
    loggingService = mock(LoggingService.class);
    when(loggingService.getLogger(eq(AwsAddressTranslator.class))).thenReturn(logger);
    translator = new AwsAddressTranslator(config, loggingService);
}
Also used : Address(com.hazelcast.nio.Address) LoggingService(com.hazelcast.logging.LoggingService) ILogger(com.hazelcast.logging.ILogger) AWSClient(com.hazelcast.aws.AWSClient) ClientAwsConfig(com.hazelcast.client.config.ClientAwsConfig) Before(org.junit.Before)

Example 7 with LoggingService

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

the class Select_NonBlockingIOThreadingModelFactory method create.

@Override
public NonBlockingIOThreadingModel create(MockIOService ioService, MetricsRegistry metricsRegistry) {
    LoggingService loggingService = ioService.loggingService;
    NonBlockingIOThreadingModel threadingModel = new NonBlockingIOThreadingModel(loggingService, metricsRegistry, ioService.hazelcastThreadGroup, ioService.getIoOutOfMemoryHandler(), ioService.getInputSelectorThreadCount(), ioService.getOutputSelectorThreadCount(), ioService.getBalancerIntervalSeconds(), new SocketWriterInitializerImpl(loggingService.getLogger(SocketWriterInitializerImpl.class)), new SocketReaderInitializerImpl(loggingService.getLogger(SocketReaderInitializerImpl.class)));
    threadingModel.setSelectorMode(SelectorMode.SELECT);
    return threadingModel;
}
Also used : SocketReaderInitializerImpl(com.hazelcast.nio.tcp.SocketReaderInitializerImpl) LoggingService(com.hazelcast.logging.LoggingService) SocketWriterInitializerImpl(com.hazelcast.nio.tcp.SocketWriterInitializerImpl)

Example 8 with LoggingService

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

the class NetworkTest method setup.

@Setup
public void setup() throws Exception {
    Node node = HazelcastTestUtils.getNode(targetInstance);
    if (node == null) {
        throw new IllegalStateException("node is null");
    }
    MetricsRegistry metricsRegistry = node.nodeEngine.getMetricsRegistry();
    LoggingService loggingService = node.loggingService;
    HazelcastThreadGroup threadGroup = node.getHazelcastThreadGroup();
    // we don't know the number of worker threads (damn hidden property), so lets assume 1000.. that should be enough
    packetHandler = new RequestPacketHandler(1000);
    Address thisAddress = node.getThisAddress();
    Address newThisAddress = new Address(thisAddress.getHost(), thisAddress.getPort() + PORT_OFFSET);
    logger.info("ThisAddress: " + newThisAddress);
    MockIOService ioService = new MockIOService(newThisAddress, loggingService);
    ioService.inputThreadCount = inputThreadCount;
    ioService.outputThreadCount = outputThreadCount;
    ioService.socketNoDelay = socketNoDelay;
    ioService.packetHandler = packetHandler;
    ioService.socketSendBufferSize = socketSendBufferSize;
    ioService.socketReceiveBufferSize = socketReceiveBufferSize;
    if (trackSequenceId) {
        ioService.writeHandlerFactory = new TaggingWriteHandlerFactory();
    }
    IOThreadingModel threadingModel = null;
    switch(ioThreadingModel) {
        // break;
        default:
            throw new IllegalStateException("Unrecognized threading model: " + ioThreadingModel);
    }
// 
// connectionManager = new TcpIpConnectionManager(
// ioService, ioService.serverSocketChannel, loggingService, metricsRegistry, threadingModel);
// connectionManager.start();
// networkCreateLock = targetInstance.getLock("connectionCreateLock");
}
Also used : MetricsRegistry(com.hazelcast.internal.metrics.MetricsRegistry) Address(com.hazelcast.nio.Address) IOThreadingModel(com.hazelcast.internal.networking.IOThreadingModel) Node(com.hazelcast.instance.Node) LoggingService(com.hazelcast.logging.LoggingService) HazelcastThreadGroup(com.hazelcast.instance.HazelcastThreadGroup) Setup(com.hazelcast.simulator.test.annotations.Setup)

Example 9 with LoggingService

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

the class TaskletExecutionServiceTest method before.

@Before
public void before() {
    HazelcastInstance hzMock = mock(HazelcastInstance.class);
    LoggingService loggingService = mock(LoggingService.class);
    Mockito.when(hzMock.getName()).thenReturn("test-hz-instance");
    Mockito.when(hzMock.getLoggingService()).thenReturn(loggingService);
    Mockito.when(loggingService.getLogger(TaskletExecutionService.class)).thenReturn(Logger.getLogger(TaskletExecutionService.class));
    es = new TaskletExecutionService(hzMock, THREAD_COUNT);
    classLoaderMock = mock(ClassLoader.class);
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) LoggingService(com.hazelcast.logging.LoggingService) Before(org.junit.Before)

Example 10 with LoggingService

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

the class ProcessorWrapper method initContext.

protected Context initContext(Context context) {
    // and also other objects could be mocked or null, such as hazelcastInstance())
    if (context instanceof ProcCtx) {
        ProcCtx c = (ProcCtx) context;
        LoggingService loggingService = c.hazelcastInstance().getLoggingService();
        String prefix = prefix(c.jobConfig().getName(), c.jobId(), c.vertexName(), c.globalProcessorIndex());
        ILogger newLogger = prefixedLogger(loggingService.getLogger(wrapped.getClass()), prefix);
        context = new ProcCtx(c.nodeEngine(), c.jobId(), c.executionId(), c.jobConfig(), newLogger, c.vertexName(), c.localProcessorIndex(), c.globalProcessorIndex(), c.isLightJob(), c.partitionAssignment(), c.localParallelism(), c.memberIndex(), c.memberCount(), c.tempDirectories(), c.serializationService(), c.subject(), c.classLoader());
    }
    return context;
}
Also used : ProcCtx(com.hazelcast.jet.impl.execution.init.Contexts.ProcCtx) LoggingService(com.hazelcast.logging.LoggingService) ILogger(com.hazelcast.logging.ILogger)

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