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));
}
}
}
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);
}
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());
}
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);
}
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.");
}
}
Aggregations