Graceful and Forced Shutdown Feature

Mike McGrady mmcgrady at topiatechnology.com
Tue Sep 29 10:57:17 EDT 2009


You will find more than adequate shutdown in Netty.  If anything,  
Netty is wonderfully architected for use.

Sent from my iPhone

On Sep 29, 2009, at 1:25 AM, Trustin Lee (이희승)  
<trustin at gmail.com> wrote:

> On Fri, Sep 25, 2009 at 10:43 AM, sohguanh <sohguanh at yahoo.com.sg>  
> wrote:
>>
>> I understand Netty is an NIO framework but it would be nice to  
>> enhance it
>> with pre-built classes for doing server graceful and forced shutdown.
>>
>> Graceful shutdown
>> I discover the tutorial and common technique is run a forever loop,
>> Thread.sleep(x) then check some condition to indicate a shutdown is  
>> to be
>> executed. This technique means some latency as the main thread will  
>> only
>> wake up after x seconds to check.
>>
>> In JDK 1.5 I uses java.util.concurrent.CountDownLatch and the main  
>> thread
>> execute await() method. This will block until the CountDownLatch  
>> count
>> reached zero. Then in the server handler thread once the shutdown  
>> command is
>> received, it will execute countDown() to decrement the count. This  
>> approach
>> greatly improve the latency the main thread receive shutdown  
>> command. Seems
>> await() method will wake up and not wait x seconds using the  
>> Thread.sleep(x)
>> technique.
>>
>> I hope Netty new release provide some shutdown classes using various
>> techniques for graceful shutdown.
>
> I'm not sure you read the user guide, but you will find out how to
> shut down a server or a client as quickly as possible there.
>
>> Forced shutdown
>> How do Netty server detect JVM dies so it can terminate gracefully? I
>> discover java.lang.Runtime.addShutdownHook method and also the
>> com.sun.misc.Signals but seem not working for me in a predictable  
>> manner.
>>
>> I hope Netty new release provide some shutdown classes using various
>> techniques for forced shutdown.
>
> Considering that Netty can be used in various environments such as
> application server, adding a shutdown hook or a similar stuff should
> be taken care by user.
>
> — Trustin Lee, http://gleamynode.net/
>
> _______________________________________________
> netty-users mailing list
> netty-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/netty-users



More information about the netty-users mailing list