Hi Kendall,
Is using CHECK when the database is already open comparable in CPU cycles to testing a boolean variable that says open true or false? I understand that the time it takes for most commands to execute would make code logic usually insignificant.
Check will definitely be slower than a pure boolean check. On the other hand, I wouldn’t expect you to notice any delay, as the execution time should only be a few milliseconds, or even less.
What will be the processing time you require for this operation? There may be some chance to improve the execution time of this command (it just hasn’t been a bottleneck so far).
Cheers, Christian
On 6/18/16, 4:54 AM, "Christian Grün" christian.gruen@gmail.com wrote:
Hi Kendall,
I would indeed recommend you to use the CHECK command before doing any other operations. This command does exactly what you seem to be looking for (checking if the databases is opened; if not, open it).
Does this help? Christian
On Wed, Jun 15, 2016 at 7:03 PM, Kendall Shaw kendall.shaw@workday.com wrote:
Using ClientSession from java, I do this to check if the database is open:
try {
replace(somewhere, new ArrayInput(bytes));
} catch (IOException e) { String msg = e.getMessage();
if (msg == null || !msg.contains(“No database opened”))
throw e;
execute(new Check(databaseName));
replace(somewhere, new ArrayInput(bytes));
}
Is there a better way to detect if the database is open than testing the exception message text?
Kendall