GlassFish allows creating N domains. Every domain has its own Java classes (libraries etc) and system settings.
For example, we have two domains - domain1 and domain2.
Via GF web console (http://localhost:4848) one system property was set for domain1 - com.temp.foo=test1
. Besides via GF web console (http://localhost:7575) one system property was set for domain2 - com.temp.foo=test2
.
Now, in domain1
System.out.println(System.getProperty("org.temp.foo"))
//returns `test1`
And in domain2
System.out.println(System.getProperty("org.temp.foo"))
//returns `test2`
As I understand GF and all its domains are running in one instance of JVM. And I don't understand how it is possible in one instance of JVM separate system properties. Could anyone explain?
Note: I understand that it can be a very long explanation that's why I am asking only about main principle and solutions/libraries names in an order I could read about them on the internet.
A domain is an administrative boundary that contains a group of GlassFish Server instances that are administered together. Each instance can belong to only one domain. A domain provides a preconfigured runtime for user applications.
To Create a Domain. After installing GlassFish Server and creating the default domain ( domain1 ), you can create additional domains by using the local create-domain subcommand. This subcommand creates the configuration of a domain.
The domain. xml file contains most of the Oracle GlassFish Server configuration. The domain. xml file is located in the domain configuration directory, which is typically domain-dir /config .
From the Start menu, select the command for your distribution of GlassFish Server: If you are using the Full Platform, select Programs -> Oracle GlassFish Server -> Stop Admin Server. If you are using the Web Profile, select Programs -> Oracle GlassFish Server Web Profile -> Stop Admin Server.
It seems that the understanding "GF and all its domains are running in one instance of JVM" is wrong.
As per GlassFish current version's documentation (chapter 3):
A domain contains a group of GlassFish Server instances that are administered together. [...] A GlassFish Server instance is a single Virtual Machine for the Java platform (Java Virtual Machine or JVM machine) on a single node in which GlassFish Server is running.
That means, every single instance of any domain is running in its own JVM! As a consequence, they all could have their own different system properties.
To be fair: There are means for administering virtual servers in GlassFish, that seem to share a JVM, but I think you are not speaking about them.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With