1 Reply Latest reply on Dec 9, 2002 12:15 AM by belaban

    ReplicationManager for replicated cache

    belaban

      I have created the first building block: ReplicationManager (see the URL below for the javadoc).

      You can use it to send
      - asynchronous updates to all cache replicas (caller returns immediately after the call, without waiting for acks for the caches)
      - synchronous updates to all cache replicas (caller blocks until all acks from all caches in the cluster have been received). Can specify a timeout optionally too.
      - synchronous updates with locking: same as above, but each receiver has to acquire a lock for the update before proceeding. If this is not possible, the caller will rollback the current transaction.

      It has a simple interface:
      #1 constructor (on top of a JavaGroups channel)
      #2 begin transaction
      #3 send update
      #4 commit or rollback transaction

      #2 and #4 are obviously only used when transactions are used (ie. locking). An example for a simple async call would be:

      channel=new JChannel();
      channel.connect("MyCacheGroup");
      repl_mgr=new ReplicationManager(channel, this, null, this);
      RspList rsps=repl_mgr.send(null, "hello world",getBytes(),
      false, 0, null,
      null, null, 0, 0, false);

      This multicasts the update to all caches.

      Now, we need to implement a ReplicationReceiver, which will handle the
      - send()
      - commit() or abort() [optional]

      In the above simple case, we'd just apply the update to our cache.

      ThereplicationManager allows a developer to
      - Write a replicated data structure (*any* structure, not just a Map)
      - Implement updates, locking etc as part of ReplicationReceiver
      - Does the async/sync/sync-lock stuff for you on the sender's side. You have to implement the receiver's side.


      The first building block that uses ReplicationManager is TransactionalHashtable, which implements a replicated java.util.Map. I'll present that block later.

      We now need to think about how we can have those 2 blocks in JBoss (as MBeans). I'll probably create an org.jboss.cache package shortly.

      These 2 blocks will form the basis for the *replicated* side of the JBoss Cache, but we'll also need to focus on the local side. Any volunteers ?


      Javadoc for ReplicationManager:
      http://www.javagroups.com/javagroupsnew/docs/javadoc/index.html


      Bela