Noel,
I spent some time looking through the H2 code and I could not find a simple
way to identify the embedded server to the user via function calls.
I could not see a way to associate an user connection or session with the
hosting server as local or remote in mixed mode.
It may have been obvious but I did not see it.
At any rate, I ended up just adding this to the end of the
Database.startServer(String key) method...
System.getProperties().setProperty("H2_IS_EMBEDDED_TCP_SERVER", "TRUE");
and the opposite to the Database.stopServer() method...
System.getProperties().setProperty("H2_IS_EMBEDDED_TCP_SERVER",
"FALSE");
Based on the fact that I am looking to identify the JVM that is hosting the
embedded server this worked great.
It may not be slick enough for you to add to production code, but it worked
good for me.
On Fri, Oct 31, 2014 at 2:38 AM, Noel Grandin <[email protected]> wrote:
> Hmmm.
>
> No, not easily.
> If you were to come up with a patch that added such a system function, I
> would think it useful enough to add it.
> (grep the source code for ARRAY_GET, system functions are reasonably easy
> to add)
>
> On 2014-10-31 05:18 AM, Kenton Garner wrote:
>
>> I run H2 in a mixed mode ( AUTO_SERVER = TRUE ).
>>
>> I have a test system that starts multiple JVM's/applications and
>> synchronizes their start/stop and query activities to
>> force worst case conditions.
>>
>> Is there a method, query or test I can perform programmatically to tell
>> if a session is the embedded one?
>>
>> I would like to close the embedded connection to force one of the other
>> connected clients sessions to become the
>> embedded server.
>>
>> I am trying to track down / reproduce an issue we experience starting and
>> stopping multiple mix-mode connections
>> simultaneously.
>>
>>
>> Thanks in advance.
>>
>> --
>> 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] <mailto:h2-database+
>> [email protected]>.
>> To post to this group, send email to [email protected]
>> <mailto:[email protected]>.
>> Visit this group at http://groups.google.com/group/h2-database.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "H2 Database" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/h2-database/xDLBp7z14xI/unsubscribe.
> To unsubscribe from this group and all its topics, 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/d/optout.
>
--
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/d/optout.