class SegmentQueueRepository implements IQueueRepository {

    private static final Logger LOG = LoggerFactory.getLogger(SegmentQueueRepository.class);

    private final QueuePool queuePool;

    public SegmentQueueRepository(String path, int pageSize, int segmentSize) throws QueueException {
        queuePool = QueuePool.loadQueues(Paths.get(path), pageSize, segmentSize);
    }

    public SegmentQueueRepository(Path path, int pageSize, int segmentSize) throws QueueException {
        queuePool = QueuePool.loadQueues(path, pageSize, segmentSize);
    }

    @Override
    public Set<String> listQueueNames() {
        return queuePool.queueNames();
    }

    @Override
    public boolean containsQueue(String clientId) {
        return listQueueNames().contains(clientId);
    }

    @Override
    public SessionMessageQueue<SessionRegistry.EnqueuedMessage> getOrCreateQueue(String clientId) {
        final Queue segmentedQueue;
        try {
            segmentedQueue = queuePool.getOrCreate(clientId);
        } catch (QueueException e) {
            throw new RuntimeException(e);
        }
        return new SegmentPersistentQueue(segmentedQueue);
    }

    @Override
    public void close() {<FILL_FUNCTION_BODY>}
}

        try {
            queuePool.close();
        } catch (QueueException e) {
            LOG.error("Error saving state of the queue pool", e);
        }
    
<no_super_class>