You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geronimo.apache.org by Delos <da...@gmail.com> on 2010/08/18 03:37:52 UTC

[DISCUSSION] How to detect status of server instance?

2010/8/17 Delos <da...@gmail.com>

>
> For some reasons, we often need to know if there is a running server
> instance. By establishing a connection to a specific port such as 1099,  we
> may get the status of server. However, the method doesn't work if default
> port number is changed, especially in multi-instances scenario. In
> multi-instances scenario, we hope to know if any instance is running.
>
> Below is my thoughts about the solution. Any comments or suggestions,
> please feel free to tell me. It will be appreciated if any better solution
> could be provided.
>
> Possible solution:
>
> We may create flag file for each instance and lock the file with
> FileChannel.lock()  when a server instance is starting up. It will be
> unlocked and deleted when the server is stopped. Unlocking will be
> automatically done when JVM exits; deleting the file can be done in shutdown
> hook in FrameworkLauncher.launch().
>
> In this way, if any flag file has been locked, we may deduce that there is
> at least one running server instance; if no locked files found, we may think
> all server instances are stopped. We can put all the flag files in a same
> directory for us to track.
>
> --
> Best Regards,
>
> Delos
>



-- 
Best Regards,

Delos

Re: [DISCUSSION] How to detect status of server instance?

Posted by Donald Woods <dw...@apache.org>.
Will file locking work across all OS and filesystem combinations
reliably?  Wondering about Windows/exFAT and Unix/NFS shares....

Another way is to use *.pid files to hold the server process id or
something like *.rmi or *.jmx files to denote the ports that servers are
listening on.

Maybe building something into the Felix shell to track instances would
be another solution?


-Donald


On 8/17/10 9:37 PM, Delos wrote:
> 
> 2010/8/17 Delos <daition@gmail.com <ma...@gmail.com>>
> 
> 
>     For some reasons, we often need to know if there is a running server
>     instance. By establishing a connection to a specific port such as
>     1099,  we may get the status of server. However, the method doesn't
>     work if default port number is changed, especially in
>     multi-instances scenario. In multi-instances scenario, we hope to
>     know if any instance is running.
> 
>     Below is my thoughts about the solution. Any comments or
>     suggestions, please feel free to tell me. It will be appreciated if
>     any better solution could be provided.
> 
>     Possible solution:
> 
>     We may create flag file for each instance and lock the file with
>     FileChannel.lock()  when a server instance is starting up. It will
>     be unlocked and deleted when the server is stopped. Unlocking will
>     be automatically done when JVM exits; deleting the file can be done
>     in shutdown hook in FrameworkLauncher.launch().
> 
>     In this way, if any flag file has been locked, we may deduce that
>     there is at least one running server instance; if no locked files
>     found, we may think all server instances are stopped. We can put all
>     the flag files in a same directory for us to track.
> 
>     -- 
>     Best Regards,
> 
>     Delos
> 
> 
> 
> 
> -- 
> Best Regards,
> 
> Delos