SecurityManager csm = conf().get(RythmConfigurationKey.SANDBOX_SECURITY_MANAGER_IMPL);
int timeout = (Integer) conf().get(RythmConfigurationKey.SANDBOX_TIMEOUT);
SandboxThreadFactory fact = conf().get(RythmConfigurationKey.SANBOX_THREAD_FACTORY_IMPL);
SecurityManager ssm = System.getSecurityManager();
RythmSecurityManager rsm;
String code;
if (null == ssm || !(ssm instanceof RythmSecurityManager)) {
code = conf().get(RythmConfigurationKey.SANDBOX_SECURE_CODE);
rsm = new RythmSecurityManager(csm, code, this);
} else {
rsm = ((RythmSecurityManager) ssm);
code = rsm.getCode();
}
secureCode = code;
_secureExecutor = new SandboxExecutingService(poolSize, fact, timeout, this, code);
Sandbox sandbox = new Sandbox(this, _secureExecutor);
if (ssm != rsm) System.setSecurityManager(rsm);