/** * Gets the default bus for the thread, creating if needed * * @param createIfNeeded Set to true to create a default bus if one doesn't exist * @return the default bus. */ public static Bus getThreadDefaultBus(boolean createIfNeeded) { if (createIfNeeded) { BusHolder b = getThreadBusHolder(false); if (b.bus == null) { b.bus = createThreadBus(); } return b.bus; } BusHolder h = THREAD_BUS.get(); if (h == null || h.stale) { Thread cur = Thread.currentThread(); synchronized (THREAD_BUSSES) { h = THREAD_BUSSES.get(cur); } } return h == null || h.stale ? null : h.bus; } private static synchronized Bus createThreadBus() {
/** * Gets the default bus for the thread, creating if needed * * @param createIfNeeded Set to true to create a default bus if one doesn't exist * @return the default bus. */ public static Bus getThreadDefaultBus(boolean createIfNeeded) { if (createIfNeeded) { BusHolder b = getThreadBusHolder(false); if (b.bus == null) { b.bus = createThreadBus(); } return b.bus; } BusHolder h = THREAD_BUS.get(); if (h == null || h.stale) { Thread cur = Thread.currentThread(); synchronized (THREAD_BUSSES) { h = THREAD_BUSSES.get(cur); } } return h == null || h.stale ? null : h.bus; } private static synchronized Bus createThreadBus() {
/** * Gets the default bus for the thread, creating if needed * * @param createIfNeeded Set to true to create a default bus if one doesn't exist * @return the default bus. */ public static Bus getThreadDefaultBus(boolean createIfNeeded) { if (createIfNeeded) { BusHolder b = getThreadBusHolder(false); if (b.bus == null) { b.bus = createThreadBus(); } return b.bus; } BusHolder h = THREAD_BUS.get(); if (h == null || h.stale) { Thread cur = Thread.currentThread(); synchronized (THREAD_BUSSES) { h = THREAD_BUSSES.get(cur); } } return h == null || h.stale ? null : h.bus; } private static synchronized Bus createThreadBus() {
/** * Gets the default bus for the thread, creating if needed * * @param createIfNeeded Set to true to create a default bus if one doesn't exist * @return the default bus. */ public static Bus getThreadDefaultBus(boolean createIfNeeded) { if (createIfNeeded) { BusHolder b = getThreadBusHolder(false); if (b.bus == null) { b.bus = createThreadBus(); } return b.bus; } BusHolder h = THREAD_BUS.get(); if (h == null || h.stale) { Thread cur = Thread.currentThread(); synchronized (THREAD_BUSSES) { h = THREAD_BUSSES.get(cur); } } return h == null || h.stale ? null : h.bus; } private static synchronized Bus createThreadBus() {