com.sun.enterprise.web.ara.rules
Class HeapMemoryRule

java.lang.Object
  extended by com.sun.enterprise.web.ara.rules.ThreadRatioRule
      extended by com.sun.enterprise.web.ara.rules.HeapMemoryRule
All Implemented Interfaces:
Rule<ReadTask>, TaskListener, Callable

public class HeapMemoryRule
extends ThreadRatioRule
implements TaskListener

Based on the application context-root, configure the ReadTask Pipeline based on the policy metric defined in domain.xml.

Author:
Jeanfrancois Arcand

Field Summary
protected static ConcurrentHashMap<String,Long> appMemoryUsage
          Cache application memory usage approximation.
protected static ConcurrentHashMap<ReadTask,String> contextRootyCache
          Cache the context-root assocated with a ReadTask
protected static ConcurrentHashMap<String,Long> memoryAllowed
          The memory allocated per application.
 
Fields inherited from class com.sun.enterprise.web.ara.rules.ThreadRatioRule
ALLOCATION_MODE, allocationPolicy, CEILING, leftRatio, PATH_STRING, pipelines, privilegedTokens, QUERY_STRING, readTask, RESERVE, RULE_TOKENS
 
Constructor Summary
HeapMemoryRule()
           
 
Method Summary
 Integer call()
          Invoke the rule.
protected  boolean isAllowedToExecute(String token, Long memoryAllowedSize, Double allowedRatio)
          Determine if an application can execute based on its policy metric and method.
 void taskEvent(TaskEvent event)
          Reduce the memory usage count when an application complete its execution.
 
Methods inherited from class com.sun.enterprise.web.ara.rules.ThreadRatioRule
applyRule, attach, attachement, cancel, getContextRoot, getExecutionTime, isPipelineInUse, newPipeline, setExecutionTime, setFuture
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

memoryAllowed

protected static final ConcurrentHashMap<String,Long> memoryAllowed
The memory allocated per application.


appMemoryUsage

protected static final ConcurrentHashMap<String,Long> appMemoryUsage
Cache application memory usage approximation.


contextRootyCache

protected static final ConcurrentHashMap<ReadTask,String> contextRootyCache
Cache the context-root assocated with a ReadTask

Constructor Detail

HeapMemoryRule

public HeapMemoryRule()
Method Detail

call

public Integer call()
             throws Exception
Description copied from class: ThreadRatioRule
Invoke the rule. Based on the result of the ContextRootAlgorithm, configure the ReadTask Pipeline.

Specified by:
call in interface Callable
Overrides:
call in class ThreadRatioRule
Throws:
Exception

isAllowedToExecute

protected boolean isAllowedToExecute(String token,
                                     Long memoryAllowedSize,
                                     Double allowedRatio)
                              throws Exception
Determine if an application can execute based on its policy metric and method.

Throws:
Exception

taskEvent

public void taskEvent(TaskEvent event)
Reduce the memory usage count when an application complete its execution.

Specified by:
taskEvent in interface TaskListener


Copyright © 2005-2015 Oracle Corporation. All Rights Reserved.