/** * Returns the current value of {@link Provisioning#A_zimbraAutoProvPollingInterval}, or * <tt>0</tt> if it cannot be determined. */ private static long getSleepInterval() { try { Provisioning prov = Provisioning.getInstance(); Server server = prov.getLocalServer(); sleepInterval = server.getTimeInterval(Provisioning.A_zimbraAutoProvPollingInterval, 0); } catch (ServiceException e) { ZimbraLog.autoprov.warn( "Unable to determine value of %s. Using previous value: %d.", Provisioning.A_zimbraAutoProvPollingInterval, sleepInterval, e); } return sleepInterval; }
public static synchronized void switchAutoProvThreadIfNecessary() throws ServiceException { Server localServer = Provisioning.getInstance().getLocalServer(); long interval = localServer.getTimeInterval(Provisioning.A_zimbraAutoProvPollingInterval, 0); Set<String> scheduledDomains = localServer.getMultiAttrSet(Provisioning.A_zimbraAutoProvScheduledDomains); boolean needRunning = interval > 0 && !scheduledDomains.isEmpty(); if (needRunning && !AutoProvisionThread.isRunning()) { AutoProvisionThread.startup(); } else if (!needRunning && AutoProvisionThread.isRunning()) { AutoProvisionThread.shutdown(); } }