Here you can find the source of isTerminated(AtomicReference
Parameter | Description |
---|---|
field | the target field |
public static boolean isTerminated(AtomicReference<Throwable> field)
//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; } }