i have a function with a fetch query which is run from 2 places
- First place its called sequentially which takes 2 secs to run
- 2nd place is when @Scheduled
job is run , the same query takes 30 secs to run.
Can someone help me with this issue , this is a big performance hit to the application.
Does the @Scheduled
java functionality pick up a different hibernate session due to which a delay is induced when running the query? @Scheduled
function is called every 5secs to pick up a job from DB queue based on which the query is executed
@Scheduled(fixedDelay = 5*1000)
@Transactional
public void dataScheduled() throws MessagingException, IOException, InstanceNotFoundException, AttributeNotFoundException, MalformedObjectNameException, ReflectionException, MBeanException, UnsupportedEncodingException {
/*some code
*/
getNotification();
}
getNotification(){
//some query
}