Java Utililty Methods AtomicReference

List of utility methods to do AtomicReference

Description

The list of methods to do AtomicReference are organized into topic(s).

Method

intlength(AtomicReferenceArray buf)
length
return buf.length();
PropertiesmergeProperties(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 edit, int idx)
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;
...
voidrunInThread(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();
voidrunInThread(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);
...