use of com.hazelcast.spi.exception.DistributedObjectDestroyedException in project hazelcast by hazelcast.
the class ReliableMessageListenerRunner method onFailure.
// This method is called from the provided executor.
@Override
public void onFailure(Throwable t) {
if (cancelled) {
return;
}
if (t instanceof StaleSequenceException) {
StaleSequenceException staleSequenceException = (StaleSequenceException) t;
if (listener.isLossTolerant()) {
if (logger.isFinestEnabled()) {
logger.finest("MessageListener " + listener + " on topic: " + topicName + " ran into a stale sequence. " + "Jumping from oldSequence: " + sequence + " to sequence: " + staleSequenceException.getHeadSeq());
}
sequence = staleSequenceException.getHeadSeq();
next();
return;
}
logger.warning("Terminating MessageListener:" + listener + " on topic: " + topicName + ". " + "Reason: The listener was too slow or the retention period of the message has been violated. " + "head: " + staleSequenceException.getHeadSeq() + " sequence:" + sequence);
} else if (t instanceof HazelcastInstanceNotActiveException) {
if (logger.isFinestEnabled()) {
logger.finest("Terminating MessageListener " + listener + " on topic: " + topicName + ". " + " Reason: HazelcastInstance is shutting down");
}
} else if (t instanceof DistributedObjectDestroyedException) {
if (logger.isFinestEnabled()) {
logger.finest("Terminating MessageListener " + listener + " on topic: " + topicName + ". " + "Reason: Topic is destroyed");
}
} else {
logger.warning("Terminating MessageListener " + listener + " on topic: " + topicName + ". " + "Reason: Unhandled exception, message: " + t.getMessage(), t);
}
cancel();
}
use of com.hazelcast.spi.exception.DistributedObjectDestroyedException in project hazelcast by hazelcast.
the class ProxyServiceImpl method destroyLocalDistributedObject.
public void destroyLocalDistributedObject(String serviceName, String name, boolean fireEvent) {
ProxyRegistry registry = registries.get(serviceName);
if (registry != null) {
registry.destroyProxy(name, fireEvent);
destroyedCounter.inc();
}
RemoteService service = nodeEngine.getService(serviceName);
service.destroyDistributedObject(name);
String message = "DistributedObject[" + service + " -> " + name + "] has been destroyed!";
Throwable cause = new DistributedObjectDestroyedException(message);
nodeEngine.getOperationParker().cancelParkedOperations(serviceName, name, cause);
}
use of com.hazelcast.spi.exception.DistributedObjectDestroyedException in project hazelcast by hazelcast.
the class QueueEvictionTest method testQueueEviction_whenTtlIsSet_thenTakeThrowsException.
@Test
public void testQueueEviction_whenTtlIsSet_thenTakeThrowsException() throws Exception {
String queueName = randomString();
Config config = smallInstanceConfig();
config.getQueueConfig(queueName).setPriorityComparatorClassName(comparatorClassName).setEmptyQueueTtl(2);
HazelcastInstance hz = createHazelcastInstance(config);
IQueue<VersionedObject<String>> queue = hz.getQueue(queueName);
try {
assertTrue(queue.offer(new VersionedObject<>("item")));
assertEquals(new VersionedObject<>("item"), queue.poll());
queue.take();
fail();
} catch (DistributedObjectDestroyedException expected) {
ignore(expected);
}
assertEquals(0, queue.size());
}
use of com.hazelcast.spi.exception.DistributedObjectDestroyedException in project hazelcast by hazelcast.
the class ProxyServiceImpl method destroyLocalDistributedObject.
@Override
public void destroyLocalDistributedObject(String serviceName, String name, UUID source, boolean fireEvent) {
ProxyRegistry registry = registries.get(serviceName);
if (registry != null) {
registry.destroyProxy(name, source, fireEvent);
destroyedCounter.inc();
}
RemoteService service = nodeEngine.getService(serviceName);
service.destroyDistributedObject(name);
String message = "DistributedObject[" + service + " -> " + name + "] has been destroyed!";
Throwable cause = new DistributedObjectDestroyedException(message);
nodeEngine.getOperationParker().cancelParkedOperations(serviceName, name, cause);
}
use of com.hazelcast.spi.exception.DistributedObjectDestroyedException in project hazelcast by hazelcast.
the class AbstractBlockingService method onRaftNodeTerminated.
@Override
public final void onRaftNodeTerminated(CPGroupId groupId) {
ResourceRegistry<W, R> registry = registries.get(groupId);
if (registry != null) {
Collection<Long> indices = registry.destroy();
completeFutures(groupId, indices, new DistributedObjectDestroyedException(groupId + " is destroyed"));
}
}
Aggregations