I'm using Derby Replication in my product and trying to figure out what is the best approach for "stopping" the database before starting replication (before copying the database from Master to Slave).

I'm currently using "shutdown" approach... as described in the following Derby 10.8 documentation (it says to make sure the database is shutdown cleanly):
http://db.apache.org/derby/docs/10.8/adminguide/cadminreplicstartrun.html

If you look at the Derby replication write-up - it tells you to "freeze the DB" using command "call SYSCS_UTIL.SYSCS_FREEZE_DATABASE(), here is the write-up I'm referring to:
http://wiki.apache.org/db-derby/ReplicationWriteup

These two seem to be conflicting... and therefore the question: what is the best practice to "stopping the db" before the start of replication?

Also, when you think about it, when you shutdown the DB before copying the database and starting replication, what if there is a thread running in JVM that will reboot the database before you get a chance to copy the database, and when you finally start replication - then the databases will be again out of sync. This did not actually happen to me in practice, but I think theoretically it is possible. So does it mean freeze is better? And then do I need to unfreeze it?

Thanks!
Oskar Zinger