Interface Sandbox
-
@ExperimentalApi public interface Sandbox
A sandbox is an object responsible for running java code in an isolated OS process. Sandbox is designed to run unsafe code which can timeout, run out of memory or take substantial CPU load. Any failures of sandbox process will not affect Confluence stability.Sandbox objects are obtained from injected
SandboxRegistry
. For unit tests,com.atlassian.confluence.impl.util.sandbox.TestSandbox
should be used.- Since:
- 6.9
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T,R>
Rexecute(SandboxTask<T,R> task, T input)
Run the given task with the given input in a process sandbox.<T,R>
Rexecute(SandboxTask<T,R> task, T input, Duration timeLimit)
Run the given task with the given input in a process sandbox and limit a call by a given time limit.
-
-
-
Method Detail
-
execute
<T,R> R execute(SandboxTask<T,R> task, T input)
Run the given task with the given input in a process sandbox.- Throws:
SandboxTimeoutException
- when sandbox request has been timed outSandboxCrashedException
- when sandbox JVM has been crashedSandboxException
- if sandbox request has failed for some other reason
-
execute
<T,R> R execute(SandboxTask<T,R> task, T input, Duration timeLimit)
Run the given task with the given input in a process sandbox and limit a call by a given time limit.- Throws:
SandboxTimeoutException
- when sandbox request has been timed outSandboxCrashedException
- when sandbox JVM has been crashedSandboxException
- if sandbox request has failed for some other reason
-
-