Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How glassfish domains are separated from each other?

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.

like image 656
Pavel_K Avatar asked Jun 21 '17 10:06

Pavel_K


People also ask

What is domain in GlassFish?

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.

How do I create a new domain in GlassFish server?

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.

Where is domain xml in GlassFish?

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 .

How do I stop GlassFish domain?

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.


1 Answers

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.

like image 99
Seelenvirtuose Avatar answered Sep 30 '22 16:09

Seelenvirtuose