Example usage for org.apache.commons.collections.map LRUMap maxSize

List of usage examples for org.apache.commons.collections.map LRUMap maxSize

Introduction

In this page you can find the example usage for org.apache.commons.collections.map LRUMap maxSize.

Prototype

int maxSize

To view the source code for org.apache.commons.collections.map LRUMap maxSize.

Click Source Link

Document

Maximum size

Usage

From source file:de.suse.swamp.modules.screens.Debug.java

public void doBuildTemplate(RunData data, Context context) throws Exception {
    super.doBuildTemplate(data, context);

    // Memory Stuff 
    long totalMem = Runtime.getRuntime().totalMemory() / 1024l / 1024l;
    int cpu = Runtime.getRuntime().availableProcessors();
    long freeMem = Runtime.getRuntime().freeMemory() / 1024l / 1024l;
    long usedMem = totalMem - freeMem;
    String user = data.getUser().getName();
    SWAMPAPI swamp = new SWAMPAPI();
    WorkflowAPI wfApi = new WorkflowAPI();
    TaskAPI taskApi = new TaskAPI();
    SecurityAPI secApi = new SecurityAPI();
    DataAPI dataApi = new DataAPI();

    context.put("bootdate", swamp.doGetProperty("bootDate", user));
    context.put("standardlogo", "true");

    context.put("totalMem", String.valueOf(totalMem));
    context.put("cpu", String.valueOf(cpu));
    context.put("freeMem", String.valueOf(freeMem));
    context.put("usedMem", String.valueOf(usedMem));

    context.put("buildtime", swamp.doGetProperty("BUILDTIME", user));
    context.put("buildhost", swamp.doGetProperty("BUILDHOST", user));

    // cache information: 
    context.put("taskcachesize", String.valueOf(taskApi.doGetTaskCacheSize(user)));
    LRUMap cache = wfApi.doGetWorkflowCache(user);
    context.put("cacheMaxsize", String.valueOf(cache.maxSize()));
    context.put("cachesize", String.valueOf(cache.size()));
    context.put("usercachesize", String.valueOf(secApi.doGetUserCacheSize(user)));
    context.put("datacachesize", String.valueOf(dataApi.doGetDatacacheSize(user)));

    // job scheduler (TurbineSchedulerService)
    context.put("jobs", TurbineScheduler.listJobs());

}

From source file:org.lockss.plugin.AuSearchSet.java

private void set404CacheSize(int newSize) {
    if (newSize < 0) {
        // shouldn't happen, but ignore rather than throw
        log.error("AuSearchSet size < 0");
    }/*from  w  ww.j a va  2 s.  co  m*/
    LRUMap map = recent404s;
    if (map == null) {
        recent404Size = newSize;
        return;
    }
    synchronized (map) {
        if (newSize == 0) {
            if (log.isDebug2())
                log.debug2("Removing 404 cache.");
            recent404s = null;
        } else if (map.maxSize() < newSize) {
            LRUMap newMap = new LRUMap(newSize);
            newMap.putAll(map);
            if (log.isDebug2())
                log.debug2("Enlarging 404 cache.");
            recent404s = newMap;
        }
        recent404Size = newSize;
    }
}