Skip navigation links

Package com.atlassian.confluence.util.sandbox

Sandbox framework enables running any java code independent from Confluence core in a separate OS process which can crash, run out of memory, being killed and restarted without affecting Confluence.

See: Description

Package com.atlassian.confluence.util.sandbox Description

Sandbox framework enables running any java code independent from Confluence core in a separate OS process which can crash, run out of memory, being killed and restarted without affecting Confluence. Confluence provides the sandbox service that can be imported and then used by a plugin to create sandbox for running unsafe code. E.g.

     Sandbox sandbox = sandboxService.create(SandboxConfiguration.builder()
                                              .memoryLimitInMegabytes(512)
                                              .concurrencyLevel(2)
                                              .build());

 
The created sandbox object then can be used for running different sandbox tasks as long as they come from the same class loader. This usually implies that to run code from an OSGI module, a sandbox needs to be created for that module.

     SandboxTask<String, String> task = new ReverseStringTask();
     sandbox.submit(task, "hello world");

 
Each instance of a sandbox is a java process consuming substantial amount of memory and takes non negligible amount of time to start so it is preferably created once and reused during a lifetime of Confluence.
Skip navigation links

Copyright © 2003–2018 Atlassian. All rights reserved.