Re: Check server state?
Thanks all, ServerProxy.isFullyStarted() works great. Ricky Jack Cai wrote: > > Rick, I suggest you to follow Jeff's advice to take a look at the code of > [1] & [2], which perfectly demonstrates how to check whether Geronimo is > running. Note you can specify the RMI port as you like. > > -Jack > > [1] > https://svn.apache.org/repos/asf/geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/ConnectCommand.groovy > [2] > https://svn.apache.org/repos/asf/geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/WaitForServerCommand.groovy > > -- View this message in context: http://www.nabble.com/Check-server-state--tp23267578s134p23435475.html Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.
Re: Check server state?
Rick, I suggest you to follow Jeff's advice to take a look at the code of [1] & [2], which perfectly demonstrates how to check whether Geronimo is running. Note you can specify the RMI port as you like. -Jack [1] https://svn.apache.org/repos/asf/geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/ConnectCommand.groovy [2] https://svn.apache.org/repos/asf/geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/WaitForServerCommand.groovy 2009/5/5 Ivan > A common way : > Create a Socket to connect the the port, if it could be connected, it means > that a program is listerening on that port. > A sample code like : > public static boolean isConnected(String hostName, int port) { > Socket socket = null; > try { > socket = new Socket(hostName, port); > return socket.isConnected(); > } catch (Exception e) { > return false; > } finally { > if (socket != null) > try { > socket.close(); > } catch (Exception e) { > } > } > } > > But first, you need to make sure to bind the correct IP, or you could not > connect it to the remote machine, > Second, you do not know which program is llsterening on the specified port, > maybe it is not Geronimo server :-( > Wish it helps you, or anyone could give more better solution. > Ivan > > 2009/5/5 RickI > > >> I start new geronimo instance by changing port-offset in configuration >> file. >> All of that port are open but I dont want to access it through web-console >> but through java code. >> I want to know if geronimo instance in port 1199 (for example) is running >> or >> not. >> >> -R >> >> >> Ivan Xu wrote: >> > >> > Which port is available for you ? I mean you could connect from the >> remote >> > machine >> > >> > 2009/5/1 RickI >> > >> >> >> >> Yes i think it's one way to check the main/default geronimo server. >> >> But I try to check the state of geronimo instances on other port. >> >> That way might not work. >> >> >> >> Thanks, >> >> >> >> Ricky >> >> >> >> >> >> Ivan Xu wrote: >> >> > >> >> > No sure how does the wait-for-server command implement it, but I >> think >> >> try >> >> > to connect the server via JMX is also a way to check whether the >> kernel >> >> is >> >> > running.Ivan >> >> > >> > >> > -- >> > Ivan >> > >> > >> >> -- >> View this message in context: >> http://www.nabble.com/Check-server-state--tp23267578s134p23378540.html >> Sent from the Apache Geronimo - Users mailing list archive at Nabble.com. >> >> > > > -- > Ivan >
Re: Check server state?
A common way : Create a Socket to connect the the port, if it could be connected, it means that a program is listerening on that port. A sample code like : public static boolean isConnected(String hostName, int port) { Socket socket = null; try { socket = new Socket(hostName, port); return socket.isConnected(); } catch (Exception e) { return false; } finally { if (socket != null) try { socket.close(); } catch (Exception e) { } } } But first, you need to make sure to bind the correct IP, or you could not connect it to the remote machine, Second, you do not know which program is llsterening on the specified port, maybe it is not Geronimo server :-( Wish it helps you, or anyone could give more better solution. Ivan 2009/5/5 RickI > > I start new geronimo instance by changing port-offset in configuration > file. > All of that port are open but I dont want to access it through web-console > but through java code. > I want to know if geronimo instance in port 1199 (for example) is running > or > not. > > -R > > > Ivan Xu wrote: > > > > Which port is available for you ? I mean you could connect from the > remote > > machine > > > > 2009/5/1 RickI > > > >> > >> Yes i think it's one way to check the main/default geronimo server. > >> But I try to check the state of geronimo instances on other port. > >> That way might not work. > >> > >> Thanks, > >> > >> Ricky > >> > >> > >> Ivan Xu wrote: > >> > > >> > No sure how does the wait-for-server command implement it, but I think > >> try > >> > to connect the server via JMX is also a way to check whether the > kernel > >> is > >> > running.Ivan > >> > > > > > -- > > Ivan > > > > > > -- > View this message in context: > http://www.nabble.com/Check-server-state--tp23267578s134p23378540.html > Sent from the Apache Geronimo - Users mailing list archive at Nabble.com. > > -- Ivan
Re: Check server state?
I start new geronimo instance by changing port-offset in configuration file. All of that port are open but I dont want to access it through web-console but through java code. I want to know if geronimo instance in port 1199 (for example) is running or not. -R Ivan Xu wrote: > > Which port is available for you ? I mean you could connect from the remote > machine > > 2009/5/1 RickI > >> >> Yes i think it's one way to check the main/default geronimo server. >> But I try to check the state of geronimo instances on other port. >> That way might not work. >> >> Thanks, >> >> Ricky >> >> >> Ivan Xu wrote: >> > >> > No sure how does the wait-for-server command implement it, but I think >> try >> > to connect the server via JMX is also a way to check whether the kernel >> is >> > running.Ivan >> > > > -- > Ivan > > -- View this message in context: http://www.nabble.com/Check-server-state--tp23267578s134p23378540.html Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.
Re: Check server state?
Which port is available for you ? I mean you could connect from the remote machine 2009/5/1 RickI > > Yes i think it's one way to check the main/default geronimo server. > But I try to check the state of geronimo instances on other port. > That way might not work. > > Thanks, > > Ricky > > > Ivan Xu wrote: > > > > No sure how does the wait-for-server command implement it, but I think > try > > to connect the server via JMX is also a way to check whether the kernel > is > > running.Ivan > > > > 2009/4/30 RickI > > > >> > >> Thanks RunHua, > >> Do you know any gbean that can be use to get server state similar with > >> wait-for-server command? > >> > >> Thanks, > >> > >> Ricky > >> > >> > >> RunHua Chi wrote: > >> > > >> > Hi Rickl: > >> > > >> > I thinks you might need to look into the source code of the following > >> > Gshell > >> > command: > >> > > >> > geronimo/wait-for-server > >> > > >> > The *geronimo/wait-for-server* command is used to verify if the server > >> has > >> > started in the given time (in seconds). The default timeout is 60 > >> seconds > >> > > >> > Jeff C > >> > > >> > On Tue, Apr 28, 2009 at 7:49 AM, RickI wrote: > >> > > >> >> > >> >> Hi All, > >> >> How do I check geronimo instance state from java code after being > >> >> started. > >> >> I starting separate instance and would like to know whether its > >> >> successfully > >> >> started before doing deploying a module. > >> >> Starting and deploying a module are triggered from java code. > >> >> > >> >> Thanks, > >> >> > >> >> Ricky > >> >> -- > >> >> View this message in context: > >> >> > http://www.nabble.com/Check-server-state--tp23267578s134p23267578.html > >> >> Sent from the Apache Geronimo - Users mailing list archive at > >> Nabble.com. > >> >> > >> >> > >> > > >> > > >> > >> -- > >> View this message in context: > >> http://www.nabble.com/Check-server-state--tp23267578s134p23302382.html > >> Sent from the Apache Geronimo - Users mailing list archive at > Nabble.com. > >> > >> > > > > > > -- > > Ivan > > > > > > -- > View this message in context: > http://www.nabble.com/Check-server-state--tp23267578s134p23322598.html > Sent from the Apache Geronimo - Users mailing list archive at Nabble.com. > > -- Ivan
Re: Check server state?
Yes i think it's one way to check the main/default geronimo server. But I try to check the state of geronimo instances on other port. That way might not work. Thanks, Ricky Ivan Xu wrote: > > No sure how does the wait-for-server command implement it, but I think try > to connect the server via JMX is also a way to check whether the kernel is > running.Ivan > > 2009/4/30 RickI > >> >> Thanks RunHua, >> Do you know any gbean that can be use to get server state similar with >> wait-for-server command? >> >> Thanks, >> >> Ricky >> >> >> RunHua Chi wrote: >> > >> > Hi Rickl: >> > >> > I thinks you might need to look into the source code of the following >> > Gshell >> > command: >> > >> > geronimo/wait-for-server >> > >> > The *geronimo/wait-for-server* command is used to verify if the server >> has >> > started in the given time (in seconds). The default timeout is 60 >> seconds >> > >> > Jeff C >> > >> > On Tue, Apr 28, 2009 at 7:49 AM, RickI wrote: >> > >> >> >> >> Hi All, >> >> How do I check geronimo instance state from java code after being >> >> started. >> >> I starting separate instance and would like to know whether its >> >> successfully >> >> started before doing deploying a module. >> >> Starting and deploying a module are triggered from java code. >> >> >> >> Thanks, >> >> >> >> Ricky >> >> -- >> >> View this message in context: >> >> http://www.nabble.com/Check-server-state--tp23267578s134p23267578.html >> >> Sent from the Apache Geronimo - Users mailing list archive at >> Nabble.com. >> >> >> >> >> > >> > >> >> -- >> View this message in context: >> http://www.nabble.com/Check-server-state--tp23267578s134p23302382.html >> Sent from the Apache Geronimo - Users mailing list archive at Nabble.com. >> >> > > > -- > Ivan > > -- View this message in context: http://www.nabble.com/Check-server-state--tp23267578s134p23322598.html Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.
Re: Check server state?
No sure how does the wait-for-server command implement it, but I think try to connect the server via JMX is also a way to check whether the kernel is running.Ivan 2009/4/30 RickI > > Thanks RunHua, > Do you know any gbean that can be use to get server state similar with > wait-for-server command? > > Thanks, > > Ricky > > > RunHua Chi wrote: > > > > Hi Rickl: > > > > I thinks you might need to look into the source code of the following > > Gshell > > command: > > > > geronimo/wait-for-server > > > > The *geronimo/wait-for-server* command is used to verify if the server > has > > started in the given time (in seconds). The default timeout is 60 > seconds > > > > Jeff C > > > > On Tue, Apr 28, 2009 at 7:49 AM, RickI wrote: > > > >> > >> Hi All, > >> How do I check geronimo instance state from java code after being > >> started. > >> I starting separate instance and would like to know whether its > >> successfully > >> started before doing deploying a module. > >> Starting and deploying a module are triggered from java code. > >> > >> Thanks, > >> > >> Ricky > >> -- > >> View this message in context: > >> http://www.nabble.com/Check-server-state--tp23267578s134p23267578.html > >> Sent from the Apache Geronimo - Users mailing list archive at > Nabble.com. > >> > >> > > > > > > -- > View this message in context: > http://www.nabble.com/Check-server-state--tp23267578s134p23302382.html > Sent from the Apache Geronimo - Users mailing list archive at Nabble.com. > > -- Ivan
Re: Check server state?
Thanks RunHua, Do you know any gbean that can be use to get server state similar with wait-for-server command? Thanks, Ricky RunHua Chi wrote: > > Hi Rickl: > > I thinks you might need to look into the source code of the following > Gshell > command: > > geronimo/wait-for-server > > The *geronimo/wait-for-server* command is used to verify if the server has > started in the given time (in seconds). The default timeout is 60 seconds > > Jeff C > > On Tue, Apr 28, 2009 at 7:49 AM, RickI wrote: > >> >> Hi All, >> How do I check geronimo instance state from java code after being >> started. >> I starting separate instance and would like to know whether its >> successfully >> started before doing deploying a module. >> Starting and deploying a module are triggered from java code. >> >> Thanks, >> >> Ricky >> -- >> View this message in context: >> http://www.nabble.com/Check-server-state--tp23267578s134p23267578.html >> Sent from the Apache Geronimo - Users mailing list archive at Nabble.com. >> >> > > -- View this message in context: http://www.nabble.com/Check-server-state--tp23267578s134p23302382.html Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.
Re: Check server state?
Hi Rickl: I thinks you might need to look into the source code of the following Gshell command: geronimo/wait-for-server The *geronimo/wait-for-server* command is used to verify if the server has started in the given time (in seconds). The default timeout is 60 seconds Jeff C On Tue, Apr 28, 2009 at 7:49 AM, RickI wrote: > > Hi All, > How do I check geronimo instance state from java code after being started. > I starting separate instance and would like to know whether its > successfully > started before doing deploying a module. > Starting and deploying a module are triggered from java code. > > Thanks, > > Ricky > -- > View this message in context: > http://www.nabble.com/Check-server-state--tp23267578s134p23267578.html > Sent from the Apache Geronimo - Users mailing list archive at Nabble.com. > >