dev@glassfish.java.net

Event Propogation in a clustered environment

From: Ed Burns <edward.burns_at_oracle.com>
Date: Sat, 29 Oct 2011 11:07:21 -0700

Hello Team,

I recently discovered a potentially difficult problem regarding event
propogation in an app deployed to a GlassFish cluster. JSF 2.0 has a
special data structure called the flash. The data structure is stored
in the session, so any accesses to it are automatically replicated
across the nodes of the cluster. So far so good.

A feature request for JSF 2.2 has me firing system events when certain
operations happen to this data structure. My testcase for this new
feature has a session scoped managed bean acting as a listener for these
events. The testcase accesses the data structure over 10 or so HTTP
requests, which cases the events to be fired, and I collect the data
from each event. At the end of the testcase I assert that the data
matches the expected pattern. In a non-clustered scenario, this all
works fine. However, in the clustered scenario, the test harness makes
it so each of the requests is directed to a random node in the
cluster. Because of this, I am observing that the collected data varies
wildly between test runs, as shown in the attached text file.

My question: How can I make it so, even in the clustered environment
with the random node choosing, the data is always the same at the end of
the test?

Thanks,

Ed


flash14 [received javax.faces.event.PostPutFlashValueEvent source:foo][received javax.faces.event.PreClearFlashEvent source:{}]
flash14 [received javax.faces.event.PostPutFlashValueEvent source:wizardId][received javax.faces.event.PreClearFlashEvent source:{}][received javax.faces.event.PostPutFlashValueEvent source:foo][received javax.faces.event.PreClearFlashEvent source:{}]
flash14 no message
flash14 no message
flash14 no message
flash14 [received javax.faces.event.PostPutFlashValueEvent source:valueA][received javax.faces.event.PostPutFlashValueEvent source:valueB][received javax.faces.event.PostPutFlashValueEvent source:valueC][received javax.faces.event.PostKeepFlashValueEvent source:valueA][received javax.faces.event.PostKeepFlashValueEvent source:valueB][received javax.faces.event.PostKeepFlashValueEvent source:valueC][received javax.faces.event.PreClearFlashEvent source:{valueC=c value, valueB=b value, valueA=a value}][received javax.faces.event.PreClearFlashEvent source:{}][received javax.faces.event.PostPutFlashValueEvent source:valueA][received javax.faces.event.PostPutFlashValueEvent source:valueB][received javax.faces.event.PostPutFlashValueEvent source:valueC][received javax.faces.event.PreClearFlashEvent source:{}][received javax.faces.event.PostPutFlashValueEvent source:wizardId][received javax.faces.event.PreClearFlashEvent source:{}][received javax.faces.event.PostPutFlashValueEvent source:foo][received javax.faces.event.PreClearFlashEvent source:{}]


-- 
| edward.burns_at_oracle.com | office: +1 407 458 0017
| homepage:               | http://ridingthecrest.com/