class ZTSAccessTokenFileLoader {

    public void preload() {
        File dir = new File(path);

        // preload the map from the <domain, rolesname> -> <file path>
        // expected dir should be <base token path>/<domain dir>/<token file>s
        // after preload the map, when we look up the access token,
        // the map will directly read the required file
        if (dir.exists() && dir.isDirectory()) {
            for (File domainDir: dir.listFiles()) {
                if (domainDir.isDirectory()) {
                    for (File tokenFile: domainDir.listFiles()) {
                        if (!tokenFile.isDirectory()) {
                            AccessTokenResponse accessTokenResponse = null;
                            try {
                                accessTokenResponse = objectMapper.readValue(tokenFile, AccessTokenResponse.class);
                            } catch (IOException e) {
                                LOG.error("Failed to load or parse token file: {}", tokenFile);
                            }

                            // if access token parsed fail, continue to scan tokens
                            if (accessTokenResponse == null) {
                                continue;
                            }

                            AccessTokenResponseCacheEntry cacheEntry = new AccessTokenResponseCacheEntry(accessTokenResponse);

                            // check access token is still valid
                            if (!cacheEntry.isExpired(-1)) {
                                addToRoleMap(domainDir.getName(), tokenFile.getName(), accessTokenResponse);
                            }
                        }
                    }
                }
            }
        }

    }

    public  ZTSAccessTokenFileLoader(JwtsSigningKeyResolver resolver);

}