Hello altogether!
I'm on my way to establish a TreeCache (-AOP) instance for a clustered JBoss
environment. Last weeks I came closely in touch with (standalone) TreeCache technology.
Now, I'm trying to get this thing into JBoss.
1.) I deployed a XML file cache-service.xml with following content:
| <?xml version="1.0" encoding="UTF-8"?>
| <server>
| <classpath codebase="./lib" archives="jboss-cache.jar, jgroups.jar"/>
| <mbean code="org.jboss.cache.TreeCache"
| name="jboss.cache:service=TreeCache">
| <depends>jboss:service=Naming</depends>
| <depends>jboss:service=TransactionManager</depends>
| <attribute
name="TransactionManagerLookupClass">org.jboss.cache.JBossTransactionManagerLookup</attribute>
| <attribute name="IsolationLevel">REPEATABLE_READ</attribute>
| <attribute name="CacheMode">REPL_SYNC</attribute>
| <attribute name="ClusterName">TreeCache-Cluster</attribute>
| <!-- JGroups protocol stack properties. Can also be a URL,
| e.g. file:/home/bela/default.xml
| <attribute name="ClusterProperties"></attribute>
| -->
| <attribute name="ClusterConfig">
| <config>
| <UDP mcast_addr="228.1.2.3" mcast_port="45566"
| ip_ttl="64" ip_mcast="true"
| mcast_send_buf_size="150000" mcast_recv_buf_size="80000"
| ucast_send_buf_size="150000" ucast_recv_buf_size="80000"
| loopback="false"/>
| <PING timeout="2000" num_initial_members="3"
| up_thread="false" down_thread="false"/>
| <MERGE2 min_interval="10000" max_interval="20000"/>
| <FD shun="true" up_thread="true" down_thread="true"/>
| <VERIFY_SUSPECT timeout="1500"
| up_thread="false" down_thread="false"/>
| <pbcast.NAKACK gc_lag="50" retransmit_timeout="600,1200,2400,4800"
| max_xmit_size="8192" up_thread="false" down_thread="false"/>
| <UNICAST timeout="600,1200,2400" window_size="100"
min_threshold="10"
| down_thread="false"/>
| <pbcast.STABLE desired_avg_gossip="20000"
| up_thread="false" down_thread="false"/>
| <FRAG frag_size="8192"
| down_thread="false" up_thread="false"/>
| <pbcast.GMS join_timeout="5000" join_retry_timeout="2000"
| shun="true" print_local_addr="true"/>
| <pbcast.STATE_TRANSFER up_thread="false" down_thread="false"/>
| </config>
| </attribute>
| <attribute name="MaxCapacity">20000</attribute>
| <attribute name="InitialStateRetrievalTimeout">5000</attribute>
| <attribute name="SyncReplTimeout">10000</attribute>
| <attribute name="LockAcquisitionTimeout">15000</attribute>
| <attribute name="LockLeaseTimeout">60000</attribute>
| <attribute name="EvictionPolicyClass"></attribute>
| <attribute name="EvictionPolicyConfig">
| <config>
| <attribute name="wakeUpIntervalSeconds">5</attribute>
| <region name="/_default_">
| <attribute name="maxNodes">5000</attribute>
| <attribute name="timeToIdleSeconds">1000</attribute>
| </region>
| <region name="/org/jboss/data">
| <attribute name="maxNodes">5000</attribute>
| <attribute name="timeToIdleSeconds">1000</attribute>
| </region>
| <region name="/org/jboss/test/data">
| <attribute name="maxNodes">5</attribute>
| <attribute name="timeToIdleSeconds">4</attribute>
| </region>
| </config>
| </attribute>
| </mbean>
| </server>
|
Then I created a stateless Session Bean with following signature:
| /**
| * @ejb.bean name="TreeCacheFacade"
| * jndi-name="TreeCacheFacadeBean"
| * type="Stateless"
| **/
|
| public abstract class TreeCacheFacadeBean implements SessionBean
| {
|
| private TreeCacheAop cache = null;
|
| /**
| * @ejb.interface-method
| * view-type="remote"
| **/
| public void readAllContainingData()
| {
| ...
| }
|
|
| /**
| * @ejb.interface-method
| * view-type="remote"
| **/
| public void startCache()
| {
| try
| {
| //Starting TreeCache...
| System.out.println("\tInitializing TreeCache instance...");
| cache = new TreeCacheAop();
| System.out.println(
| "\tConfiguring TreeCache instance with cache-service.xml file...");
| PropertyConfigurator c = new PropertyConfigurator();
| c.configure(
| cache,
| "..\\server\\default\\deploy\\cache-service.xml");
| System.out.println("\tStarting TreeCache service...");
| cache.start();
| }
| catch (Exception e)
| {
| System.out.println(
|
"\n****************************************************************"
| + "\nStarting failed"
| +
"\n****************************************************************");
| e.printStackTrace();
| }
| }
| /**
| * @ejb.interface-method
| * view-type="remote"
| **/
| public void stopCache()
| {
| try
| {
| //Starting TreeCache...
| System.out.println("\tInitializing TreeCache instance...");
| cache = new TreeCacheAop();
| System.out.println(
| "\tConfiguring TreeCache instance with cache-service.xml file...");
| PropertyConfigurator c = new PropertyConfigurator();
| c.configure(
| cache,
| "..\\server\\default\\deploy\\cache-service.xml");
| System.out.println("\tStarting TreeCache service...");
| cache.stop();
| }
| catch (Exception e)
| {
| System.out.println(
|
"\n****************************************************************"
| + "\nStopping failed"
| +
"\n****************************************************************");
| e.printStackTrace();
| }
| }
| }
|
Say: Each time I work with the TreeCacheAOP instance, I instanciate it vie new
Operator. Then I configure it with the suitable cache-service.xml (Now they must be
the same, or not?) file.
But when I tried to get some data out of it. There came a NullPointerException.
What is the proper way of getting the TreeCacheAOP instance while in the JBoss
Environment.
Thanx
Vic
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3839075#3839075
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3839075
-------------------------------------------------------
This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference
Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer
Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA
REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND
_______________________________________________
JBoss-Development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development