Replicated field values not 'sticking' in clustered POJO Cac
mbenner Jun 23, 2006 3:07 PMI'm rather stumped by this problem. I've implemented POJO Cache (1.3.0 SP2) standalone within Resin app server.
I have two servers (ServerA and ServerB) within the same subnet that each start a TreeCacheAOP instance upon server startup and add a POJO to the TreeCache as such:
*****
// Configure and start the TreeCache cache = new TreeCacheAop(); PropertyConfigurator config = new PropertyConfigurator(); config.configure(cache, "./WEB-INF/replSync-service.xml"); cache.start(); MerchantDailyAccount mda = new MerchantDailyAccount(); mda.setDailySpend(128.00F); cache.putObject("/test/dailySpend", mda);
*******
Let's say that ServerA starts up first and adds a MerchantDailyAccount object to the cache (as shown above) with a 'dailySpend' value of 128.00.
When ServerB starts up, it also adds a MerchantDailyAccount object to the cache with the same 'dailySpend' value (128.00) and replicates the object across back the network to ServerA (I see it in the logs).
The problem is that when I inspect the cached MerchantDailyAccount objects on ServerA and ServerB, I see the following:
ServerA: MerchantDailyAccount.dailySpend = 1.00 (its initial value defined within the POJO)
ServerB: MerchantDailyAccount.dailySpend = 128.00 (the correct value)
Somehow, the 'dailySpend' value on ServerA has gotten overwritten and reverted to its initial state.
Here's where it gets even stranger. If I then retrieve the cached MerchantDailyAccount object from ServerA and increment
its value by 0.50, I will see the following:
ServerA: MerchantDailyAccount.dailySpend = 128.50 (the correct value)
ServerB: MerchantDailyAccount.dailySpend = 128.00 (should see 128.50, as on ServerA)
In the logs on ServerB, I see the replication transaction being sent from ServerA attempting to update the value of 'dailySpend' to 128.50 on ServerB.
I've poured over the logs on both servers and don't see any errors that would indicate that the replication event failed (in fact there are no
ERROR messages recorded in the logs on either server). I see the correct values being passed back and forth between the two servers, but it
just doesn't look like the values 'stick' in the server being replicated to. Its almost like the transaction isn't being effectively committed until I access and change the value in the object replicated to.
Has anyone seen this before or have any idea what might be causing this. I've included my XML configuration below, in case its helpful. Thank you
for your help!
Michael
<?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.GenericTransactionManagerLookup</attribute> <attribute name="NodeLockingScheme">PESSIMISTIC</attribute> <attribute name="IsolationLevel">REPEATABLE_READ</attribute> <attribute name="CacheMode">REPL_SYNC</attribute> <attribute name="UseReplQueue">false</attribute> <attribute name="ReplQueueInterval">0</attribute> <attribute name="ReplQueueMaxElements">0</attribute> <attribute name="ClusterName">GiftsCom-TreeCache-Cluster</attribute> <attribute name="ClusterConfig"> <config> <UDP mcast_addr="228.1.2.3" mcast_port="48866" 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_SOCK/> <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="true" down_thread="true"/> </config> </attribute> <attribute name="FetchInMemoryState">false</attribute> <attribute name="InitialStateRetrievalTimeout">20000</attribute> <attribute name="SyncReplTimeout">20000</attribute> <attribute name="LockAcquisitionTimeout">15000</attribute> <attribute name="EvictionPolicyClass">org.jboss.cache.eviction.AopLRUPolicy</attribute> <attribute name="EvictionPolicyConfig"> <config> <attribute name="wakeUpIntervalSeconds">5</attribute> <region name="/_default_"> <attribute name="maxNodes">5000</attribute> <attribute name="timeToLiveSeconds">1000</attribute> </region> <region name="/test/"> <attribute name="maxNodes">10000</attribute> <attribute name="timeToLiveSeconds">5</attribute> </region> </config> </attribute> <attribute name="UseMarshalling">true</attribute> </mbean> </server>