1 22 package org.jboss.aspects.versioned; 23 import org.jboss.util.LRUCachePolicy; 24 25 29 public class TxCache extends LRUCachePolicy 30 { 31 protected long lockTimeout; 32 protected LocalSynchronizationManager synchManager; 33 protected DistributedVersionManager versionManager; 34 public TxCache(int maxSize, long lockTimeout) 35 { 36 super(2, maxSize); 37 this.lockTimeout = lockTimeout; 38 synchManager = new LocalSynchronizationManager(null); 39 versionManager = new DistributedVersionManager(lockTimeout, synchManager); 40 this.create(); 41 this.start(); 42 } 43 44 public void insert(Object key, Object obj) 45 { 46 try 47 { 48 Object versioned = versionManager.makeVersioned(obj); 49 super.insert(key, versioned); 50 } 51 catch (Exception ex) 52 { 53 throw new RuntimeException (ex); 54 } 55 } 56 } 57 | Popular Tags |