[EJB/JBoss] - Jboss Cache in cluster
by mayankmit2002
Hello All,
I'am using Jboss Cache 1.4.1 SP9 with Jboss 4.2.3 and JDK 6.0 U 11, to replicate some of my date over different nodes in the cluster.
now the problem is that,if any node comes back in the cluster, all other of my nodes looses their data. I just go through the Wiki and clustering guide to solve this issue, but just of no use.
my Cache configuration is
|
| <server>
|
|
| <!-- ==================================================================== -->
| <!-- Defines TreeCache configuration -->
| <!-- ==================================================================== -->
|
| <mbean code="org.jboss.cache.TreeCache"
| name="jboss.cache:service=SessionTreeCache">
|
| <depends>jboss:service=Naming</depends>
| <depends>jboss:service=TransactionManager</depends>
|
| <!--
| Configure the TransactionManager
| -->
| <attribute name="TransactionManagerLookupClass">org.jboss.cache.JBossTransactionManagerLookup</attribute>
|
|
| <!--
| DataNode locking level : SERIALIZABLE
| REPEATABLE_READ (default)
| READ_COMMITTED
| READ_UNCOMMITTED
| NONE
| -->
| <attribute name="IsolationLevel">REPEATABLE_READ</attribute>
|
| <!--
| Valid modes are LOCAL
| REPL_ASYNC
| REPL_SYNC
| INVALIDATION_ASYNC
| INVALIDATION_SYNC
| -->
| <attribute name="CacheMode">REPL_ASYNC</attribute>
|
|
|
| <!--
| Just used for async repl: use a replication queue
| -->
| <attribute name="UseReplQueue">true</attribute>
|
| <!--
| Replication interval for replication queue (in ms)
| -->
| <attribute name="ReplQueueInterval">1000</attribute>
|
| <!--
| Max number of elements which trigger replication
| -->
| <attribute name="ReplQueueMaxElements">0</attribute>
|
|
| <!-- Name of cluster. Needs to be the same for all clusters, in order
| to find each other
| -->
| <attribute name="ClusterName">TreeCache-Cluster</attribute>
|
| <!-- JGroups protocol stack properties. Can also be a URL,
| e.g. file:/home/bela/default.xml
| <attribute name="ClusterProperties"></attribute>
| -->
|
| <attribute name="ClusterConfig">
| <config>
| <!-- UDP: if you have a multihomed machine,
| set the bind_addr attribute to the appropriate NIC IP address -->
| <!-- UDP: On Windows machines, because of the media sense feature
| being broken with multicast (even after disabling media sense)
| set the loopback attribute to true -->
| <UDP mcast_addr="228.1.2.3" mcast_port="45566"
| ip_ttl="64" ip_mcast="true"
| mcast_send_buf_size="150000" mcast_recv_buf_size="80000"
| ucast_send_buf_size="150000" ucast_recv_buf_size="80000"
| loopback="false"/>
| <PING timeout="2000" num_initial_members="3"
| up_thread="false" down_thread="false"/>
| <MERGE2 min_interval="10000" max_interval="20000"/>
| <!-- <FD shun="true" up_thread="true" down_thread="true" />-->
| <FD_SOCK/>
| <VERIFY_SUSPECT timeout="1500"
| up_thread="false" down_thread="false"/>
| <pbcast.NAKACK gc_lag="50" retransmit_timeout="600,1200,2400,4800"
| max_xmit_size="8192" up_thread="false" down_thread="false"/>
| <UNICAST timeout="600,1200,2400" window_size="100" min_threshold="10"
| down_thread="false"/>
| <pbcast.STABLE desired_avg_gossip="20000"
| up_thread="false" down_thread="false"/>
| <FRAG frag_size="8192"
| down_thread="false" up_thread="false"/>
| <pbcast.GMS join_timeout="5000" join_retry_timeout="2000"
| shun="true" print_local_addr="true"/>
| <pbcast.STATE_TRANSFER up_thread="true" down_thread="true"/>
| </config>
| </attribute>
|
| <!--
| Whether or not to fetch state on joining a cluster
| -->
| <attribute name="FetchStateOnStartup">true</attribute>
|
| <!--
| The max amount of time (in milliseconds) we wait until the
| initial state (ie. the contents of the cache) are retrieved from
| existing members in a clustered environment.
| -->
| <attribute name="InitialStateRetrievalTimeout">5000</attribute>
|
| <!--
| Number of milliseconds to wait until all responses for a
| synchronous call have been received.
| -->
| <attribute name="SyncReplTimeout">10000</attribute>
|
| <!-- Max number of milliseconds to wait for a lock acquisition -->
| <attribute name="LockAcquisitionTimeout">15000</attribute>
|
| <!-- Name of the eviction policy class. Not supported now. -->
| <attribute name="EvictionPolicyClass"></attribute>
|
| </mbean>
|
| <!-- New 1.3.x cache loader config block -->
| <attribute name="CacheLoaderConfiguration">
| <config>
| <!-- if passivation is true, only the first cache loader is
| used; the rest are ignored -->
| <passivation>false</passivation>
| <!-- comma delimited FQNs to preload -->
| <preload>/Session</preload>
| <!-- are the cache loaders shared in a cluster? -->
| <shared>true</shared>
|
| <!-- we can now have multiple cache loaders, which get
| chained -->
| <!-- the 'cacheloader' element may be repeated -->
| <cacheloader>
| <class>org.jboss.cache.loader.ClusteredCacheLoader</class>
| <!-- same as the old CacheLoaderConfig attribute -->
| <properties>
| timeout=3000
| <!--cache.jdbc.datasource=java:/DefaultDS
| cache.jdbc.node.type=abyte
| -->
| </properties>
| <!-- whether the cache loader writes are asynchronous-->
| <!-- <async>false</async> -->
| <!-- only one cache loader in the chain may set fetchPersistentState
| to true. An exception is thrown if more than one cache loader sets this
| to true. -->
| <!-- <fetchPersistentState>true</fetchPersistentState> -->
| <!-- determines whether this cache loader ignores writes - defaults
| to false. -->
| <!-- <ignoreModifications>false</ignoreModifications> -->
| <!-- if set to true, purges the contents of this cache loader when
| the cache starts up. Defaults to false. -->
| <!-- <purgeOnStartup>false</purgeOnStartup> -->
| </cacheloader>
| </config>
| </attribute>
| </server>
|
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4243476#4243476
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4243476
17 years
[JBoss jBPM] - Variable missing in assignment handler
by lpiccoli
hi all,
my swimlane assignment handler is unable to retrieve variables that have been previous set in both root token and local token.
the test involves a forkhandler, sub process and swimlane assignment handler.
When inside the SwimlaneAssignmentHandler getVariable() returns null which is not what i was expecting
| public void assign(Assignable assignable, ExecutionContext executionContext) {
|
| assertNotNull("shouldnt be null", executionContext.getVariable(IDENTIFIER));
| String expression = (String)executionContext.getVariable(EXPRESSION);
| assertNotNull( "shouldnt be null", expression );
|
as it was set in the previous ActivityForkActionHandler.execute()
| public void execute(final ExecutionContext executionContext) throws Exception {
| .....stuff
| Token(rootToken, "ITP" + item.getId()); //TODO -lp
| newToken.setTerminationImplicit(true);
| executionContext.getJbpmContext().getSession().save(newToken);
| final ExecutionContext newExecutionContext = new ExecutionContext(newToken);
| newExecutionContext.getContextInstance().createVariable(
| EXPRESSION,
| item.getResponsibleExpression(),
| newToken);
|
|
I am not sure if the problem is with my process definition of the swimlan assignment
| <swimlane name='responsible' >
| <assignment class='com.asteriski.itpflow.action.ActivityForkActionHandlerTest$SwimlaneAssignmentHandler'/>
| </swimlane>
|
or with how i am setting the local variables against token in the forkHandler above
i have a attached the entire test case below. It is a bit tedious but i needed to include all the handler code.
any help is most appreciated.
| public class ActivityForkActionHandlerTest extends AbstractJbpmTestCase {
|
| static JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance("jbpm.test.cfg.xml");
|
| public void testForkHandlerAndSubProcess() throws Exception {
|
| JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
|
| ProcessDefinition subProcessDefinition = ProcessDefinition.parseXmlString(
| "<process-definition name='sub'>" +
| " <start-state>" +
| " <transition to='wait' />" +
| " </start-state>" +
| " <swimlane name='responsible' >" +
| " <assignment class='com.asteriski.itpflow.action.ActivityForkActionHandlerTest$SwimlaneAssignmentHandler' />" +
| " </swimlane>" +
| " <task-node name='wait' >" +
| " <description>'just waiting'</description>" +
| " <task name='task-waiting' signal='block' swimlane='responsible'>"+
| " </task>" +
| " <transition to='end_sub'></transition>" +
| " </task-node>" +
| " <end-state name='end_sub' />" +
| "</process-definition>"
| );
| jbpmContext.deployProcessDefinition(subProcessDefinition);
|
| ProcessDefinition superProcessDefinition = ProcessDefinition.parseXmlString(
| "<process-definition" +
| " name='super'>" +
| "<start-state name='start'> " +
| "<transition name='to_state' to='forkActivities'>" +
| "</transition>" +
| "</start-state>" +
| " <node name='forkActivities'>" +
| " <action class='com.asteriski.itpflow.action.ActivityForkActionHandlerTest$ActivityForkActionHandler' config-type='bean' name='ActivityForkActionHandler'></action>" +
| " <description>" +
| " find all activities that have no blocking state and generate a testign request"+
| " </description>" +
| " <transition to='Sub Process'></transition>" +
| " </node>" +
| "<process-state name='Sub Process'>" +
| "<sub-process name='sub'/>" +
| "<transition to='task-node1'></transition>" +
| "</process-state>" +
| "<task-node name='task-node1'> " +
| " <task name='task1'>" +
| " </task>" +
| " <transition to='end' name='to_end'> " +
| " </transition>" +
| "</task-node>" +
| "<end-state name='end'></end-state> " +
| "</process-definition>");
|
|
| jbpmContext.deployProcessDefinition(superProcessDefinition);
| ProcessInstance processInstance = jbpmContext.newProcessInstance("super");
|
| ProcessState processState = (ProcessState) superProcessDefinition.getNode("Sub Process");
| processState.setSubProcessDefinition(subProcessDefinition);
|
| processInstance.getContextInstance().createVariable(Constant.ITP_ID_JBPM_CONTEXT_IDENTIFIER, 1);
|
| // After construction, the process execution has one main path
| // of execution (=the root token).
| Token rootToken = processInstance.getRootToken();
|
| assertEquals(
| "start",
| rootToken.getNode().getName());
|
|
| // Move the process instance to the task
| rootToken.signal();
| assertEquals(
| "Sub Process",
| rootToken.getNode().getName());
|
| //get the sub process
| ProcessInstance subProcessInstance = rootToken.getSubProcessInstance();
| assertSame(subProcessDefinition, subProcessInstance.getProcessDefinition());
| Token subToken = subProcessInstance.getRootToken();
|
|
| // Move the process instance to the task
| subToken.signal();
| assertEquals(
| "end_sub",
| subToken.getNode().getName());
|
|
| }
|
| public static class SwimlaneAssignmentHandler implements AssignmentHandler {
|
| Logger log = Logger.getLogger(ResponsibleSwimlaneAssignmentHandler.class);
|
| private static final long serialVersionUID = 1L;
|
| public void assign(Assignable assignable, ExecutionContext executionContext) {
|
|
| assertNotNull("shouldnt be null", executionContext.getVariable(Constant.ITP_ID_JBPM_CONTEXT_IDENTIFIER));
| String expression = (String)executionContext.getVariable(Constant.ASSIGNMENT_RESPONSIBLE_EXPRESSION_JBPM_CONTEXT_IDENTIFIER);
| assertNotNull( "shouldnt be null", expression );
|
| assignable.setPooledActors( expression );
| }
| }
|
|
| public static class ActivityForkActionHandler implements ActionHandler, Constant {
|
| Logger log = Logger.getLogger( ActivityForkActionHandler.class );
|
|
| /**
| * Create a new child token for each item in list.
| *
| * @param executionContext
| * @throws Exception
| */
| @SuppressWarnings("unchecked")
| public void execute(final ExecutionContext executionContext) throws Exception {
|
| log.debug("execute");
| long id =Long.valueOf( executionContext.getContextInstance().getVariable(ITP_ID_JBPM_CONTEXT_IDENTIFIER).toString() );
| log.debug("execute itp d:" + id);
|
| Collection<ITPItem> activities = getActivities( id );
|
| if( activities != null ){
| final Token rootToken = executionContext.getToken();
| final Node node = executionContext.getNode();
| log.debug( "node name:" + node.getName() );
| log.debug( "node getDescription:" + node.getDescription() );
| log.debug( "node getDefaultLeavingTransition:" + node.getDefaultLeavingTransition().getName() );
| final Transition transition = (Transition) node.getLeavingTransitions().get(0); //TODO must work out which transition to use
|
| log.debug( "transition name:" + transition.getName() );
|
| Collection<ExecutionContext> newContextList = new ArrayList<ExecutionContext>();
|
| //newExecutionContext.getContextInstance().createVariable(as, item, newToken);
| //
|
| for (Iterator iterator = activities.iterator(); iterator.hasNext();) {
|
| ITPItem item = (ITPItem) iterator.next();
| log.debug( "item id:" + item.getId() );
|
| final Token newToken = new Token(rootToken, "ITP" + item.getId()); //TODO -lp
| newToken.setTerminationImplicit(true);
| executionContext.getJbpmContext().getSession().save(newToken);
| final ExecutionContext newExecutionContext = new ExecutionContext(newToken);
| newExecutionContext.getContextInstance().createVariable(
| ASSIGNMENT_RESPONSIBLE_EXPRESSION_JBPM_CONTEXT_IDENTIFIER,
| item.getResponsibleExpression(),
| newToken);
| log.debug("execute getVariable:" + newExecutionContext.getVariable(ASSIGNMENT_RESPONSIBLE_EXPRESSION_JBPM_CONTEXT_IDENTIFIER));
|
| newContextList.add(newExecutionContext);
| }
|
| // Now, let each new token leave the node.
| //
| for (Iterator<ExecutionContext> iterator = newContextList.iterator(); iterator.hasNext();) {
| ExecutionContext context = iterator.next();
| //go via transition
| node.leave(context, transition);
|
| }
| }
|
| log.debug("leaving node" );
| executionContext.leaveNode();
| }
|
| /**
| * TODO the test version needs to be mocked somehow
| * @param id
| * @return
| */
| public Collection<ITPItem> getActivities( long id) {
|
| log.trace("getActivities");
| Collection<ITPItem> items = new ArrayList<ITPItem>();
|
| ITPItem itp1 = new ITPItem();
| itp1.setId(1);
| itp1.setResponsibleExpression("hello1");
| ITPItem itp2 = new ITPItem();
| itp2.setId(2);
| itp2.setResponsibleExpression("hello2");
| ITPItem itp3 = new ITPItem();
| itp3.setId(3);
| itp3.setResponsibleExpression("hello3");
|
| items.add(itp1);
| items.add(itp2);
| items.add(itp3);
| return items;
|
| }
| }
| }
|
-lp
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4243475#4243475
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4243475
17 years