See: Description
Interface | Description |
---|---|
Sandbox |
A sandbox is an object responsible for running java code in an isolated OS process.
|
SandboxCallback<T,R> |
During the course of work a
SandboxTask which is executed in a sandbox process may need to ask the host for
a specific information or an action. |
SandboxCallbackContext |
The execution context for a
SandboxCallback . |
SandboxErrorConsumer |
Consumer of a single line of sandbox standard error.
|
SandboxRegistry |
This is the entry point for usage of sandbox API.
|
SandboxSerializer<T> |
Handles Serialization/deserialization input and output for
SandboxTask . |
SandboxSpec |
Specification for the sandbox which will be used in searching the most suitable sandbox instance in
SandboxRegistry . |
SandboxSpec.SpecBuilder | |
SandboxTask<T,R> |
Represents a task intended to be executed in a process sandbox.
|
SandboxTaskContext |
The execution context for a
SandboxTask . |
Class | Description |
---|---|
SandboxSerializers |
Utility methods for serialization/deserialization.
|
SandboxSerializers.CompositeByteArraySerializer | |
SandboxSerializers.DurationSerializer | |
SandboxSerializers.IntSerializer | |
SandboxSerializers.StringSerializer |
Exception | Description |
---|---|
SandboxCrashedException |
Is thrown when sandbox JVM has crashed
|
SandboxException |
This error is thrown when sandbox failed to start or serve a request (e.g.
|
SandboxNotFoundException |
This error is thrown when sandbox instance with given spec can't be obtained
|
SandboxStartupException |
If thrown when the sandbox process has been failed to start
|
SandboxTimeoutException |
Is thrown when the sandbox process has been killed due to the timeout
|
Confluence provides the sandbox registry that can be imported and then used by a plugin to obtain a sandbox for running unsafe code. E.g.
SandboxSpec spec = SandboxSpec.builder()
.withMinimumMemoryInMb(512)
.build(Duration.ofSeconds(30));
Sandbox sandbox = sandboxRegistry.get(spec);
The obtained sandbox object then can be used for running different sandbox tasks.
SandboxTask<String, String> task = new ReverseStringTask();
sandbox.execute(task, "hello world");
Each instance of a sandbox is a java process with substantial amount of memory. There's a limited number of sandbox processes and they might be shared between Confluence core and plugins. For this reason, sandbox tasks should be created with as little time limit, as possible.
Copyright © 2003–2021 Atlassian. All rights reserved.