Package org.infoglue.cms.jobs

Source Code of org.infoglue.cms.jobs.RefreshJob

/* ===============================================================================
*
* Part of the InfoGlue Content Management Platform (www.infoglue.org)
*
* ===============================================================================
*
*  Copyright (C)
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 2, as published by the
* Free Software Foundation. See the file LICENSE.html for more information.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY, including the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc. / 59 Temple
* Place, Suite 330 / Boston, MA 02111-1307 / USA.
*
* ===============================================================================
*/
package org.infoglue.cms.jobs;

import org.apache.log4j.Logger;
import org.infoglue.cms.controllers.kernel.impl.simple.UserControllerProxy;
import org.infoglue.cms.util.ChangeNotificationController;
import org.infoglue.cms.util.NotificationMessage;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

/**
* @author mattias
*
* This jobs searches for expiring contents or sitenodes and clears caches if found.
*/

public class RefreshJob implements Job
{
    private final static Logger logger = Logger.getLogger(RefreshJob.class.getName());

    public synchronized void execute(JobExecutionContext context) throws JobExecutionException
    {
      logger.info("*********************************************************************");
      logger.info("* Starting refresh job which should run with nice intervals         *");
      logger.info("* Purpose is to keep connection pool alive and to clear live caches *");
      logger.info("*********************************************************************");
   
    try
    {
        logger.info("Notifying caches...");
      NotificationMessage notificationMessage = new NotificationMessage("NightlyRefreshJob.execute():", "ServerNodeProperties", "administrator", NotificationMessage.SYSTEM, "0", "ServerNodeProperties");
        ChangeNotificationController.getInstance().addNotificationMessage(notificationMessage);
          ChangeNotificationController.getInstance().notifyListeners();
          UserControllerProxy.getController().getAllUsers();
          //RemoteCacheUpdater.clearSystemNotificationMessages();
    }
    catch(Exception e)
      {
        logger.error("Could not update remote servers: " + e.getMessage());
      }
    
       logger.info("Refresh-job finished");
    }
   
}
TOP

Related Classes of org.infoglue.cms.jobs.RefreshJob

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.