I think this might just be a misunderstanding on my part.

I am writing a Maven H2 plugin.  One of the goals it has is the ability to *
spawn* a TCP server (i.e. not just start it up in-process, but launch a new 
VM on localhost that invokes org.h2.tools.Server's main method and supplies 
it with arguments like -tcp, -tcpPort, etc.).

So I have code that uses ProcessBuilder and org.h2.tools.Server to spawn a 
new TCP server.  Works great; survives even after the spawning VM exits.  I 
can connect to it from various database clients.

Now, I also have code that invokes Server#shutdownTcpServer().

But attempts to shut down a spawned H2 server using 
Server#shutdownTcpServer() don't work.  Well, they do issue a STOP_SERVER 
command properly, but the process does not exit.  If the spawned server has 
-trace turned on, you can see all the "close" statements.  But after it's 
done closing everything, the process just hangs around.  I don't know why.

Remember, I'm not holding any references to the Process.  I can, for 
example, spawn the process in one JVM (it launches another JVM to start up 
the TCP server), and then from yet another JVM issue the 
Server#shutdownTcpServer() call.  The process remains alive, even after 
Server#shutdownTcpServer() has returned.

I feel like I must be doing something wrong here, perhaps in my usage of 
ProcessBuilder.  Before I spend the time to attempt to come up with a test 
case, has anyone else seen funny behavior from Server#shutdownTcpServer()?  
Are there obvious problems with my approach?

Best,
Laird

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/h2-database/-/0MVLRudgg_cJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.

Reply via email to