When performing graceful shutdown, server goes into ADMIN State, using CommonJ Timer integration and Dweblogic.Use81StyleExecuteQueues (Doc ID 1340352.1)

Last updated on NOVEMBER 05, 2016

Applies to:

Oracle Weblogic Server - Version: 10.0 and later   [Release: and later ]
Information in this document applies to any platform.

Symptoms

After deploying application, that integrates commonJ Timers on it, if a graceful shutdown is attempted for the server, this stays in ADMIN mode, not completing the process.

On Startup Script, the usage of -Dweblogic.Use81StyleExecuteQueues is activated.

The structure for the test case is the following:

`-- CommonJTimerSample 
     |-- META-INF 
     |    `-- MANIFEST.MF 
     |-- start.html 
     `-- WEB-INF 
          |-- classes 
          |    |-- RetryTimerListener.class 
          |    |-- RetryTimerListener.java 
          |    |-- ServletListener.class 
          |    `-- ServletListener.java 
          |-- lib 
          |-- weblogic.xml 
          `-- web.xml



Relevant content:

RetryTimerListener.java

import java.util.Calendar;

import javax.naming.InitialContext;

import weblogic.t3.srvr.ServerRuntime;

import commonj.timers.StopTimerListener;
import commonj.timers.Timer;
import commonj.timers.TimerManager;

public class RetryTimerListener implements StopTimerListener {

/**
* Construct a transfailCore.
*/
public RetryTimerListener() {

}

/**
*
* @param timer
*/
public void timerExpired(Timer timer) {
try {

System.out.println("Timer expired..:"+Calendar.getInstance().getTime());
System.out.println("Server state is :"+ServerRuntime.theOne().getState());
if(!"RUNNING".equals(ServerRuntime.theOne().getState())){
System.out.println("Server state is not running!!!");
InitialContext ic;
try {
ic = new InitialContext();
TimerManager tm = (TimerManager) ic.lookup("java:comp/env/tm/MyTimerManager");
System.out.println("tm.isStopped(): "+tm.isStopped());
System.out.println("isStopping(): "+tm.isStopping());
System.out.println("isSuspended(): "+tm.isSuspended());
System.out.println("isSuspending(): "+tm.isSuspending());
System.out.println("toString: "+tm.toString());
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
} finally {

}
}

public void timerStop(Timer arg0) {
System.out.println("Inside stop timer listener.....");
System.out.println("TimerStop: Server state is :"+ServerRuntime.theOne().getState());

}
}

ServerListener.java 

import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;


import commonj.timers.TimerManager;

/**
* Application Lifecycle Listener implementation class MyListener
*
*/
public class ServletListener implements ServletContextListener {

/**
* Default constructor.
*/
public ServletListener() {
// TODO Auto-generated constructor stub
}

public void contextDestroyed(ServletContextEvent arg0) {
System.out.println("contextDestroyed....");

}

public void contextInitialized(ServletContextEvent arg0) {
System.out.println("Context Initiaized....");
try {
InitialContext ic = new InitialContext();
TimerManager tm = (TimerManager)ic.lookup("java:comp/env/tm/MyTimerManager");
tm.schedule(new RetryTimerListener(), 2 * 60 * 1000, 1 * 60 * 1000);
} catch (NamingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

}

}

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>CommonJTimerSample</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<listener>
<listener-class>ServletListener</listener-class>
</listener>
</web-app>

The output for this deployment is after issuing the Graceful shutdown is:

Server state is :RUNNING
DEBUG: Wed Dec 08 08:47:32 GMT 2010: Retrieving Security Events for User: SQUCMS/SVC_UCMS/Reason_None/SQUCMS/SM/UCMS
DEBUG: Wed Dec 08 08:47:32 GMT 2010: Retrieving Security Events for User Completed.
Timer expired..:Wed Dec 08 08:48:18 GMT 2010
Server state is :RUNNING
DEBUG: Wed Dec 08 08:48:32 GMT 2010: Retrieving Security Events for User: SQUCMS/SVC_UCMS/Reason_None/SQUCMS/SM/UCMS
DEBUG: Wed Dec 08 08:48:32 GMT 2010: Retrieving Security Events for User Completed.
Timer expired..:Wed Dec 08 08:49:18 GMT 2010
Server state is :RUNNING
DEBUG: Wed Dec 08 08:49:32 GMT 2010: Retrieving Security Events for User: SQUCMS/SVC_UCMS/Reason_None/SQUCMS/SM/UCMS
DEBUG: Wed Dec 08 08:49:32 GMT 2010: Retrieving Security Events for User Completed.
<Dec 8, 2010 8:49:54 AM GMT> <Alert> <WebLogicServer> <BEA-000396> <Server shutdown has been requested by system>
<Dec 8, 2010 8:49:54 AM GMT> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to SUSPENDING>
Timer expired..:Wed Dec 08 08:50:18 GMT 2010
Server state is :SUSPENDING
Server state is not running!!!
tm.isStopped(): false
isStopping(): false
isSuspended(): false
isSuspending(): false
toString: TimerManager 'TryTimer@TimerWeb@TimerWeb@tm/MyTimerManager' that uses WorkManager 'weblogic.timers.internal.TimerManagerFactoryImpl$WorkManagerExecutor@10ca738'
DEBUG: Wed Dec 08 08:50:32 GMT 2010: Retrieving Security Events for User: SQUCMS/SVC_UCMS/Reason_None/SQUCMS/SM/UCMS
DEBUG: Wed Dec 08 08:50:32 GMT 2010: Retrieving Security Events for User Completed.
Timer expired..:Wed Dec 08 08:51:18 GMT 2010
Server state is :SUSPENDING
Server state is not running!!!
tm.isStopped(): false
isStopping(): false
isSuspended(): false
isSuspending(): false
toString: TimerManager 'TryTimer@TimerWeb@TimerWeb@tm/MyTimerManager' that uses WorkManager 'weblogic.timers.internal.TimerManagerFactoryImpl$WorkManagerExecutor@10ca738'
DEBUG: Wed Dec 08 08:51:32 GMT 2010: Retrieving Security Events for User: SQUCMS/SVC_UCMS/Reason_None/SQUCMS/SM/UCMS
DEBUG: Wed Dec 08 08:51:32 GMT 2010: Retrieving Security Events for User Completed.
Killed

The server stays hung on SUSPENDING state, and doesn't return.

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms