queue manager name

This commit is contained in:
Andrea Cavalli 2023-10-20 17:52:02 +02:00
parent 67402c3ef6
commit fd5764d30d
5 changed files with 19 additions and 5 deletions

View File

@ -4,7 +4,7 @@
<groupId>it.cavallium</groupId>
<artifactId>filequeue</artifactId>
<name>file queue project</name>
<version>3.1.9</version>
<version>3.1.10</version>
<packaging>jar</packaging>
<description>Light weight, high performance, simple, reliable and persistent queue</description>
<modelVersion>4.0.0</modelVersion>

View File

@ -17,7 +17,12 @@ public final class LMDBQueueToConsumer<T> implements IQueueToConsumer<T> {
QueueConsumer<T> consumer) {
this.env = LMDBEnvManager.ofPath(file);
this.queueLMDB = new SimpleQueueLMDB<>(env, dbName, serializer, deserializer);
this.queue = new QueueToConsumer<>(queueLMDB, consumer);
this.queue = new QueueToConsumer<>(queueLMDB, consumer) {
@Override
protected String getQueueManagerName() {
return super.getQueueManagerName() + "-" + dbName;
}
};
}
@Override

View File

@ -27,7 +27,12 @@ public final class MemorySegmentQueueToConsumer<T> implements IQueueToConsumer<T
} catch (IOException e) {
throw new UncheckedIOException(e);
}
this.queue = new QueueToConsumer<>(queueMemorySegment, consumer);
this.queue = new QueueToConsumer<>(queueMemorySegment, consumer) {
@Override
protected String getQueueManagerName() {
return super.getQueueManagerName() + "-" + dbName;
}
};
}
@Override

View File

@ -24,10 +24,14 @@ class QueueToConsumer<T> implements IQueueToConsumer<T> {
this.afterAddQueued = new AtomicLong(queue.size());
}
protected String getQueueManagerName() {
return "queue-manager";
}
public synchronized void startQueue() {
if (manager == null) {
this.manager = new Manager();
manager.setName("queue-manager");
manager.setName(getQueueManagerName());
manager.start();
}
}

View File

@ -142,7 +142,7 @@ public class SimpleQueueMemorySegment<T> implements SimpleQueue<T>, Closeable {
@Override
public int size() {
return 0;
return this.queueSegments.stream().mapToInt(SimpleQueueMemorySegmentFixedSize::size).sum();
}
@Override