What s Next


Providing JVMs per Host

At this point, we must address the issue of security and crash protection. In our previous examples, each of the requests to the Resin server for the domains result in a thread being started and executed with the same Java Virtual Machine (JVM). It is possible to configure Resin to keep all hosts within their own VM and thus provide the ultimate in protection.

Basically, you start two or more Resin servers that execute in their own JVMs. You need to create configuration files for both of our example domains. First, the configuration for www.company.com:

 <resin>   <server>     <cluster>       <srun host="localhost" port="8800"/>     </cluster>     <host >       <root-directory>...       <resin:include href="common.conf"/> 

Note three things in particular in this configuration file. First, the port being used for srun is 8800. Second, we've defined a <host> element with a specific application directory. Third, we use <path> to pull in common information for the file.

Now the configuration file for www.ourcompany.com:

 <resin>   <server>   <cluster>       <srun host="localhost" port="8801"/>     </cluster>   <host id='www.ourcompany.com'>     <root-directory>g:\hosts\ourcompany_com</root-directory>     <path href='common.conf'/>   </host>   </server> </resin> 

The srun ports and the application directory are the only differences between these two configuration files. Now you need to start Resin using the configuration files. On Windows, you accomplish this by executing the following two commands:

 httpd.exe —conf ourcompany.conf httpd.exe —conf company.conf 

Two Resin servers are started, and each listens on a different srun port. This example assumes you're using an external Web server. If you're using Apache, you have to pull the separate configuration files into the correct <VirtualHost> element, as shown here:

 <VirtualHost 134.154.45.65>   ServerName www.company.com   CauchoConfigFile c:/resin/company.conf </VirtualHost> <VirtualHost 134.154.45.67>   ServerName www.ourcompany.com   CauchoConfigFile c:/resin/ourcompany.conf </VirtualHost> 




Mastering Resin
Mastering Resin
ISBN: 0471431036
EAN: 2147483647
Year: 2002
Pages: 180

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net