List of utility methods to do AtomicReference
int | length(AtomicReferenceArray> buf) length return buf.length();
|
Properties | mergeProperties(Properties... properties) Merges the passed properties Properties allProps = new Properties(System.getProperties()); for (int i = properties.length - 1; i >= 0; i--) { if (properties[i] != null && properties[i].size() > 0) { allProps.putAll(properties[i]); final Properties appProps = appProperties.get(); if (appProps != null) { ... |
Object[] | pack(int count, Object[] array, AtomicReference pack Object[] newArray = new Object[2 * (count - 1)]; int j = 1; int bitmap = 0; for (int i = 0; i < idx; i++) if (array[i] != null) { newArray[j] = array[i]; bitmap |= 1 << i; j += 2; ... |
void | runInThread(final Runnable runnable) run In Thread final AtomicReference<Throwable> exception = new AtomicReference<Throwable>(); Runnable exceptionGuard = new Runnable() { public void run() { try { runnable.run(); } catch (Throwable throwable) { exception.set(throwable); }; Thread thread = new Thread(exceptionGuard); thread.setDaemon(true); thread.start(); thread.join(); if (exception.get() != null) { throw exception.get(); |
void | runInThread(final Runnable runnable) run In Thread final AtomicReference<Throwable> exception = new AtomicReference<Throwable>(); Runnable exceptionGuard = new Runnable() { @Override public void run() { try { runnable.run(); } catch (Throwable thr) { exception.set(thr); ... |