private List<RTSGroup> loadLocalRTSGroups() {
        List<Path> rtsgPaths = Try.on(
                () -> {
                    try (Stream<Path> paths = Files.list(localDir)) {
                        return paths.filter(p -> {
                            if (!Files.isDirectory(p)) {
                                return false;
                            }
                            String name = p.getFileName().toString();
                            if (!name.startsWith("rtsg.")) {
                                return false;
                            }
                            if (rtsGroups.containsKey("rt/" + name)) {
                                return false;
                            }
                            return true;
                        }).collect(Collectors.toList());
                    }
                },
                1, logger,
                String.format("List rts group failed, ignored. [table: %s, local path: %s]", tableName, localDir));
        if (rtsgPaths == null) {
            return Collections.emptyList();
        }

        List<RTSGroup> localRTSGroups = new ArrayList<>();
        for (Path path : rtsgPaths) {
            RTSGroup rtsGroup = Try.on(
                    () -> RTSGroup.open(path, tableName),
                    1, logger,
                    String.format("Open rts group failed, ignored. [table: %s, path: %s]", tableName, path));
            if (rtsGroup != null) {
                localRTSGroups.add(rtsGroup);
            }
        }

        logger.info("load {} rts groups. [table: {}]", localRTSGroups.size(), tableName);
        return localRTSGroups;
    }
Close this realtime table. Job is done.
This method only called before process exit.
indexr-segment/src/main/java/io/indexr/segment/rt/RealtimeTable.java