{
if( accessCount != count )
{
String msg = "AccessCount: " + accessCount + " != " + count;
log.error(msg);
throw new RemoteException(msg);
}
int beanCount = 0;
try
{
InitialContext ctx = new InitialContext();
Context enc = (Context) ctx.lookup("java:comp/env");
EntityPKHome home = (EntityPKHome) enc.lookup("ejb/EntityPKHome");
EntityPK bean = home.findByPrimaryKey(theKey);
beanCount = bean.getOtherField();
if( beanCount != count )
throw new RemoteException("BeanCount: " + beanCount + " != " + count);
}
catch(RemoteException e)
{
log.error("Failed to validate EntityPK", e);
throw e;
}
catch(Exception e)
{
log.error("Failed to validate EntityPK", e);
throw new RemoteException("Failed to validate EntityPK");
}
return new NodeAnswer(nodeID, new Integer(beanCount));
}