[jboss-user] [JBoss Cache: Core Edition] - Clustered and JDBCCacheLoader access to DB

jorgemoralespou_2 do-not-reply at jboss.com
Fri Jun 20 09:03:19 EDT 2008


Hi,
I`m trying to configure my cache loader to achieve the following:
1- Firts node incluster starts. Unable to retrieve state from memory (another cluster` node) so get it from DB
2- Second clustered node starts. Gets state from memory (another cluster`node)

On cache put. The cache that receives the local put, transmits state to the rest of the cluster, and persist data to DB.

On cache get. Get value from memory, if miss, retrieve it from cluster, if miss, retrieve it from DB.

Is this possible?

I have try 2 approaches:

Approach 1

  | <attribute name="FetchInMemoryState">true</attribute>
  | <attribute name="InitialStateRetrievalTimeout">15000</attribute>
  | 
  | <attribute name="CacheLoaderConfiguration">
  |   <config>
  |      <passivation>false</passivation>
  |      <preload>/</preload>
  |      <shared>true</shared>
  |      <cacheloader>
  |                <class>org.jboss.cache.loader.JDBCCacheLoader</class>
  |                <properties>
  |                   cache.jdbc.datasource=java:jdbc/som
  |                   cache.jdbc.table.name=core_data
  |                   cache.jdbc.table.create=true
  |                   cache.jdbc.table.drop=false
  |                   cache.jdbc.table.primarykey=jbosscache_pk
  |                   cache.jdbc.fqn.column=fqn
  |                   cache.jdbc.fqn.type=varchar(255)
  |                   cache.jdbc.node.column=node
  |                   cache.jdbc.node.type=blob
  |                   cache.jdbc.parent.column=parent
  |                </properties>
  | 	  <async>true</async>
  | 	  <fetchPersistentState>false</fetchPersistentState>
  | 	  <ignoreModifications>false</ignoreModifications>
  |      </cacheloader>
  | </config>
  | 

Approach 2

  | <attribute name="FetchInMemoryState">true</attribute>
  | <attribute name="InitialStateRetrievalTimeout">15000</attribute>
  |             <config>
  |                                 <passivation>false</passivation>
  |                                 <preload>/</preload>
  |                                 <shared>true</shared>
  |                                 <cacheloader>
  |                         <class>
  |                               org.jboss.cache.loader.ClusteredCacheLoader
  |                          </class>
  |                          <properties>timeout=1000</properties>
  |                          <async>true</async>
  |                          <fetchPersistentState>false</fetchPersistentState>
  |                          <ignoreModifications>false</ignoreModifications>
  |                   </cacheloader>
  |                   <cacheloader>
  |                        <class>
  |                          org.jboss.cache.loader.JDBCCacheLoader
  |                        </class>
  |                        <properties>
  |                             cache.jdbc.datasource=java:jdbc/somservices
  |                             cache.jdbc.table.name=provisioning_data
  |                             cache.jdbc.table.create=true
  |                             cache.jdbc.table.drop=false
  |                             cache.jdbc.table.primarykey=provisioning_data_pk
  |                             cache.jdbc.fqn.column=fqn
  |                             cache.jdbc.fqn.type=varchar(255)
  |                             cache.jdbc.node.column=node
  |                             cache.jdbc.node.type=blob
  |                             cache.jdbc.parent.column=parent
  |                  </properties>
  |          <async>true</async>
  |         <fetchPersistentState>true</fetchPersistentState>
  |         <ignoreModifications>false</ignoreModifications>
  | </cacheloader>
  | 
  | 
  | What I see, with both of this configs, is that when I start second node in the cluster, it retrieves state from the other node, but it seems to update the database. It performs a delete all, and insert every retrieved value. I see the deletes , inserts in logs.
  | 
  | Anyone can help? Is it possible what I want?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4159553#4159553

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4159553



More information about the jboss-user mailing list