001 /* 002 * CDDL HEADER START 003 * 004 * The contents of this file are subject to the terms of the 005 * Common Development and Distribution License, Version 1.0 only 006 * (the "License"). You may not use this file except in compliance 007 * with the License. 008 * 009 * You can obtain a copy of the license at 010 * trunk/opends/resource/legal-notices/OpenDS.LICENSE 011 * or https://OpenDS.dev.java.net/OpenDS.LICENSE. 012 * See the License for the specific language governing permissions 013 * and limitations under the License. 014 * 015 * When distributing Covered Code, include this CDDL HEADER in each 016 * file and include the License file at 017 * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, 018 * add the following below this CDDL HEADER, with the fields enclosed 019 * by brackets "[]" replaced with your own identifying information: 020 * Portions Copyright [yyyy] [name of copyright owner] 021 * 022 * CDDL HEADER END 023 * 024 * 025 * Copyright 2006-2008 Sun Microsystems, Inc. 026 */ 027 package org.opends.server.tasks; 028 import org.opends.messages.Message; 029 030 031 032 import org.opends.server.core.DirectoryServer; 033 034 035 036 037 /** 038 * This class defines a thread that will be spawned to invoke a Directory Server 039 * in-core restart. That is, the server will perform an internal shutdown, and 040 * will then re-bootstrap and start itself up again without ever exiting the 041 * JVM. 042 * <BR><BR> 043 * Note that there are two significant differences between this thread and the 044 * shutdown task thread (other than the obvious difference that this one does a 045 * restart while the other does a shutdown): this class extends 046 * <CODE>java.lang.Thread</CODE> instead of 047 * <CODE>org.opends.server.core.DirectoryThread</CODE>, and this thread is not a 048 * daemon thread. These changes are needed to guarantee that the JVM does not 049 * exit before we get a chance to restart it if all non-daemon threads go away. 050 */ 051 public class RestartTaskThread 052 extends Thread 053 { 054 /** 055 * The fully-qualified name of this class. 056 */ 057 private static final String CLASS_NAME = 058 "org.opends.server.tasks.RestartTaskThread"; 059 060 061 062 // The shutdown message that will be used. 063 private Message shutdownMessage; 064 065 066 067 /** 068 * Creates a new instance of this shutdown task thread with the provided 069 * message. 070 * 071 * @param shutdownMessage The shutdown message that will be used. 072 */ 073 public RestartTaskThread(Message shutdownMessage) 074 { 075 super("Restart Task Thread"); 076 077 078 this.shutdownMessage = shutdownMessage; 079 } 080 081 082 083 /** 084 * Invokes the Directory Server shutdown process. 085 */ 086 public void run() 087 { 088 DirectoryServer.restart(CLASS_NAME, shutdownMessage); 089 } 090 } 091