private void apply() { setMdc(MDC_DOMAIN, _domain); setMdc(MDC_CELL, _cell); setMdc(MDC_SESSION, _session); if (_ndc == null) { NDC.clear(); } else { NDC.set(_ndc); } }
/** * Execute the given runnable within the context of this CDC. */ public void execute(Runnable r) { String session = MDC.get(MDC_SESSION); String cell = MDC.get(MDC_CELL); String domain = MDC.get(MDC_DOMAIN); NDC ndc = NDC.cloneNdc(); try { apply(); r.run(); } finally { setMdc(MDC_DOMAIN, domain); setMdc(MDC_CELL, cell); setMdc(MDC_SESSION, session); NDC.set(ndc); } }
NDC.set(ndc);