Note that there are some explanatory texts on larger screens.

plurals
  1. POShutting down Netty Server
    primarykey
    data
    text
    <p>I have a little problem about shutting down Netty Server. The documentation says about shutting down the server is that;</p> <pre><code>public class TimeServer { static final ChannelGroup allChannels = new DefaultChannelGroup("time-server"); public static void main(String[] args) throws Exception { ... ChannelFactory factory = ...; ServerBootstrap bootstrap = ...; ... Channel channel = bootstrap.bind(...); allChannels.add(channel); waitForShutdownCommand(); ChannelGroupFuture future = allChannels.close(); future.awaitUninterruptibly(); factory.releaseExternalResources(); } </code></pre> <p>}</p> <p>then after searching around what "waitForShutDownCommand" is, I found that it is something like a ShutdownHook method. Well then I added a shutdownhook method to my server, </p> <pre><code>Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() { @Override public void run() { nettyServer.shutDown(); } }, "shutDownHook")); </code></pre> <p>But then, I realized that when I try to quit my server with ctrl-c it is not called always. Because When server shutdown I want to do some operation which is related to that server. (Like deleting all the data from Redis which is related to that server.)</p> <p>So.. I come up with an idea, but I did not implement yet, I just want to make sure that if it is a good approach or not. So, to shutdown a server I need a CLIENT (Admin Client) which sends SHUTDOWN command to that server.Actually, I did not want to create an ADMIN Client, because I don't want to care of another client application and security things etc...</p> <p>So what is your solutions? Any Ideas? Thanks...</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload