Search in sources :

Example 66 with ILogger

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

the class Backup method beforeRun.

@Override
public void beforeRun() throws Exception {
    NodeEngine nodeEngine = getNodeEngine();
    int partitionId = getPartitionId();
    InternalPartitionService partitionService = (InternalPartitionService) nodeEngine.getPartitionService();
    ILogger logger = getLogger();
    IPartition partition = partitionService.getPartition(partitionId);
    Address owner = partition.getReplicaAddress(getReplicaIndex());
    if (!nodeEngine.getThisAddress().equals(owner)) {
        valid = false;
        if (logger.isFinestEnabled()) {
            logger.finest("Wrong target! " + toString() + " cannot be processed! Target should be: " + owner);
        }
    } else if (partitionService.isPartitionReplicaVersionStale(getPartitionId(), replicaVersions, getReplicaIndex())) {
        valid = false;
        if (logger.isFineEnabled()) {
            long[] currentVersions = partitionService.getPartitionReplicaVersions(partitionId);
            logger.fine("Ignoring stale backup! Current-versions: " + Arrays.toString(currentVersions) + ", Backup-versions: " + Arrays.toString(replicaVersions));
        }
    }
}
Also used : NodeEngine(com.hazelcast.spi.NodeEngine) Address(com.hazelcast.nio.Address) InternalPartitionService(com.hazelcast.internal.partition.InternalPartitionService) ILogger(com.hazelcast.logging.ILogger) IPartition(com.hazelcast.spi.partition.IPartition)

Example 67 with ILogger

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

the class ClientLoggingServiceTest method testLog_whenLogEvent_thenNothingHappens.

@Test
public void testLog_whenLogEvent_thenNothingHappens() {
    ILogger logger = loggingService.getLogger("test");
    logger.log(logEvent);
}
Also used : ILogger(com.hazelcast.logging.ILogger) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 68 with ILogger

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

the class ClientLoggingServiceTest method testLog_whenGetLevel_thenDefaultLevelIsReturned.

@Test
public void testLog_whenGetLevel_thenDefaultLevelIsReturned() {
    ILogger logger = loggingService.getLogger("test");
    assertNotNull(logger.getLevel());
}
Also used : ILogger(com.hazelcast.logging.ILogger) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 69 with ILogger

use of com.hazelcast.logging.ILogger 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 70 with ILogger

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

the class ShutdownRequestOperation method run.

@Override
public void run() {
    InternalPartitionServiceImpl partitionService = getService();
    final ILogger logger = getLogger();
    final Address caller = getCallerAddress();
    final NodeEngine nodeEngine = getNodeEngine();
    final ClusterService clusterService = nodeEngine.getClusterService();
    if (clusterService.isMaster()) {
        if (clusterService.getMember(caller) != null) {
            if (logger.isFinestEnabled()) {
                logger.finest("Received shutdown request from " + caller);
            }
            partitionService.onShutdownRequest(caller);
        } else {
            logger.warning("Ignoring shutdown request from " + caller + " because it is not a member");
        }
    } else {
        logger.warning("Received shutdown request from " + caller + " but this node is not master.");
    }
}
Also used : NodeEngine(com.hazelcast.spi.NodeEngine) ClusterService(com.hazelcast.internal.cluster.ClusterService) Address(com.hazelcast.nio.Address) InternalPartitionServiceImpl(com.hazelcast.internal.partition.impl.InternalPartitionServiceImpl) ILogger(com.hazelcast.logging.ILogger)

Aggregations

ILogger (com.hazelcast.logging.ILogger)76 Address (com.hazelcast.nio.Address)19 NodeEngineImpl (com.hazelcast.spi.impl.NodeEngineImpl)11 Node (com.hazelcast.instance.Node)10 InternalPartitionServiceImpl (com.hazelcast.internal.partition.impl.InternalPartitionServiceImpl)10 NodeEngine (com.hazelcast.spi.NodeEngine)10 ClusterServiceImpl (com.hazelcast.internal.cluster.impl.ClusterServiceImpl)9 ReplicatedMapService (com.hazelcast.replicatedmap.impl.ReplicatedMapService)6 OperationService (com.hazelcast.spi.OperationService)6 IOException (java.io.IOException)4 Before (org.junit.Before)4 JsonObject (com.eclipsesource.json.JsonObject)3 ClientAwsConfig (com.hazelcast.client.config.ClientAwsConfig)3 Connection (com.hazelcast.nio.Connection)3 ReplicatedRecordStore (com.hazelcast.replicatedmap.impl.record.ReplicatedRecordStore)3 Operation (com.hazelcast.spi.Operation)3 HazelcastProperties (com.hazelcast.spi.properties.HazelcastProperties)3 JsonUtil.getString (com.hazelcast.util.JsonUtil.getString)3 ClientNetworkConfig (com.hazelcast.client.config.ClientNetworkConfig)2 ClusterState (com.hazelcast.cluster.ClusterState)2