日期:2014-05-19 浏览次数:20876 次
<bean name="hotelLabelList" class="cn.o.hotel.task.HotelLabelTask" /> <bean id="imageListJob"class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"> <property name="targetObject" ref="imageList" /> <property name="targetMethod" value="getHotelImageList" /> <property name="concurrent" value="true" /> </bean> <bean id="imageListsTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean"> <property name="jobDetail" ref="imageListJob" /> <property name="cronExpression" value="0 0/2 * * * ? " /> </bean> <bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean"> <property name="triggers"> <list> <ref bean="imageListsTrigger"/> </list> </property> </bean>
@Resource(name="hotelService") private HotelService hotelService; public void getHotelImageList() throws Exception { System.out.println("start imageList"); //查询酒店,返回指定条数的酒店List List<HotelInfo> list = hotelService.listHotelInfosBysize(50); System.out.println("==============start=================="); if(null != list){ for(HotelInfo info : list){ if(!info.isGrapImage()){ hotelImageList(info, 1); } } } System.out.println("================end==========="); }
@Override @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true) public List<HotelInfo> listHotelInfosBysize(int size) { Criteria crta = this.hotelInfoDao.createCriteria(); crta.add(Restrictions.eq("grapImage", false)); if(size>0){ crta.setMaxResults(size); } List<HotelInfo> list = crta.list();//注释1、这里没有返回值,好像卡死在这里。。 return list; }