long callStart = System.currentTimeMillis();
long inactive = callStart - accessStamp[id];
try
{
bean.setName(name);
NodeAnswer node = bean.getNodeState();
long now = System.currentTimeMillis();
long elapsed = now - callStart;
accessStamp[id] = now;
assertTrue("NodeAnswer == "+name, node.answer.equals(name));
min = Math.min(min, elapsed);
max = Math.max(max, elapsed);
maxInactive = Math.max(maxInactive, inactive);
log.debug(n+", elapsed="+elapsed+", inactive="+inactive);
}
catch (java.rmi.NoSuchObjectException nso)
{
log.debug(n+" Caught NoSuchObjectException on bean " + id + " -- inactive time = " + inactive);
// Remove the bean as it will never succeed again
beans[id] = null;
}
}
log.info(N+" calls complete, max="+max+", min="+min+", maxInactive="+maxInactive);
Thread.sleep(15000);
start = System.currentTimeMillis();
for(int n = 0; n < beans.length; n ++)
{
beans[n] = (StatefulSession) home.create("testStatefulPassivationExpiration#"+n);
accessStamp[n] = System.currentTimeMillis();
}
end = System.currentTimeMillis();
log.info("End second round bean creation, elapsed="+(end - start));
for(int n = 0; n < N; n ++)
{
int id = n % beans.length;
StatefulSession bean = beans[id];
if (bean == null)
continue; // bean timed out and removed
String name = "testStatefulPassiviationExpiration#"+id;
long callStart = System.currentTimeMillis();
long inactive = callStart - accessStamp[id];
try
{
bean.setName(name);
NodeAnswer node = bean.getNodeState();
long now = System.currentTimeMillis();
long elapsed = now - callStart;
accessStamp[id] = now;
assertTrue("NodeAnswer == "+name, node.answer.equals(name));
min = Math.min(min, elapsed);