[Logo] Terracotta Discussion Forums
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
[Expert]
clustering web application and java application POJOs  XML
Forum Index -> Terracotta Platform
Author Message
twister

master

Joined: 12/19/2009 08:51:09
Messages: 59
Offline

Hello guys;

I'm trying to clusterise a same POJO between two type of application.
The first is a web application, the second is a simple .java.

I have two tc-config.xml, where are specified my shared objects and instrumented methods. But how can i clusterise these two types of POJOs assuming that the same shared fields haven't the same specifications between the stanzas
==> EXEMPLE:
the shared object : buffer
in the first tc-config.xml : Code:
<root>
 <field-name>webapplication1.Page1.buffer</field-name>
 </root>

in the second one : Code:
<root>
 <field-name>HelloClusteredWorld.buffer</field-name>
 </root>


Thanks for help
zeeiyer

consul

Joined: 05/24/2006 14:28:28
Messages: 493
Offline

Code:
 <field-name>webapplication1.Page1.buffer</field-name>
  <field-name>HelloClusteredWorld.buffer</field-name>
 


If these 2 are the same type and you want them to be shared - then you can always specify a root-name. For an example, see: http://www.terracotta.org/confluence/display/docs/Configuration+Guide+and+Reference#ConfigurationGuideandReference-roots

Also in your case, since the classloaders involved are different - a "simple .java" and a Web Application, you'd need to use App-Groups as well - search for /tc:tc-config/application/dso/app-groups at http://www.terracotta.org/confluence/display/docs/Configuration+Guide+and+Reference

Sreeni Iyer, Terracotta.
Not a member yet - Click here to join the Terracotta Community
twister

master

Joined: 12/19/2009 08:51:09
Messages: 59
Offline

Thanks for replying;

1-) I've configured the debugging named loader, and note that there is two class loaders ==> System.standard and System.ext,
so both of them or one of them(which one) ?

2-) I've red the doc you sent by the link. If i have a same field in the two applications i described, which i want to share, i have to put in the tc-config.xml two <root> stanzas with one common <root-name> stanzas; is that right ?

Anyway here is my new tc-config.xml, and i want to share the buffer field and loopCounter field between HelloClusteredWorld.java and WebApplication1:

Code:
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
 All content copyright (c) 2003-2007 Terracotta, Inc.,
 except as may otherwise be noted in a separate copyright notice.
 All rights reserved.
 -->
 <!--
 This is a Terracotta configuration file that has been pre-configured
 for use with DSO. All classes are included for instrumentation,
 and all instrumented methods are write locked.
 For more information, please see the product documentation.
 -->
 <tc:tc-config xmlns:tc="http://www.terracotta.org/config"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://www.terracotta.org/schema/terracotta-4.xsd">
 
 <servers>
 <!-- Tell DSO where the Terracotta server can be found. -->
 	<server host="localhost">
 		<data>%(user.home)/terracottaWeb/server-data</data>
 		<logs>%(user.home)/terracottaWeb/server-logs</logs>
 			<dso>
 				<persistence>
 					<mode>permanent-store</mode>
 				</persistence>
 			</dso>
 	</server>
 </servers>
 
 <!-- Tell DSO where to put the generated client logs -->
 
 <clients>
 	<logs>%(user.home)/terracottaWeb/client-logs</logs>
 </clients>
 
 <application>
 
 	<dso>
 		<roots>
 			<root>
 				<field-name>HelloClusteredWorld.buffer</field-name>
 				<root-name>MonBuffer</root-name>
 			</root>
 			<root>
 				<field-name>webapplication1.Page1.buffer</field-name>
 				<root-name>MonBuffer</root-name>
 			</root>
 			<root>
 				<field-name>HelloClusteredWorld.loopCounter</field-name>
 				<root-name>MonLoopCounter</root-name>
 			</root>
 			<root>
 				<field-name>webapplication1.Page1.loopCounter</field-name>
 				<root-name>MonLoopCounter</root-name>
 			</root>
 		</roots>
 			
 <!-- Start by including all classes for instrumentation.
 It's more efficient to instrument only those classes that
 hold shared roots or are part of a shared root's graph.
 -->
 
 		<instrumented-classes>
 			<include>
 				<class-expression>webapplication1.Page1</class-expression>
 			</include>
 			<include>
 				<class-expression>HelloClusteredWorld</class-expression>
 			</include>
 		</instrumented-classes>
 		
 <!-- Apply write level autolocks for all instrumented methods.
 It's more efficient to create finer-grain locks as dictated
 by your application needs.
 -->
 		<locks>
 			<autolock>
 				<lock-level>write</lock-level>
 				<method-expression>String webapplication1.Page1.button1_action(..)</method-expression>
 			</autolock>
 			<autolock>
 				<lock-level>write</lock-level>
 				<method-expression>void HelloClusteredWorld.main(..)</method-expression>
 			</autolock>
 		</locks>
 		
 		<app-groups>
 			<app-group name="webAndPojo">
 				<web-application>WebApplication1</web-application>
   <named-classloader>System.standard</named-classloader> -->
 			</app-group>
 		</app-groups>
 
 	</dso>
 </application>
 </tc:tc-config>
 


Thanks a lot for help
 
Forum Index -> Terracotta Platform
Go to:   
Powered by JForum 2.1.7 © JForum Team