Code example for AtomicReference

Methods: get

0
            file.delete();
        } 
 
        // Set up a handler to handle the completion callback 
        final Semaphore s = new Semaphore(0);
        final AtomicReference<String> msgPath = new AtomicReference<String>();
        final ValueCallback<String> callback = new ValueCallback<String>() {
            @Override 
            public void onReceiveValue(String path) {
                msgPath.set(path);
                s.release();
            } 
        }; 
 
        // Generate MHTML and wait for completion 
        ThreadUtils.runOnUiThread(new Runnable() {
            @Override 
            public void run() { 
                contents.saveWebArchive(path, autoName, callback);
            } 
        }); 
        assertTrue(s.tryAcquire(TEST_TIMEOUT, TimeUnit.MILLISECONDS));
 
        assertEquals(expectedPath, msgPath.get());
        if (expectedPath != null) {
            File file = new File(expectedPath);
            assertTrue(file.exists());
            assertTrue(file.length() > 0);
        } else {