src/main/java/application/rest/v1/configmaps/KindActionMappingCache.java
/**
     * Get all "KindActionMapping" custom resources in the kam cache. If the cache is not available yet,
     * set it up and populate it with kams retrieved from the cluster.
     * 
     * @param client ApiClient
     * @return a list of KAM CR instances in the kam cache
     * @throws ApiException
     */
Get all "KindActionMapping" custom resources in the kam cache. If the cache is not available yet,
set it up and populate it with kams retrieved from the cluster.

@param client ApiClient
@return a list of KAM CR instances in the kam cache
@throws ApiException
Get all " KindActionMapping " custom resources in the kam cache . If the cache is not available yet set it up and populate it with kams retrieved from the cluster . @param client ApiClient @return a list of KAM CR instances in the kam cache @throws ApiException
public static List<JsonObject> listKAMCustomResources(ApiClient client) throws ApiException {
        String methodName = "listKAMCustomResources";
        if (Logger.isEntryEnabled())
                Logger.log(CLASS_NAME, methodName, Logger.LogType.ENTRY, ""); 
        List<JsonObject> kamList = null;
        Object kamWatcher = KAM_WATCHER_REF.get();
        if (kamWatcher != null) {
            final KAMCache kamCacheObj = KAM_CACHE_REF.get();
            if (kamCacheObj != null) {
                final List<JsonObject> kamCacheList = kamCacheObj.getKamCacheList();
                if (kamCacheList != null) {
                    if (Logger.isDebugEnabled()) {
                        Logger.log(CLASS_NAME,methodName, Logger.LogType.DEBUG, 
                                   "Returning cached KindActionMapping list for all namespaces.");
                    }
                    kamList = kamCacheList;
                } 
            } 
            if (kamList == null) {                             
                List<JsonObject> kams = listKAMCustomResourcesFromCluster(client);
                if (kams != null ) {
                    final long modCount = MOD_COUNT.get();
                    KAM_CACHE_REF.set(new KAMCache(kams, modCount));
                    kamList = Collections.unmodifiableList(kams);
                    if (Logger.isDebugEnabled()) {
                        Logger.log(CLASS_NAME, methodName, Logger.LogType.DEBUG, 
                           "Caching KindActionMapping list for all namespaces.");
                    }
                }
            }
        } else {  
            synchronized (LOCK) {
                LOCK.notify();
            }
            if (Logger.isDebugEnabled())
                Logger.log(CLASS_NAME, methodName, Logger.LogType.DEBUG, 
                        "No KAM cache available. Notify thread (" + WATCHER_THREAD_NAME + 
                        ") to awaken and re-establish the cache and retrieve kams from the cluster.");
            List<JsonObject> kams = listKAMCustomResourcesFromCluster(client);
            if (kams != null)
                kamList = Collections.unmodifiableList(kams);
        }
        if (Logger.isExitEnabled())
            Logger.log(CLASS_NAME, methodName, Logger.LogType.EXIT, "Found " + kamList.size() + " kams"); 
        return kamList;  
    }
public static List < JsonObject > listKAMCustomResources ( ApiClient client ) throws ApiException { String methodName = "listKAMCustomResources" ; if ( Logger . isEntryEnabled ( ) ) Logger . log ( CLASS_NAME , methodName , Logger . LogType . ENTRY , "" ) ; List < JsonObject > kamList = null ; Object kamWatcher = KAM_WATCHER_REF . get ( ) ; if ( kamWatcher != null ) { final KAMCache kamCacheObj = KAM_CACHE_REF . get ( ) ; if ( kamCacheObj != null ) { final List < JsonObject > kamCacheList = kamCacheObj . getKamCacheList ( ) ; if ( kamCacheList != null ) { if ( Logger . isDebugEnabled ( ) ) { Logger . log ( CLASS_NAME , methodName , Logger . LogType . DEBUG , "Returning cached KindActionMapping list for all namespaces." ) ; } kamList = kamCacheList ; } } if ( kamList == null ) { List < JsonObject > kams = listKAMCustomResourcesFromCluster ( client ) ; if ( kams != null ) { final long modCount = MOD_COUNT . get ( ) ; KAM_CACHE_REF . set ( new KAMCache ( kams , modCount ) ) ; kamList = Collections . unmodifiableList ( kams ) ; if ( Logger . isDebugEnabled ( ) ) { Logger . log ( CLASS_NAME , methodName , Logger . LogType . DEBUG , "Caching KindActionMapping list for all namespaces." ) ; } } } } else { synchronized ( LOCK ) { LOCK . notify ( ) ; } if ( Logger . isDebugEnabled ( ) ) Logger . log ( CLASS_NAME , methodName , Logger . LogType . DEBUG , "No KAM cache available. Notify thread (" + WATCHER_THREAD_NAME + ") to awaken and re-establish the cache and retrieve kams from the cluster." ) ; List < JsonObject > kams = listKAMCustomResourcesFromCluster ( client ) ; if ( kams != null ) kamList = Collections . unmodifiableList ( kams ) ; } if ( Logger . isExitEnabled ( ) ) Logger . log ( CLASS_NAME , methodName , Logger . LogType . EXIT , "Found " + kamList . size ( ) + " kams" ) ; return kamList ; }
Get all "KindActionMapping" custom resources in the kam cache.
Get all " KindActionMapping " custom resources in the kam cache .
// No cached value. Retrieve the list directly from the cluster and cache it.  // No Cached value Retrieve the list directly from the cluster and cache it. // Wake up the working thread if there's no cache.