How to auto refresh a portlet/view on interval basis?

Hi All,

I have a created portlet and want to do a auto refresh of that portlet on a specific interval(ex: 5min, 10min). Can anyone help me on this.

Thanks,
Guru

I think you will have more success with this question on the MWS and CAF space.

In the mean time, did you think about using a timer?

Which every 5-10 minutes calls a “Hidden Command”.

The timer task class:


  /**
   * The Class RefreshTask.
   * 
   * uses by the timer object in GetDomain to reset the Domain cache
   */
  class RefreshTask extends TimerTask {

    /*
     * (non-Javadoc)
     * 
     * @see java.util.TimerTask#run()
     */
    @Override
    public void run() {
      //your work comes here
    }

  }

The invocation of the class:


Timer timer = new Timer();
timer.schedule(new RefreshTask(), refreshDate, refreshIntervall.longValue());

The timer task might not be exactly the optimal way to do this, but the principle remains.
You can try maybe ScheduledThreadPoolExecutor.

Here it is a comparison between TimeTask and ScheduledThreadPoolExecutor: java.util.Timer: Is it deprecated? - Stack Overflow

Hope it helps,
Vlad Turian