Create the bean which should be called on regular intervals.
This bean should extend the TimerTask and should have the run method which will be called on timely basis.
<bean id="example" class="com.examples.foo">
Make the bean a task and provide the time interval when it needs to be called. The time could be picked from property files.
<bean id="exampleTask" class="org.springframework.scheduling.timer.ScheduledTimerTask">
<property name="period" value="${exampleTime}">
<property name="timerTask" ref="example">
</property>
Add the tasks as part of Timerfactory which will be called based on the time given.
<bean id="timerFactory" class="org.springframework.scheduling.timer.TimerFactoryBean">
<property name="scheduledTimerTasks">
<list>
<ref bean="exampleTask">
</ref>
</list>
</property>
All the above entries will be part of the spring xml.More then one tasks can be added to the timerfactory
</bean></property></bean></bean>
Monday, August 4, 2008
Spring timer tasks for Threads
Prototip for easy and Fancy tool Tips
Just came across Prototip which helps to create javascript based tool tips with ease
http://www.nickstakenburg.com/projects/prototip2/.
Could not work more on it as we needed something which supports from IE 5+ versions. Protip supports IE 6+ and Firefox 2+
Running Parallel Db queries on huge Databases.
When the size of the table is very high and the column you are looking for is not indexed then the best way to run the query would be by parallel execution.
This really speeds up the process . But the catch here is that the CPU utilization is high and in production systems this may end up in locks.
This technique can be safely used in backup db servers.
Example
SELECT /*+ parallel(huge_table,4 ) */ * FROM huge_table;
where 4 is the degree of parallelism.The degree of parallelism depends on the capacity of the machines.