+ /**
+ * Creates a new context based on some properties of the current context.
+ * The new context is safe for use in parallel threads.
+ */
+ public static SCLContext createDerivedContext() {
+ SCLContext newContext = new SCLContext();
+
+ SCLContext baseContext = CONTEXT.get();
+ if(baseContext != null) {
+ Object reportingHandler = baseContext.get(SCLReportingHandler.REPORTING_HANDLER);
+ if(reportingHandler != null)
+ newContext.put(SCLReportingHandler.REPORTING_HANDLER, reportingHandler);
+ }
+ return newContext;
+ }
+