Controlling and Monitoring JEUS Servers
This chapter describes how to control and monitor JEUS servers. Only managed servers (MSs) are covered in this chapter with the assumption that the Master Server (MASTER), which manages the servers, is under normal operation.
For more information about server execution scripts and console tools, see JEUS Server Startup and Shutdown and Local Commands in JEUS Reference Guide. |
1. Controlling and Monitoring Servers
This section describes how to control and monitor servers.
1.1. Life Cycle of Managed Servers
The following shows the possible state transitions of an MS. MASTER or the user can change the state of an MS.
Division | Description |
---|---|
SHUTDOWN |
Server has not been started or has shut down normally. |
STARTING |
Server has received a start command and is in the process of starting up. During startup, the server creates the engines (WEB, EJB, and JMS), starts JEUS services (security and SCF), and deploys registered applications, etc. |
STANDBY |
After the required JEUS services have started on the server, if applications that are registered on the server fail to be deployed or distributed, the server goes into the STANDBY state. |
RUNNING |
A server has started and the registered applications are running normally. If a server that was in the STANDBY state is started by the force option, not all registered applications may be running. |
SUSPENDING |
A running server is in the process of executing the suspend command. Except for listeners used for application services, all running services on all applications are stopped in this state. |
SUSPENDED |
All applications that are deployed on the server are stopped. No services are running except for the listeners used for application services. |
RESUMING |
A server in the SUSPENDED state is in the process of executing the resume command. All stopped applications are restarted and ready to provide services. After the execution of the resume command, the server goes into the RUNNING state. |
SHUTTING_DOWN |
A server is in the process of shutting down. The deployed applications are undeployed, and all JEUS services that were started at startup are terminated. When a server is shutting down, a timeout setting is used to allow the currently running services to be processed. This is called a 'graceful shutdown'. |
|
1.2. Starting a Managed Server
By default, MASTER and MS are started by a launcher. Server startup commands via a script or MASTER is used to start the launcher, and the launcher prepares for the server startup and starts the server. For more information about the launcher, refer to Launcher. For information about how to start a server using the console tool, refer to Starting a Managed Server (MS) in JEUS Domain Guide. Note that this section only provides examples of starting servers by using scripts.
Example
A launcher terminates after starting JVM of a server and confirming that the server has started.
In the following example, the launcher log is used to confirm that the server has been started successfully.
JEUS_HOME/bin$ ./startManagedServer -domain jeus_domain -server server1 -u jeus -p jeus -masterurl localhost:9736 *************************************************************** - JEUS Home : /home/jeus - Java Vendor : Sun - Added Java Option : *************************************************************** ... [2024.09.25 22:35:04][2] [launcher-1] [SERVER-0201] Successfully connected to the JEUS Master Server(localhost:9736). [2024.09.25 22:35:04][2] [launcher-1] [Launcher-0058] All local configurations are up-to-date. ... [2024.09.25 22:35:07][0] [server1-1] [SERVER-0242] Successfully started the server. [2024.09.25 22:35:07][2] [server1-1] [SERVER-0248] The JEUS server is RUNNING. [2024.09.25 22:35:07][2] [launcher-22] [Launcher-0034] The server[server1] initialization completed successfully[pid : 81719]. [2024.09.25 22:35:07][0] [launcher-1] [Launcher-0040] Successfully started the server[server1]. The server state is now RUNNING. JEUS_HOME/bin$
Problems may occur when an MS deploys its application files during startup. In such cases, an MS remains in the STANDBY state. The application files that are deployed during startup have been executed successfully one or more times. Hence, if there is a problem, then it is likely that the files have been modified incorrectly.
If the XML tag of the application in the .workspace directory, an internal JEUS directory, is modified incorrectly, the server may remain in the STANDBY state as shown in the following example. For more information about deployment of the domain structure, refer to Application Management in the Domain Environment in JEUS Applications & Deployment Guide.
Since applications are generally managed by MASTER, the .workspace directory of the MS must not be accessed directly. |
JEUS_HOME/bin$ ./startManagedServer -domain jeus_domain -server server1 -u jeus -p jeus -masterurl localhost:9736 ... [2024.09.25 23:20:07][2] [launcher-1] [SERVER-0201] Successfully connected to the JEUS Master Server(localhost:9736). ... [2024.09.25 23:20:09][2] [server1-1] [Deploy-0095] Distributing the application[healthcheck]. java.lang.RuntimeException: [was class com.ctc.wstx.exc.WstxParsingException] Unexpected close tag </urlpattern>; expected </url-pattern>. [2024.09.25 23:20:09][0] [server1-1] [SERVER-0522] An exception occurred while processing [SERVER_HOME/.workspace/deployed/healthcheck/1657613257716/healthcheck_war___/WEB-INF/web.xml]. <<__Exception__>> ... <<__!Exception__>> [2024.09.25 23:20:09][2] [server1-1] [SERVER-0248] The JEUS server is STANDBY. [2024.09.25 23:20:09][0] [server1-1] [SERVER-0250] Starting server (server1) failed. Staying in STANDBY. [2024.09.25 23:20:09][2] [server1-1] [SERVER-0401] The elapsed time to start: 1775ms. [2024.09.25 23:20:09][2] [launcher-22] [Launcher-0034] The server[server1] initialization completed successfully[pid : 86118]. [2024.09.25 23:20:09][0] [launcher-1] [Launcher-0042] Completed starting the server but the server state is still STANDBY. JEUS_HOME/bin$
The server-info command can be used to verify that an MS is in the STANDBY state as shown in the following example.
[MASTER]jeus_domain.adminServer>server-info Information about Domain (jeus_domain) ================================================================================ +--------+---------+-----+-----+-----+-----------+--------+-----------+--------+ | Server | Status |Node | PID | Clu | Latest | Need | Listen |Running | | | |Name | |ster |Start Time | to | Ports |Engines | | | | | | | / |Restart | | | | | | | | | Shutdown | | | | | | | | | | Time | | | | +--------+---------+-----+-----+-----+-----------+--------+-----------+--------+ | adminS | RUNNING | nod | 814 | N/A |2024-09-25 | false | base-0.0. | jms, | |erver |(00:52:3 |e1 |82 | |(Thu) PM | |0.0:9736 |web, ejb| |(*) |7) | | | |10:34:03 | | http-serv | | | | | | | |KST | |er-0.0.0.0 | | | | | | | | | |:8088 | | +--------+---------+-----+-----+-----+-----------+--------+-----------+--------+ | server1| STANDBY | N/A | 861 | N/A |2024-09-25 | false | base-0.0. | jms, | | |(00:06:3 | |18 | |(Thu) PM | |0.0:9836 |web, ejb| | |2) | | | |11:20:08 | | http-serv | | | | | | | |KST | |er-0.0.0.0 | | | | | | | | | |:8188 | | +--------+---------+-----+-----+-----+-----------+--------+-----------+--------+ ================================================================================
1.3. Shutting Down a Managed Server
An MS can be shut down using the jeusadmin command. It can be shut down using a local-shutdown command in jeusadmin that is connected to the MS. It can also be shut down using a MASTER command in the console tool.
For more information about how to shut down an MS, refer to Shutting Down a Managed Server (MS) in JEUS Domain Guide.
Since MASTER is set to manage an MS, it is recommended to use MASTER to stop an MS. |
Example
There is a function called graceful shutdown that guarantees the completion of the requests currently being processed before an MS shuts down. New requests are not processed. The server stops accepting requests after it receives the stop command, but the requests that are currently being processed are allowed to finish.
The following is an example of setting the wait time in the timeout option of the MS stop command.
[MASTER]jeus_domain.adminServer>stop-server server1 -to 60000 Stop server message to server [server1] was successfully sent.
It is also possible to set a wait time when the console tool is used to directly connect to an MS.
jeus_domain.server1>local-shutdown -to 60000 Executing this command affects the service. Do you want to continue? (y/n)y The server [server1] has been shut down successfully. offline>
After the server shuts down successfully, the following message is displayed.
... [2024.09.25 23:39:28][2] [server1-25] [SERVER-0248] The JEUS server is SHUTDOWN. [2024.09.25 23:39:28][2] [server1-24] [NET-0214] Closing http-server. [2024.09.25 23:39:28][0] [server1-25] [SERVER-0265] The JEUS server has exited. [2024.09.25 23:39:28][0] [server1-1] [SERVER-0099] The server[server1] has been shut down. [2024.09.25 23:39:28][0] [server1-20] [SERVER-0565] The JVM process is shutting down. [2024.09.25 23:39:28][0] [server1-20] [SERVER-0566] The JVM process will be terminated. [2024.09.25 23:39:28][2] [server1-22] [NET-0214] Closing base.
1.4. Suspending a Managed Server
Shutting down a Managed Server is to terminate the Managed Server JVM after shutting down all running application services. A separate function is provided to suspend all applications by applying graceful timeout so that the requests currently being processed can be completed. To suspend applications, use the suspend-server command in the console tool.
The following is an example of suspending a server using the console tool.
[MASTER]jeus_domain.adminServer>suspend-server -servers server1 Executing this command affects the service. Do you want to continue? (y/n)y Successfully suspended server(s).
The server-info command can be used to verify that the server has been suspended.
[MASTER]jeus_domain.adminServer>server-info ================================================================================ +-------+---------+-----+-----+-----+--------------+-------+-----------+-------+ | Server| Status |Node | PID | Clu | Latest Start | Need | Listen | Runni | | | |Name | |ster | Time / | to | Ports | ng | | | | | | |Shutdown Time |Restart| |Engines| +-------+---------+-----+-----+-----+--------------+-------+-----------+-------+ | admin | RUNNING | nod | 880 | N/A | 2024-09-25 | false | base-0.0. | jms, | |Server |(00:22:1 |e1 |29 | |(Thu) PM | |0.0:9736 |web, | | (*) |4) | | | |11:38:36 KST | | http-serv |ejb | | | | | | | | |er-0.0.0.0 | | | | | | | | | |:8088 | | +-------+---------+-----+-----+-----+--------------+-------+-----------+-------+ | serve | SUSPEND | N/A | 891 | N/A | 2024-09-25 | false | base-0.0. | jms, | |r1 |ED(00:08 | |46 | |(Thu) PM | |0.0:9836 |web, | | |:01) | | | |11:52:49 KST | | http-serv |ejb | | | | | | | | |er-0.0.0.0 | | | | | | | | | |:8188 | | +-------+---------+-----+-----+-----+--------------+-------+-----------+-------+ ================================================================================
The following message is displayed when a server has been successfully suspended.
[2024.09.25 00:15:16][2] [server1-25] [SERVER-0248] The JEUS server is SUSPENDING. [2024.09.25 00:15:16][2] [server1-25] [JMS-7375] The persistence store manager for the JMS server 'server1' has been shut down. [2024.09.25 00:15:16][2] [server1-25] [SERVER-0248] The JEUS server is SUSPENDED.
Even when a server is not managed by MASTER, an MS can be suspended by directly accessing the server through the console tool. |
1.5. Resuming a Managed Server
It is possible to resume the applications of the suspended server.
Even when an MS is not managed by MASTER, the suspended MS can be resumed by directly accessing the server through the console tool.
The following is an example of resuming a server using the console tool.
[MASTER]jeus_domain.adminServer>resume-server -servers server1 Successfully resumed the servers.
The server-info command can be used to check that the server is in the RUNNING state.
[MASTER]jeus_domain.adminServer>server-info ================================================================================ +--------+--------+-----+-----+-----+------------+--------+-----------+--------+ | Server | Status |Node | PID | Clu | Latest | Need | Listen |Running | | | |Name | |ster | Start Time | to | Ports |Engines | | | | | | | / Shutdown |Restart | | | | | | | | | Time | | | | +--------+--------+-----+-----+-----+------------+--------+-----------+--------+ | adminS | RUNNIN | nod | 121 | N/A | 2024-09-25 | false | base-0.0. | jms, | |erver |G(00:04 |e1 |360 | | (Fri) AM | |0.0:9736 |web, ejb| |(*) |:21) | | | |11:30:11 KST| | http-serv | | | | | | | | | |er-0.0.0.0 | | | | | | | | | |:8088 | | +--------+--------+-----+-----+-----+------------+--------+-----------+--------+ | server1| RUNNIN | N/A | 122 | N/A | 2024-09-25 | false | base-0.0. | jms, | | |G(00:01 | |223 | | (Fri) AM | |0.0:9836 |web, ejb| | |:07) | | | |11:33:26 KST| | http-serv | | | | | | | | | |er-0.0.0.0 | | | | | | | | | |:8188 | | +--------+--------+-----+-----+-----+------------+--------+-----------+--------+ ================================================================================
The following message is displayed when the application services of the server have been resumed successfully.
[2024.09.25 11:34:29][2] [server1-26] [SERVER-0248] The JEUS server is RESUMING. [2024.09.25 11:34:29][2] [server1-26] [SERVER-0248] The JEUS server is RUNNING.
2. Configuring Server Engine
Internally, JEUS has engines that run applications. There are separate engines for web application services, EJB application services, and JMS services. Option to use each engine can be configured during initialization, but the server must be restarted in order to apply the configuration.
2.1. Engine Option
The option to use each engine can be configured on the JEUS server. When an engine is configured for use, it is initialized either when the server boots or when the first application that needs the engine is deployed. If an engine is not configured for use, it does not get initialized even after the server starts, and application deployment to the engine will fail.
Previously deployed applications will fail to be deployed if the server is restarted after setting the engine for non-use. The server state also changes to STANDBY instead of RUNNING. The administrator must manually change the engine and the application states. |
The following example shows how to configure each engine on the server by using the console tool.
[MASTER]jeus_domain.adminServer>disable-engines adminServer -all [adminServer] Change Engine to Disabled: Web EJB JMS Applying configuration ... ================================================================================ +------------------------------------------------------------------------------+ | Result | +------------------------------------------------------------------------------+ | Successfully changed only the JEUS Domain Configuration. | | Restart the server to apply the changes. | +------------------------------------------------------------------------------+ ================================================================================ ... [MASTER]jeus_domain.adminServer>enable-engines adminServer -all [adminServer] Change Engine to Enabled: Web EJB JMS Applying configuration ... ================================================================================ +------------------------------------------------------------------------------+ | Result | +------------------------------------------------------------------------------+ | Successfully changed only the JEUS Domain Configuration. | | Restart the server to apply the changes. | +------------------------------------------------------------------------------+ ================================================================================ ... [MASTER]jeus_domain.adminServer>disable-engines adminServer -web -ejb [adminServer] Change Engine to Disabled: Web EJB Applying configuration ... ================================================================================ +------------------------------------------------------------------------------+ | Result | +------------------------------------------------------------------------------+ | Successfully changed only the JEUS Domain Configuration. | | Restart the server to apply the changes. | +------------------------------------------------------------------------------+ ================================================================================ ... [MASTER]jeus_domain.adminServer>enable-engines adminServer -web -ejb [adminServer] Change Engine to Enabled: Web EJB Applying configuration ... ================================================================================ +------------------------------------------------------------------------------+ | Result | +------------------------------------------------------------------------------+ | Successfully changed only the JEUS Domain Configuration. | | Restart the server to apply the changes. | +------------------------------------------------------------------------------+ ================================================================================
For detailed information about the server engine configuration commands of the JEUS console tool, see disable-engines and enable-engines in JEUS Reference Guide. |
2.2. Engine Initialization Time
Each engine of JEUS can be configured for use. When an engine is configured for use, it is initialized either when the server boots or when the first application that needs the engine is deployed. If an engine is not configured for use, it does not get initialized even after the server starts, and application deployment to the engine will fail.
Option to initialize an engine can be configured by using the console tool.
The following example shows how to initialize each engine on the server by using the console tool.
[MASTER]jeus_domain.adminServer>disable-engine-init-on-boot adminServer,server1 EngineInitOnBoot was successfully disabled. Applying configuration ... ================================================================================ +------------------------------------------------------------------------------+ | Result | +------------------------------------------------------------------------------+ | Successfully changed only the JEUS Domain Configuration. | | Restart the server to apply the changes. | +------------------------------------------------------------------------------+ ================================================================================ [MASTER]jeus_domain.adminServer>enable-engine-init-on-boot adminServer EngineInitOnBoot was successfully enabled. Applying configuration ... ================================================================================ +------------------------------------------------------------------------------+ | Result | +------------------------------------------------------------------------------+ | Successfully changed only the JEUS Domain Configuration. | | Restart the server to apply the changes. | +------------------------------------------------------------------------------+ ================================================================================
For detailed information about the server engine configuration commands of the JEUS console tool, see disable-engine-init-on-boot and enable-engine-init-on-boot in JEUS Reference Guide. |
3. Controlling and Monitoring Threads
JEUS provides functions to monitor servlet and EJB remote threads, and system pools. JEUS also provides a function that checks thread stacks as well as sends interrupt signals to specific threads.
3.1. Thread Monitoring
JEUS provides a function to monitor threads including servlet request threads, EJB remote request threads, and system thread pools.
By using the functionality to monitor servlet threads or EJB remote request threads, it is possible to check the thread ID, thread name, thread status, and processing time. Using the thread pool monitoring function makes it possible to know the core size, max size, and keep alive time of the system thread pool as well as the information about the threads in the system thread pool.
Thread Information Check
The following shows how to check thread information using the console tool.
[MASTER]jeus_domain.adminServer>thread-info -server adminServer Thread information for the server [adminServer] There are no EJB RMI threads for the server [adminServer]. There is no batch thread pool in server [adminServer]. ================================================================================ The web engine threads for 'adminServer_web-WebContainerThreadPool'. +-----+----------------------------------------------+---------+---------+-----+ | tid | name | state | elapsed | uri | +-----+----------------------------------------------+---------+---------+-----+ | 50 | adminServer_web-WebContainerThreadPool-1 | waiting | 20755 | | | 59 | adminServer_web-WebContainerThreadPool-10 | waiting | 20745 | | | 51 | adminServer_web-WebContainerThreadPool-2 | waiting | 20403 | | | 52 | adminServer_web-WebContainerThreadPool-3 | waiting | 20395 | | | 53 | adminServer_web-WebContainerThreadPool-4 | waiting | 9505 | | | 54 | adminServer_web-WebContainerThreadPool-5 | waiting | 15399 | | | 55 | adminServer_web-WebContainerThreadPool-6 | waiting | 20386 | | | 56 | adminServer_web-WebContainerThreadPool-7 | waiting | 4507 | | | 57 | adminServer_web-WebContainerThreadPool-8 | waiting | 20765 | | | 58 | adminServer_web-WebContainerThreadPool-9 | waiting | 23346 | | +-----+----------------------------------------------+---------+---------+-----+ elapsed: Elapsed time (ms) ================================================================================ ================================================================================ Thread statistics for the 'adminServer_web-WebContainerThreadPool'. +-----------------------------------+-------+--------+------+---------+--------+ | | total | active | idle | blocked | reconn | +-----------------------------------+-------+--------+------+---------+--------+ | The number of threads. | 10 | 0 | 10 | 0 | 0 | +-----------------------------------+-------+--------+------+---------+--------+ total = active + idle, reconn: reconnecting ================================================================================ ========================================================== The threads for the 'jeus.ejb.asyncpool' thread pool. +-----+------+--------------+----------------------------+ | tid | name | thread state | active thread | +-----+------+--------------+----------------------------+ (No data available) ========================================================== ================================================================================ The statistics for the 'jeus.ejb.asyncpool' thread pool. +------------+-----------+-----------+-----------+----------+------------------+ | pool name | minimum | maximum | current | work | remaining work | | | pool size | pool size | pool size |queue size| queue size | +------------+-----------+-----------+-----------+----------+------------------+ | jeus.ejb.a | 0 | 30 | 0 | 4096 | 4096 | |syncpool | | | | | | +------------+-----------+-----------+-----------+----------+------------------+ ================================================================================ ================================================================================ The threads for the 'EJBTimerService' thread pool. +-----+------------------------------+-------------------+---------------------+ | tid | name | thread state | active thread | +-----+------------------------------+-------------------+---------------------+ | 48 | EJBTimerService-1 | WAITING | false | | 49 | EJBTimerService-2 | WAITING | false | +-----+------------------------------+-------------------+---------------------+ ================================================================================ ================================================================================ The statistics for the 'EJBTimerService' thread pool. +----------+-----------+-----------+-----------+----------+--------------------+ | pool name| minimum | maximum | current | work | remaining work | | | pool size | pool size | pool size |queue size| queue size | +----------+-----------+-----------+-----------+----------+--------------------+ | EJBTimer | 2 | 30 | 2 | 4096 | 4096 | |Service | | | | | | +----------+-----------+-----------+-----------+----------+--------------------+ ================================================================================ ================================================================================ The threads for the 'threadpool.System' thread pool. +-----+------------------------------+--------------------+--------------------+ | tid | name | thread state | active thread | +-----+------------------------------+--------------------+--------------------+ | 72 | threadpool.System-1 | TIMED_WAITING | false | | 73 | threadpool.System-2 | TIMED_WAITING | false | | 83 | threadpool.System-3 | TIMED_WAITING | false | +-----+------------------------------+--------------------+--------------------+ ================================================================================ ================================================================================ The statistics for the 'threadpool.System' thread pool. +-----------+-----------+-----------+-----------+----------+-------------------+ | pool name | minimum | maximum | current | work | remaining work | | | pool size | pool size | pool size |queue size| queue size | +-----------+-----------+-----------+-----------+----------+-------------------+ | threadpoo | 0 | 100 | 3 | 4096 | 4096 | |l.System | | | | | | +-----------+-----------+-----------+-----------+----------+-------------------+ ================================================================================ ========================================================== The threads for the 'LPQ-INTERNAL' thread pool. +-----+------+--------------+----------------------------+ | tid | name | thread state | active thread | +-----+------+--------------+----------------------------+ (No data available) ========================================================== ================================================================================ The statistics for the 'LPQ-INTERNAL' thread pool. +--------+------------+------------+------------+----------+-------------------+ | pool | minimum | maximum | current | work | remaining work | | name | pool size | pool size | pool size |queue size| queue size | +--------+------------+------------+------------+----------+-------------------+ | LPQ-IN | 0 | 50 | 0 | 4096 | 4096 | |TERNAL | | | | | | +--------+------------+------------+------------+----------+-------------------+ ================================================================================ ================================================================================ The threads for the 'JMS-INTERNAL' thread pool. +-----+----------------------------+--------------------+----------------------+ | tid | name | thread state | active thread | +-----+----------------------------+--------------------+----------------------+ | 38 | JMS-INTERNAL-3 | WAITING | false | | 41 | JMS-INTERNAL-6 | WAITING | false | | 42 | JMS-INTERNAL-7 | WAITING | false | | 43 | JMS-INTERNAL-8 | WAITING | false | | 45 | JMS-INTERNAL-10 | WAITING | false | | 40 | JMS-INTERNAL-5 | WAITING | false | | 44 | JMS-INTERNAL-9 | WAITING | false | | 37 | JMS-INTERNAL-2 | WAITING | false | | 39 | JMS-INTERNAL-4 | WAITING | false | | 36 | JMS-INTERNAL-1 | WAITING | false | +-----+----------------------------+--------------------+----------------------+ ================================================================================ ================================================================================ The statistics for the 'JMS-INTERNAL' thread pool. +--------+------------+------------+------------+----------+-------------------+ | pool | minimum | maximum | current | work | remaining work | | name | pool size | pool size | pool size |queue size| queue size | +--------+------------+------------+------------+----------+-------------------+ | JMS-IN | 10 | 20 | 10 | 4096 | 4096 | |TERNAL | | | | | | +--------+------------+------------+------------+----------+-------------------+ ================================================================================
Checking the Stack Trace of a Thread
The stack trace of a desired thread can also be checked in the console tool. The thread stack trace is usually checked when a blocked thread is detected by using the ti command of the console tool.
[MASTER]jeus_domain.adminServer>print-stack-trace -server server1 45 servlet thread [tid=45] Stack trace of server1_web-WebContainerThreadPool-1 tid=45 java.lang.Thread.State: WAITING at sun.misc.Unsafe.park(Native Method) at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039) at jeus.util.pool.auto.LinkedBlockingQueue.take(LinkedBlockingQueue.java:450) at jeus.util.pool.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1418) at jeus.util.pool.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:1340) at jeus.servlet.thread.WebThreadPoolExecutor$WebRequestWorker.run(WebThreadPoolExecutor.java:273) at java.lang.Thread.run(Thread.java:748)
For detailed information about the ti and strace commands of the JEUS console tool, see Local Commands in JEUS Reference Guide. |
3.2. Thread Control
JEUS provides a function that sends an InterruptSignal to a specific thread to trigger an exception to stop the thread execution.
This function is provided experimentally. If a thread is interrupted, the thread will not be stopped right away. Instead, it checks the interrupt status and throws an exception to stop any further processing. The exception must be handled in the user application, and the user assumes responsibility for issues that occur from unhandled exceptions. |
Thread Interrupt
Interrupting a thread means sending a signal to induce an exception to stop further processing of the thread. It is usually used when a request is blocked or delayed longer than expected.
When a thread is interrupted, the thread is neither forcibly stopped nor stopped immediately.
JEUS supports a function that can send the InterruptSignal to a servlet thread, EJB remote request thread, and running thread in the system thread pool. A thread can be interrupted if it is processing a JNDI remote connection, EJB, JDBC, or IO operation.
-
Servlet Thread
An exception is thrown when a servlet thread is interrupted in the following cases. The exception must be handled in the user application.
-
When connecting to a remote JNDI
-
When processing a JNDI remote operation
-
When calling an EJB
-
When getting a JDBC connection or calling a method of the connected object
An interrupt signal can be issued directly through the console tool, or through a function that checks the processing time of a servlet thread. To configure this function, refer to Configuring Automatic Thread Pool Management (Thread Status Notification) in JEUS Web Engine Guide.
-
-
EJB Remote Request Thread
An EJB issues a jakarta.ejb.EJBException by checking the interrupt status in the following cases.
-
When an EJBHome method like 'create' is called in the EJB 2.x way (in EJB 3.0, create is processed internally in the EJB container when the user looks up an EJB).
-
When calling an EJB business method
The exception must be handled in the user application. If the interrupt signal is issued after the EJB business method is called, an exception may not occur. However, the thread may be interrupted when the method calls another EJB or uses a JDBC or JNDI operation.
-
-
JDBC
For JDBC operations, if an interrupt signal is received while executing the following operations, a java.sql.SQLException will occur. The user application must handle the exception.
-
When getting a connection from the connection pool via DataSource#getConnection().
-
When using the java.sql.Connection from the connection pool.
-
When using the executeQuery operation after setting the use-sql-trace or stmt-caching-size option for the JDBC connection pool. (For more information about the options, refer to Connection Pool Configuration)
-
-
JNDI
A JNDI operation can sometimes be interrupted. If the interrupt signal is issued while executing the following JNDI operations, a javax.naming.NamingException will occur. The user application must handle the exception.
-
When connecting to a remote JNDI (when a javax.naming.InitialContext is created).
-
When a remote message is sent while executing a JNDI operation.
The operation can be interrupted during JNDI operations such as looking up, binding, rebinding, and renaming, but not when accessing a local registry or cache.
-
-
IO Operation
The IO operation can sometimes be interrupted depending on the situation.
-
java.nio.channels.SocketChannel
An operation can be interrupted while using the java.nio.channels.SocketChannel. Connecting via the java.nio.channels.SocketChannel is performed in three steps.
At the beginning step, check whether the interrupt status of the thread is set, and close the channel if it is set. During the actual connection step, if the Interrupt Status is set, the connect() method is not called. During the end step, a java.nio.channels.ClosedByInterruptedException occurs if the Interrupt Status is set (Interrupt Status gets cleared afterwards).
-
java.nio.channels.SocketChannel#read()/java.nio.channels.SocketChannel#write()
The java.nio.channels.SocketChannel#read() or java.nio.channels.SocketChannel#write() is performed in three steps.
At the beginning step, check whether the interrupt status of the thread is set, and close the channel if it is set. In the second step, if the interrupt status is set, read or write operation is not executed. During the end step, a java.nio.channels.ClosedByInterruptedException occurs if the Interrupt Status is set (Interrupt Status gets cleared afterwards).
After the java.nio.channels.ClosedByInterruptedException has been thrown, if a read or write is attempted by using the previously created channel, a java.nio.channels.ClosedChannelException is thrown.
-
Using java.net.Socket
When using the java.net.Socket, the Socket IO operation can be interrupted depending on the JVM compile options in HP-UX and Solaris.
A read or write operation that uses a socket stream can be interrupted and a java.net.SocketException is thrown. (Interrupt Status gets cleared afterwards). This does not immediately close the socket, but it stops any subsequent operations.
A thread that is executing a socket IO operation is not interrupted in IBM AIX and LINUX.
-
-
Object#wait() / Thread#sleep() / Thread#join()
When a thread that is executing Object#wait(), Thread#sleep(), or Thread#join(), the thread can be interrupted by throwing a java.lang.InterruptedException. (Interrupt Status gets cleared afterwards).
Refer to the Javadoc API of each class. |
Sending the Interrupt Signal
JEUS provides a command to send an interrupt signal to a thread by using the console tool.
The following is an example of sending a thread interrupt signal by using the console tool. For more information about the interrupt-thread command in the JEUS console tool, refer to interrupt-thread in JEUS Reference Guide.
[MASTER]jeus_domain.adminServer>interrupt-thread -server server1 45 Sent an interrupt hint signal to the thread [tid=45] on the server server1.
4. Controlling and Monitoring Memory
JEUS monitors the memory usage and controls the server when it exceeds the specified free memory.
4.1. Memory Monitoring
The memory-info command can be used to monitor memory. For more information about the memory-info command, see Server Management Commands in JEUS Reference Guide.
[MASTER]jeus_domain.adminServer>memory-info -servers adminServer Domain [jeus_domain] Memory Information Memory Information ================================================================================ +-------------+---------------------------+------------------------------------+ | Server | Total Amount of Memory | The Current Amount of Memory | +-------------+---------------------------+------------------------------------+ | adminServer | 721420288 | 315030816 | +-------------+---------------------------+------------------------------------+ ================================================================================
4.2. Memory Usage Control
Since this function is not commonly used in JEUS, memory related operations can only be controlled through the current system properties.
Property | Description |
---|---|
jeus.server.memorymonitor.enabled |
Configures whether to use MemoryMoniterService. If the configuration is not enabled, then the rest of the properties do not have any meaning. (Default value: false) |
jeus.server.memorymonitor.ratio |
Configures the memory overflow standard. If 0.8 is configured, then if 80% of memory is used (based on the max memory), then it shall be considered as overflow. (Default value: 0.8) |
jeus.server.memorymonitor.interval |
Configures the cycle which measures memory usage. (Default Value: 2000, unit: milliseconds) |
jeus.server.memorymonitor.duration |
Configures the time which determines memory overflow. For example, if jeus.server.memorymonitor.ratio is 0.8 and jeus.server.memorymonitor.duration is 1 minute, then in MemoryMonitorService, when over 80% of memory is continued for over 1 minute, then it is considered as memory overflow. (Default value: 60000, Unit: milliseconds) |
jeus.server.enable.restart.in.memory.shortage |
When determined as memory overflow, then determines whether the server will be automatically restarted. (Default value: true). |
|