Java AtomicReference isTerminated(AtomicReference field)

Here you can find the source of isTerminated(AtomicReference field)

Description

Checks if the given field holds the terminated Throwable instance.

License

Apache License

Parameter

Parameter Description
field the target field

Return

true if the given field holds the terminated Throwable instance

Declaration

public static boolean isTerminated(AtomicReference<Throwable> field) 

Method Source Code

//package com.java2s;
/**/*from w  w  w.ja  v a2s. c  o m*/
 * Copyright 2016 Netflix, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */

import java.util.concurrent.atomic.AtomicReference;

public class Main {
    /** The single instance of a Throwable indicating a terminal state. */
    private static final Throwable TERMINATED = new Throwable("Terminated");

    /**
     * Checks if the given field holds the terminated Throwable instance.
     * 
     * @param field the target field
     * @return true if the given field holds the terminated Throwable instance
     */
    public static boolean isTerminated(AtomicReference<Throwable> field) {
        return isTerminated(field.get());
    }

    /**
     * Returns true if the value is the terminated Throwable instance.
     * 
     * @param error the error to check
     * @return true if the value is the terminated Throwable instance
     */
    public static boolean isTerminated(Throwable error) {
        return error == TERMINATED;
    }
}

Related

  1. cancelAll(Future[] futures, boolean mayInterruptIfRunning)
  2. expandSplineRoots(int n)
  3. getDefaultBaseUri()
  4. getIdentityName(final String identityType, final String displayName, final String attribute, final String attribute2, final int uniqueUserID, final AtomicReference outResolvableName, final AtomicReference outDisplayableName)
  5. getSplineCoefficients(int n, float x)
  6. length(AtomicReferenceArray buf)
  7. mergeProperties(Properties... properties)
  8. pack(int count, Object[] array, AtomicReference edit, int idx)
  9. runInThread(final Runnable runnable)