* @return
*/
@SuppressWarnings("unchecked")
private boolean isJobsAndGroupsChangedIgnoreContent(){
//init
final Judge ignoreContentJobJudge=this.ignoreContentJobJudge;
final Judge ignoreContentGroupJudge=this.ignoreContentGroupJudge;
final GroupBean ignoreGlobe=this.ignoreGlobe;
boolean jobChanged;
Judge jobrealtime=null;
jobrealtime=(Judge) getHibernateTemplate().execute(new HibernateCallback() {
@Override
public Object doInHibernate(Session session) throws HibernateException,
SQLException {
Object[] o=(Object[]) session.createSQLQuery("select count(*),max(id),max(gmt_modified) from zeus_job").uniqueResult();
if(o!=null){
Judge j=new Judge();
j.count=((Number) o[0]).intValue();
j.maxId=o[1]==null?0:((Number)o[1]).intValue();
j.lastModified=o[2]==null?new Date(0):(Date) o[2];
j.stamp=new Date();
return j;
}
return null;
}
});
List<JobDescriptor> changedJobs;
changedJobs=(List<JobDescriptor>) getHibernateTemplate().execute(new HibernateCallback() {
@Override
public Object doInHibernate(Session session) throws HibernateException,
SQLException {
Query query=session.createQuery("select id,groupId from com.taobao.zeus.store.mysql.persistence.JobPersistence where gmt_modified>?");
query.setDate(0, ignoreContentJobJudge.lastModified);
List<Object[]> list=query.list();
List<JobDescriptor> result=new ArrayList<JobDescriptor>();
for(Object[] o:list){
JobDescriptor jd=new JobDescriptor();
jd.setId(String.valueOf(o[0]));
jd.setGroupId(String.valueOf(o[1]));
result.add(jd);
}
return result;
}
});
if(jobrealtime!=null && jobrealtime.count.equals(ignoreContentJobJudge.count) && jobrealtime.maxId.equals(ignoreContentJobJudge.maxId)
&& isAllJobsNotChangeParent(ignoreGlobe, changedJobs)){
ignoreContentJobJudge.stamp=new Date();
ignoreContentJobJudge.lastModified=jobrealtime.lastModified;
jobChanged= false;
}else{
this.ignoreContentJobJudge=jobrealtime;
jobChanged= true;
}
//Group
boolean groupChanged;
Judge grouprealtime=null;
grouprealtime=(Judge) getHibernateTemplate().execute(new HibernateCallback() {
@Override
public Object doInHibernate(Session session) throws HibernateException,
SQLException {
Object[] o=(Object[]) session.createSQLQuery("select count(*),max(id),max(gmt_modified) from zeus_group").uniqueResult();
if(o!=null){
Judge j=new Judge();
j.count=((Number) o[0]).intValue();
j.maxId=o[1]==null?0:((Number)o[1]).intValue();
j.lastModified=o[2]==null?new Date(0):(Date) o[2];
j.stamp=new Date();
return j;