001/* 002 * $Id: PreemptStatus.java 5999 2020-03-17 15:44:50Z kredel $ 003 */ 004 005package edu.jas.kern; 006 007 008/** 009 * PreemptStatus, defines global status for preemptive interruption handling. 010 * @author Heinz Kredel 011 */ 012 013public class PreemptStatus { 014 015 016 /** 017 * Global status flag. 018 */ 019 private static boolean allowPreempt = true; 020 021 022 /** 023 * No public constructor. 024 */ 025 protected PreemptStatus() { 026 } 027 028 029 /** 030 * isAllowed. 031 * @return true, preemtive interruption is allowed, else false. 032 */ 033 public static boolean isAllowed() { 034 return allowPreempt; 035 } 036 037 038 /** 039 * setAllow, set preemtive interruption to allowed status. 040 */ 041 public static void setAllow() { 042 allowPreempt = true; 043 } 044 045 046 /** 047 * setNotAllow, set preemtive interruption to not allowed status. 048 */ 049 public static void setNotAllow() { 050 allowPreempt = false; 051 } 052 053}