Class SandboxLimits.Builder
java.lang.Object
org.codehaus.commons.compiler.sandbox.SandboxLimits.Builder
- Enclosing class:
SandboxLimits
Creates
SandboxLimits.-
Method Summary
Modifier and TypeMethodDescriptionbuild()maxAllocatedBytes(long maxAllocatedBytes) Limits the number of bytes that the executing thread allocates on the heap.maxTicks(long maxTicks) Limits the number of "ticks" of an execution.Limits the wall-clock time of an execution.
-
Method Details
-
timeout
Limits the wall-clock time of an execution.- Parameters:
duration- Must be positive
-
maxTicks
Limits the number of "ticks" of an execution. Code that JANINO compiles with aSandboxPolicyticks once per loop iteration and once per method or constructor invocation. This limit is deterministic, i.e. independent of the speed of the machine.- Parameters:
maxTicks- Must be positive
-
maxAllocatedBytes
Limits the number of bytes that the executing thread allocates on the heap. The allocated bytes are measured withcom.sun.management.ThreadMXBean.getThreadAllocatedBytes(long); on JVMs that do not support it, this limit is not enforced (seeSandboxLimits.isMemoryLimitSupported()).- Parameters:
maxAllocatedBytes- Must be positive
-
build
-