001/* 002 * The contents of this file are subject to the terms of the Common Development and 003 * Distribution License (the License). You may not use this file except in compliance with the License. 004 * 005 * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the 006 * specific language governing permission and limitations under the License. 007 * 008 * When distributing Covered Software, include this CDDL Header Notice in each file and include 009 * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL 010 * Header, with the fields enclosed by brackets [] replaced by your own identifying 011 * information: "Portions copyright [year] [name of copyright owner]". 012 * 013 * Copyright 2015 ForgeRock AS. 014 */ 015 016package org.forgerock.util.thread.listener; 017 018import java.util.Arrays; 019import java.util.List; 020 021/** 022 * This class defines the shutdown priorities that are consumed by 023 * <code>com.sun.identity.common.ShutdownManager</code>. 024 */ 025public enum ShutdownPriority { 026 027 /** 028 * HIGHEST is the priority pre-defined in the system. Components which are 029 * registered with this priority will be shutdown first. 030 */ 031 HIGHEST(3), 032 033 /** 034 * DEFAULT is the priority pre-defined in the system. Components which are 035 * registered with this priority will be shutdown after the componets with 036 * HIGHEST priority. 037 */ 038 DEFAULT(2), 039 040 /** 041 * LOWEST is the priority pre-defined in the system. Components which are 042 * registered with this priority will be shutdown after the componets with 043 * HIGHEST or DEFAULT priority. 044 */ 045 LOWEST(1); 046 047 private int priority; 048 049 private ShutdownPriority(int priority) { 050 this.priority = priority; 051 } 052 053 /** 054 * Returns the priority. 055 * 056 * @return the priority. 057 */ 058 public int getIntValue() { 059 return priority; 060 } 061 062 /** 063 * Returns list of all the priorities (ordered from the highest to the 064 * lowest priority) defined in the system. 065 * 066 * @return list of all the priorities defined in the system. 067 */ 068 public static List<ShutdownPriority> getPriorities() { 069 return Arrays.asList(values()); 070 } 071}