/*
* JBoss, the OpenSource J2EE webOS
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package org.jboss.cache;
import EDU.oswego.cs.dl.util.concurrent.ConcurrentHashMap;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.eviction.EvictionPolicy;
import org.jboss.cache.eviction.LRUPolicy;
import org.jboss.cache.factories.NodeFactory;
import org.jboss.cache.interceptors.Interceptor;
import org.jboss.cache.loader.AsyncCacheLoader;
import org.jboss.cache.loader.AsyncExtendedCacheLoader;
import org.jboss.cache.loader.CacheLoader;
import org.jboss.cache.loader.ExtendedCacheLoader;
import org.jboss.cache.lock.IsolationLevel;
import org.jboss.cache.lock.LockStrategyFactory;
import org.jboss.cache.lock.LockingException;
import org.jboss.cache.lock.TimeoutException;
import org.jboss.cache.marshall.Region;
import org.jboss.cache.marshall.RegionManager;
import org.jboss.cache.marshall.TreeCacheMarshaller;
import org.jboss.cache.marshall.RegionNameConflictException;
import org.jboss.cache.marshall.RegionNotFoundException;
import org.jboss.cache.statetransfer.StateTransferFactory;
import org.jboss.cache.statetransfer.StateTransferGenerator;
import org.jboss.cache.statetransfer.StateTransferIntegrator;
import org.jboss.system.ServiceMBeanSupport;
import org.jboss.util.NestedRuntimeException;
import org.jgroups.*;
import org.jgroups.blocks.GroupRequest;
import org.jgroups.blocks.MethodCall;
import org.jgroups.blocks.RpcDispatcher;
import org.jgroups.util.Rsp;
import org.jgroups.util.RspList;
import org.w3c.dom.Attr;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.NodeList;
import javax.transaction.Status;
import javax.transaction.SystemException;
import javax.transaction.Transaction;
import javax.transaction.TransactionManager;
import java.lang.reflect.Method;
import java.util.*;
/**
* A tree-like structure that is replicated across several members. Updates will
* be multicast to all group members reliably and in the same order. User has the
* option to set transaction isolation level now (e.g., <code>SERIALIZABLE</code>, or
* <code>REPEATABLE_READ</code>.
*
* @author Bela Ban
* @author Ben Wang
* @author <a href="mailto:manik@jboss.org">Manik Surtani (manik@jboss.org)</a>
* @author Brian Stansberry
* @version $Id: TreeCache.java,v 1.56.2.11 2005/10/21 00:38:20 bstansberry Exp $
* <p/>
*/
public class TreeCache extends ServiceMBeanSupport implements TreeCacheMBean, Cloneable, MembershipListener {
public static final short DEFAULT_STATE_TRANSFER_VERSION = 124;
// Quite poor, but for now, root may be re-initialised when setNodeLockingOptimistic() is called.
// this is because if node locking is optimistic, we need to use OptimisticTreeNodes rather than TreeNodes.
// - MANIK
protected DataNode root = NodeFactory.getInstance().createDataNode(NodeFactory.NODE_TYPE_TREENODE, SEPARATOR, Fqn.fromString(SEPARATOR), null, null, this);
// hmesha - 2005/08/24 JBCACHE-229
// Changes the visiability of listeners map to private and added getTreeCacheListeners()
// to return an unmodifiable view of the map
private final ConcurrentHashMap listeners=new ConcurrentHashMap(16);
final static Object NULL=new Object();
protected JChannel channel=null;
/** Am I the coordinator ? */
protected boolean coordinator=false;
protected final static Log log=LogFactory.getLog(TreeCache.class);
protected String cluster_name="TreeCache-Group";
protected String cluster_props=null;
protected final Vector members=new Vector();
protected RpcDispatcher disp=null;
protected MessageListener ml=new MessageListenerAdaptor(this, log);
protected long state_fetch_timeout=5000;
protected long sync_repl_timeout=15000;
protected boolean use_repl_queue=false;
protected int repl_queue_max_elements=1000;
protected long repl_queue_interval=5000;
protected Map region_msg_queues = new HashMap();
/** Maintains mapping of transactions (keys) and Modifications/Undo-Operations */
private final TransactionTable tx_table=new TransactionTable();
/** HashMap<Thread, List<Lock>, maintains locks acquired by threads (used when no TXs are used) */
private final Map lock_table=Collections.synchronizedMap(new HashMap());
protected boolean fetch_state_on_startup=true;
protected long lock_acquisition_timeout=10000;
protected String eviction_policy_class=null;
protected TreeCacheListener eviction_policy_provider = null;
protected int cache_mode=LOCAL;
protected boolean inactiveOnStartup = false;
public static Method putDataMethodLocal=null;
public static Method putDataEraseMethodLocal=null;
public static Method putKeyValMethodLocal=null;
public static Method putFailFastKeyValueMethodLocal=null;
public static Method removeNodeMethodLocal=null;
public static Method removeKeyMethodLocal=null;
public static Method removeDataMethodLocal=null;
public static Method evictNodeMethodLocal=null;
// public static Method evictKeyValueMethodLocal=null;
public static Method prepareMethod=null;
public static Method commitMethod=null;
public static Method rollbackMethod=null;
public static Method replicateMethod=null;
public static Method replicateAllMethod=null;
// public static Method addChildMethod=null;
public static Method addChildMethodLocal=null;
public static Method getKeyValueMethodLocal=null;
public static Method getNodeMethodLocal=null;
public static Method getKeysMethodLocal=null;
public static Method getChildrenNamesMethodLocal=null;
public static Method releaseAllLocksMethodLocal=null;
public static Method printMethodLocal=null;
public static Method lockMethodLocal=null;
public static Method optimisticPrepareMethod=null;
public static Method getPartialStateMethod=null;
public static Method enqueueMethodCallMethod=null;
public static Method notifyCallOnInactiveMethod=null;
static LinkedList crud_methods=new LinkedList();
protected boolean isStateSet=false;
private final Object stateLock=new Object();
protected IsolationLevel isolationLevel=IsolationLevel.REPEATABLE_READ;
/** Eviction policy configuration in xml Element */
protected Element evictConfig_ = null;
/** Check to see if we need to use marshalling */
protected boolean useMarshalling_ = false;
/** Marshaller if register to handle marshalling */
protected TreeCacheMarshaller marshaller_ = null;
/** RegionManager used by marshaller and ExtendedCacheLoader */
protected RegionManager regionManager_ = null;
public MessageListener getMessageListener() {
return ml;
}
/** {@link #invokeMethod(MethodCall)} will dispatch to this chain of interceptors.
* In the future, this will be replaced with JBossAop. This is a first step towards refactoring JBossCache.
*/
protected Interceptor interceptor_chain=null;
/**
* Interceptor which handles invocations of {@link #_replicate(MethodCall)}. Any such method
* invocation is forwarded to the invoke_handler.<br/>
* This will go away in the future, as we're moving replication functionality into the
* ReplicationInterceptor itself
*/
protected Replicatable replication_handler=null;
/** Method to acquire a TransactionManager. By default we use JBossTransactionManagerLookup. Has
* to be set before calling {@link #start()} */
protected TransactionManagerLookup tm_lookup=null;
/** Class of the implementation of TransactionManagerLookup */
protected String tm_lookup_class=null;
/** Used to get the Transaction associated with the current thread */
protected TransactionManager tm=null;
/** The fully qualified name of the CacheLoader (has to implement the CacheLoader interface) */
protected String cache_loader_class=null;
/** A reference to the CacheLoader. If null, we don't have a CacheLo
没有合适的资源?快使用搜索试试~ 我知道了~
jbosscache 1.2.4 src
共174个文件
java:171个
old:2个
xml:1个
5星 · 超过95%的资源 需积分: 3 12 下载量 197 浏览量
2009-05-08
14:22:10
上传
评论
收藏 320KB ZIP 举报
温馨提示
jbosscache 1.2.4 源代码和sample
资源推荐
资源详情
资源评论
收起资源包目录
jbosscache 1.2.4 src (174个子文件)
TreeCache.java 154KB
JDBCCacheLoader.java 41KB
BdbjeCacheLoader.java 30KB
TreeCacheView.java 28KB
TreeCacheView2.java 28KB
TreeCacheAopView.java 25KB
OptimisticTxInterceptor.java 24KB
TreeCacheMBean.java 24KB
ReplicationInterceptor.java 22KB
DummyContext.java 21KB
TreeCacheAop.java 18KB
TreeNode.java 17KB
PessimisticLockInterceptor.java 15KB
ReadWriteLockWithUpgrade.java 14KB
TreeCacheMarshaller.java 14KB
WorkspaceNodeImpl.java 14KB
TreeCacheAopDelegate.java 13KB
RpcTreeCache.java 13KB
CreateIfNotExistsInterceptor.java 13KB
OptimisticNodeInterceptor.java 12KB
ActivationInterceptor.java 12KB
OptimisticMap.java 12KB
CachedListImpl.java 12KB
PropertyConfigurator.java 12KB
IdentityLock.java 11KB
OptimisticReplicationInterceptor.java 11KB
FileCacheLoader.java 11KB
MarshalledTreeCache.java 11KB
LRUAlgorithm.java 11KB
DummyTransaction.java 10KB
InternalDelegate.java 10KB
ConsoleListener.java 10KB
AsyncCacheLoader.java 10KB
RpcDelegatingCacheLoader.java 9KB
CacheStoreInterceptor.java 9KB
OptimisticValidatorInterceptor.java 9KB
StateTransferIntegrator_124.java 9KB
CollectionClassHandler.java 9KB
DummyBaseTransactionManager.java 8KB
OptimisticCreateIfNotExistsInterceptor.java 8KB
CacheLoaderInterceptor.java 8KB
ObjectGraphHandler.java 8KB
CachedMapImpl.java 8KB
LRUPolicy.java 8KB
CacheInterceptor.java 7KB
RpcTreeCacheMBean.java 7KB
CachedSetImpl.java 7KB
RmiDelegatingCacheLoader.java 7KB
TcpCacheServer.java 7KB
CacheLoader.java 7KB
Node.java 6KB
CachedType.java 6KB
TcpDelegatingCacheLoader.java 6KB
DelegatingCacheLoader.java 6KB
StateTransferGenerator_124.java 6KB
OptimisticLockingInterceptor.java 6KB
TransactionTable.java 6KB
AbstractNode.java 5KB
Fqn.java 5KB
TreeCacheAopMBean.java 5KB
RegionManager.java 5KB
RegionManager.java 5KB
Region.java 5KB
CollectionInterceptorUtil.java 5KB
AbstractTreeCacheListener.java 5KB
GenericTransactionManagerLookup.java 5KB
SharedStoreCacheLoader.java 5KB
DummyUserTransaction.java 4KB
LockMap.java 4KB
AopUtil.java 4KB
FileExtendedCacheLoader.java 4KB
JDBCExtendedCacheLoader.java 4KB
TransactionEntry.java 4KB
Modification.java 4KB
TreeCacheAopIfc.java 4KB
ObjectUtil.java 4KB
NodeFactory.java 4KB
AOPInstance.java 4KB
RemoteTreeCacheImpl.java 3KB
CachedListInterceptor.java 3KB
DataNode.java 3KB
GlobalTransaction.java 3KB
OrderedSynchronizationHandler.java 3KB
ReplicationQueue.java 3KB
AopLRUAlgorithm.java 3KB
PassivationInterceptor.java 3KB
AopLRUPolicy.java 3KB
CallInterceptor.java 3KB
CachedMapInterceptor.java 3KB
Region.java 3KB
CachedSetInterceptor.java 3KB
LocalDelegatingCacheLoader.java 3KB
ExtendedTreeCacheListener.java 2KB
MarshallUtil.java 2KB
RmiCacheServer.java 2KB
StateTransferFactory.java 2KB
WriteReplacer.java 2KB
UnlockInterceptor.java 2KB
TransactionWorkspaceImpl.java 2KB
ExtendedCacheLoader.java 2KB
共 174 条
- 1
- 2
资源评论
- beidoutianji2015-07-09通过看源码,终于解决了一个技术问题。
leicq
- 粉丝: 2
- 资源: 3
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功