List of usage examples for com.liferay.portal.kernel.messaging HotDeployMessageListener HotDeployMessageListener
public HotDeployMessageListener(String... servletContextNames)
From source file:com.liferay.calendar.servlet.CalendarServletContextListener.java
License:Open Source License
@Override protected void doPortalInit() throws Exception { _messageListener = new HotDeployMessageListener(ClpSerializer.getServletContextName()) { @Override// ww w . j ava 2 s. co m protected void onDeploy(Message message) throws Exception { if (!PortletPropsValues.CALENDAR_SYNC_CALEVENTS_ON_STARTUP) { return; } StopWatch stopWatch = null; if (_log.isInfoEnabled()) { stopWatch = new StopWatch(); stopWatch.start(); } CalendarImporterLocalServiceUtil.importCalEvents(); if (_log.isInfoEnabled()) { StringBundler sb = new StringBundler(6); sb.append("Calendar events synchronization takes "); sb.append(stopWatch.getTime()); sb.append(" ms. Set the property "); sb.append("\"calendar.sync.calevents.on.startup\" "); sb.append("to \"false\" to disable calendar events "); sb.append("synchronization."); _log.info(sb.toString()); } } }; MessageBusUtil.registerMessageListener(DestinationNames.HOT_DEPLOY, _messageListener); }