/** * Sets the default bus if a default bus is not already set. * * @param bus the default bus. * @return true if the bus was not set and is now set */ public static synchronized boolean possiblySetDefaultBus(Bus bus) { BusHolder b = getThreadBusHolder(false); if (b.bus == null) { b.bus = bus; } if (defaultBus == null) { defaultBus = bus; return true; } return false; }
/** * Sets the default bus if a default bus is not already set. * * @param bus the default bus. * @return true if the bus was not set and is now set */ public static synchronized boolean possiblySetDefaultBus(Bus bus) { BusHolder b = getThreadBusHolder(false); if (b.bus == null) { b.bus = bus; } if (defaultBus == null) { defaultBus = bus; return true; } return false; }
/** * Sets the default bus if a default bus is not already set. * * @param bus the default bus. * @return true if the bus was not set and is now set */ public static synchronized boolean possiblySetDefaultBus(Bus bus) { BusHolder b = getThreadBusHolder(false); if (b.bus == null) { b.bus = bus; } if (defaultBus == null) { defaultBus = bus; return true; } return false; }
/** * Sets the default bus if a default bus is not already set. * * @param bus the default bus. * @return true if the bus was not set and is now set */ public static synchronized boolean possiblySetDefaultBus(Bus bus) { BusHolder b = getThreadBusHolder(false); if (b.bus == null) { b.bus = bus; } if (defaultBus == null) { defaultBus = bus; return true; } return false; }
/** * Sets the default bus. * * @param bus the default bus. */ public static synchronized void setDefaultBus(Bus bus) { defaultBus = bus; BusHolder b = getThreadBusHolder(false); b.bus = bus; if (bus == null) { b.stale = true; THREAD_BUS.remove(); } }
/** * Sets the default bus. * * @param bus the default bus. */ public static synchronized void setDefaultBus(Bus bus) { defaultBus = bus; BusHolder b = getThreadBusHolder(false); b.bus = bus; if (bus == null) { b.stale = true; THREAD_BUS.remove(); } }
/** * Sets the default bus. * * @param bus the default bus. */ public static synchronized void setDefaultBus(Bus bus) { defaultBus = bus; BusHolder b = getThreadBusHolder(false); b.bus = bus; if (bus == null) { b.stale = true; THREAD_BUS.remove(); } }
/** * Sets the default bus. * * @param bus the default bus. */ public static synchronized void setDefaultBus(Bus bus) { defaultBus = bus; BusHolder b = getThreadBusHolder(false); b.bus = bus; if (bus == null) { b.stale = true; THREAD_BUS.remove(); } }
private static synchronized Bus createThreadBus() { BusHolder b = getThreadBusHolder(false); if (b.bus == null) { b.bus = getDefaultBus(true); } return b.bus; } /**
private static synchronized Bus createThreadBus() { BusHolder b = getThreadBusHolder(false); if (b.bus == null) { b.bus = getDefaultBus(true); } return b.bus; } /**
private static synchronized Bus createThreadBus() { BusHolder b = getThreadBusHolder(false); if (b.bus == null) { b.bus = getDefaultBus(true); } return b.bus; } /**
private static synchronized Bus createThreadBus() { BusHolder b = getThreadBusHolder(false); if (b.bus == null) { b.bus = getDefaultBus(true); } return b.bus; } /**
/** * Sets the default bus for the thread. * * @param bus the default bus. */ public static void setThreadDefaultBus(Bus bus) { if (bus == null) { BusHolder h = THREAD_BUS.get(); if (h == null) { Thread cur = Thread.currentThread(); synchronized (THREAD_BUSSES) { h = THREAD_BUSSES.get(cur); } } if (h != null) { h.bus = null; h.stale = true; THREAD_BUS.remove(); } } else { BusHolder b = getThreadBusHolder(true); b.bus = bus; } }
/** * Sets the default bus for the thread. * * @param bus the default bus. */ public static void setThreadDefaultBus(Bus bus) { if (bus == null) { BusHolder h = THREAD_BUS.get(); if (h == null) { Thread cur = Thread.currentThread(); synchronized (THREAD_BUSSES) { h = THREAD_BUSSES.get(cur); } } if (h != null) { h.bus = null; h.stale = true; THREAD_BUS.remove(); } } else { BusHolder b = getThreadBusHolder(true); b.bus = bus; } }
/** * Sets the default bus for the thread. * * @param bus the default bus. */ public static void setThreadDefaultBus(Bus bus) { if (bus == null) { BusHolder h = THREAD_BUS.get(); if (h == null) { Thread cur = Thread.currentThread(); synchronized (THREAD_BUSSES) { h = THREAD_BUSSES.get(cur); } } if (h != null) { h.bus = null; h.stale = true; THREAD_BUS.remove(); } } else { BusHolder b = getThreadBusHolder(true); b.bus = bus; } }
/** * Sets the default bus for the thread. * * @param bus the new thread default bus. * @return the old thread default bus or null */ public static Bus getAndSetThreadDefaultBus(Bus bus) { if (bus == null) { BusHolder b = THREAD_BUS.get(); if (b == null) { Thread cur = Thread.currentThread(); synchronized (THREAD_BUSSES) { b = THREAD_BUSSES.get(cur); } } if (b != null) { Bus orig = b.bus; b.bus = null; b.stale = true; THREAD_BUS.remove(); return orig; } return null; } BusHolder b = getThreadBusHolder(true); Bus old = b.bus; b.bus = bus; return old; }
/** * Sets the default bus for the thread. * * @param bus the new thread default bus. * @return the old thread default bus or null */ public static Bus getAndSetThreadDefaultBus(Bus bus) { if (bus == null) { BusHolder b = THREAD_BUS.get(); if (b == null) { Thread cur = Thread.currentThread(); synchronized (THREAD_BUSSES) { b = THREAD_BUSSES.get(cur); } } if (b != null) { Bus orig = b.bus; b.bus = null; b.stale = true; THREAD_BUS.remove(); return orig; } return null; } BusHolder b = getThreadBusHolder(true); Bus old = b.bus; b.bus = bus; return old; }
/** * 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() {