Code example for AtomicReference

Methods: getAndSet

0
        } 
        return null; 
    } 
 
    private static void setInstance(CommandLine commandLine) {
        CommandLine oldCommandLine = sCommandLine.getAndSet(commandLine);
        if (oldCommandLine != null && oldCommandLine.isNativeImplementation()) {
            nativeReset(); 
        } 
    } 
 
    /** 
     * @param fileName the file to read in. 
     * @param sizeLimit cap on the file size: will throw an exception if exceeded 
     * @return Array of chars read from the file 
     * @throws FileNotFoundException file does not exceed 
     * @throws IOException error encountered accessing the file 
     */ 
    private static char[] readUtf8FileFully(String fileName, int sizeLimit) throws
            FileNotFoundException, IOException { 
        Reader reader = null;