org.apache.activemq.usage
Class MemoryUsage
java.lang.Object
org.apache.activemq.usage.Usage<MemoryUsage>
org.apache.activemq.usage.MemoryUsage
- All Implemented Interfaces:
- Service
public class MemoryUsage
- extends Usage<MemoryUsage>
Used to keep track of how much of something is being used so that a
productive working set usage can be controlled. Main use case is manage
memory usage.
Methods inherited from class org.apache.activemq.usage.Usage |
addChild, addUsageListener, caclPercentUsage, getExecutor, getLimit, getLimiter, getName, getParent, getPercentUsage, getPercentUsageMinDelta, getPollingTime, getUsagePortion, isFull, notifyCallbackWhenNotFull, onLimitChange, removeChild, removeUsageListener, setExecutor, setLimit, setLimiter, setName, setParent, setPercentUsage, setPercentUsageMinDelta, setPollingTime, setUsagePortion, start, stop, toString, waitForSpace |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
MemoryUsage
public MemoryUsage()
MemoryUsage
public MemoryUsage(MemoryUsage parent)
- Create the memory manager linked to a parent. When the memory manager is
linked to a parent then when usage increased or decreased, the parent's
usage is also increased or decreased.
- Parameters:
parent
-
MemoryUsage
public MemoryUsage(java.lang.String name)
MemoryUsage
public MemoryUsage(MemoryUsage parent,
java.lang.String name)
MemoryUsage
public MemoryUsage(MemoryUsage parent,
java.lang.String name,
float portion)
waitForSpace
public void waitForSpace()
throws java.lang.InterruptedException
- Overrides:
waitForSpace
in class Usage<MemoryUsage>
- Throws:
java.lang.InterruptedException
waitForSpace
public boolean waitForSpace(long timeout)
throws java.lang.InterruptedException
- Overrides:
waitForSpace
in class Usage<MemoryUsage>
- Parameters:
timeout
-
- Returns:
- true if space
- Throws:
java.lang.InterruptedException
isFull
public boolean isFull()
- Overrides:
isFull
in class Usage<MemoryUsage>
enqueueUsage
public void enqueueUsage(long value)
throws java.lang.InterruptedException
- Tries to increase the usage by value amount but blocks if this object is
currently full.
- Parameters:
value
-
- Throws:
java.lang.InterruptedException
increaseUsage
public void increaseUsage(long value)
- Increases the usage by the value amount.
- Parameters:
value
-
decreaseUsage
public void decreaseUsage(long value)
- Decreases the usage by the value amount.
- Parameters:
value
-
retrieveUsage
protected long retrieveUsage()
- Specified by:
retrieveUsage
in class Usage<MemoryUsage>
getUsage
public long getUsage()
- Overrides:
getUsage
in class Usage<MemoryUsage>
setUsage
public void setUsage(long usage)
Copyright © 2005-2016. All Rights Reserved.