From: Ben W. <bw...@us...> - 2004-05-02 03:02:20
|
User: bwang00 Date: 04/05/01 20:02:14 Modified: src/main/org/jboss/cache TreeCache.java Log: In startService, re-factored notifyCacheStarted such that state transfer happened after eviction policy is started. Revision Changes Path 1.118 +20 -13 jboss-cache/src/main/org/jboss/cache/TreeCache.java Index: TreeCache.java =================================================================== RCS file: /cvsroot/jboss/jboss-cache/src/main/org/jboss/cache/TreeCache.java,v retrieving revision 1.117 retrieving revision 1.118 diff -u -r1.117 -r1.118 --- TreeCache.java 1 May 2004 19:15:16 -0000 1.117 +++ TreeCache.java 2 May 2004 03:02:13 -0000 1.118 @@ -43,7 +43,7 @@ * * @author Bela Ban March 25 2003 * @author Ben Wang July 2003 - * @version $Id: TreeCache.java,v 1.117 2004/05/01 19:15:16 bwang00 Exp $ + * @version $Id: TreeCache.java,v 1.118 2004/05/02 03:02:13 bwang00 Exp $ * @jmx.mbean extends="org.jboss.system.ServiceMBean" * <p/> * todo: emit notifications only on commit. bad case: emit notif about node creation, @@ -879,7 +879,7 @@ switch(cache_mode) { case LOCAL: log.info("cache mode is local, will not create the channel"); - notifyCacheStarted(); +// notifyCacheStarted(); return; case REPL_SYNC: case REPL_ASYNC: @@ -889,28 +889,35 @@ throw new IllegalArgumentException("cache mode " + cache_mode + " is invalid"); } + notifyCacheStarted(); + if(channel != null) { // already started log.info("channel is already running"); - notifyCacheStarted(); +// notifyCacheStarted(); return; } if(cluster_props == null) { cluster_props=getDefaultProperties(); log.debug("setting cluster properties to default value"); } - channel=new JChannel(cluster_props); - if(log.isTraceEnabled()) - log.trace("cache properties: " + cluster_props); - channel.setOpt(Channel.GET_STATE_EVENTS, new Boolean(true)); - disp=new RpcDispatcher(channel, ml, this, this); - channel.connect(cluster_name); - if(fetch_state_on_startup) { - fetchStateOnStartup(); + try { + channel=new JChannel(cluster_props); + if(log.isTraceEnabled()) + log.trace("cache properties: " + cluster_props); + channel.setOpt(Channel.GET_STATE_EVENTS, new Boolean(true)); + disp=new RpcDispatcher(channel, ml, this, this); + channel.connect(cluster_name); + + if(fetch_state_on_startup) { + fetchStateOnStartup(); + } + coordinator=determineCoordinator(); + } catch (Exception ex) { + notifyCacheStopped(); // in case something goes wrong here... } - coordinator=determineCoordinator(); - notifyCacheStarted(); +// notifyCacheStarted(); } |