public class MemoryLimiter
extends java.lang.Object
MemoryLimitCalculator| Constructor and Description |
|---|
MemoryLimiter(java.lang.instrument.Instrumentation inst) |
MemoryLimiter(long memoryLimit,
java.lang.instrument.Instrumentation inst) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
acquire(java.lang.Object o)
acquire memory by
Object. |
boolean |
acquire(java.lang.Object o,
long timeout,
java.util.concurrent.TimeUnit unit)
acquire memory by
Object. |
void |
acquireInterruptibly(java.lang.Object o)
acquire memory by
Object. |
long |
getCurrentMemory()
get the current memory.
|
long |
getCurrentRemainMemory()
get the current remain memory.
|
long |
getMemoryLimit()
get the memory limit.
|
void |
release(java.lang.Object o)
release memory by
Object. |
void |
releaseInterruptibly(java.lang.Object o)
release memory by
Object. |
void |
releaseInterruptibly(java.lang.Object o,
long timeout,
java.util.concurrent.TimeUnit unit)
release memory by
Object. |
void |
reset()
reset this MemoryLimiter.
|
void |
setMemoryLimit(long memoryLimit)
set the memory limit.
|
public MemoryLimiter(java.lang.instrument.Instrumentation inst)
public MemoryLimiter(long memoryLimit,
java.lang.instrument.Instrumentation inst)
public void setMemoryLimit(long memoryLimit)
memoryLimit - the memory limitpublic long getMemoryLimit()
public long getCurrentMemory()
public long getCurrentRemainMemory()
public boolean acquire(java.lang.Object o)
Object.
this method does not respond to interrupts.o - memory size to be applied by calculatingpublic boolean acquire(java.lang.Object o,
long timeout,
java.util.concurrent.TimeUnit unit)
throws java.lang.InterruptedException
Object.
this method response to interrupts.o - memory size to be applied by calculatingtimeout - max time to waitunit - time unitjava.lang.InterruptedException - the InterruptedExceptionpublic void acquireInterruptibly(java.lang.Object o)
throws java.lang.InterruptedException
Object.
this method response to interrupts.o - memory size to be applied by calculatingjava.lang.InterruptedException - the InterruptedExceptionpublic void release(java.lang.Object o)
Object.
this method does not respond to interrupts.o - memory size to be applied by calculatingpublic void releaseInterruptibly(java.lang.Object o)
throws java.lang.InterruptedException
Object.
this method response to interrupts.o - memory size to be applied by calculatingjava.lang.InterruptedException - the InterruptedExceptionpublic void releaseInterruptibly(java.lang.Object o,
long timeout,
java.util.concurrent.TimeUnit unit)
throws java.lang.InterruptedException
Object.
this method response to interrupts.o - memory size to be applied by calculatingtimeout - max time to waitunit - time unitjava.lang.InterruptedException - the InterruptedExceptionpublic void reset()
Copyright © 2024 The Apache Software Foundation. All rights reserved.