Hi Group,

I'd like to discuss the issue that I noticed today. I can't see any mention 
of it in the internet, this group's archive or the bug list. The version of 
H2 package that I'm using: 1.3.175

I've noticed I can't successfully stop PG server which was previously 
stopped already. This means, that:

   1. Starting PG server works OK - the service is available to JDBC 
   clients,
   2. Stopping the server works fine - resources are released (e.g. socket),
   3. Starting the same instance of PG Server is successful.
   4. Running stop() on the server object again executes cleanly but the 
   resources are never released.

Further investigation also showed:

   - This isssue does not affect Tcp Server. It can be start()-ed and 
   stop()-ped however many times,
   - I haven't checked whether the WebServer is affected, too.
   - The reason for this is that how the flag [
   *org.h2.server..pg.PgServer.stop*] is handled:
      - it's not initialized (=false),
      - is set to true in stop() method,
      - release of socket resource depends on its value. If the value of 
      stop member is already true, stop() skipps it's main block of 
functionality.
   - TcpServer is very similar to PgServer. It also maintains similar flag, 
   also called [stop]. With regard to handling of it, TcpServer, it has one 
   additional operation on this flag. It is to set it to false whenever 
   start() is called.
   - Creating a local copy of PgServer and setting this flag to false every 
   time the server is started, allows the start-stop cycle to be repeated with 
   the resources being handled accordingly.

I'd appreciate your input. Is this a bug or is server object not intended 
to be re-used?

Thanks,

Konrad

P.S. To reproduce:

Server pg = Server.createPgServer("-pgPort", "9042");
pg.stop(); //this sets the flag to true
//you can create ServerSocket on 9042 here
pg.start(); //this should set the flag to false
pg.stop(); //because the flag is already true, this has no effect
//ServerSocket creation will fail here

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to