public void afterPropertiesSet() throws Exception { ResourceFactory.getResourceChangeScannerService().setInterval( this.interval ); if (enabled != null && enabled.equalsIgnoreCase("true")) { ResourceFactory.getResourceChangeNotifierService().start(); ResourceFactory.getResourceChangeScannerService().start(); } }
/** * If this is the last time calling stop, then stop the change services. * @param name the name to keep track of */ public static synchronized void stop(final String name) { _names.remove(name); if (_names.size() == 0 && _running) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("Stopping resource change service..."); } // ORDER IS IMPORTANT! // 1) stop the scanner ResourceFactory.getResourceChangeScannerService().stop(); // 2) stop the notifier ResourceFactory.getResourceChangeNotifierService().stop(); // 3) set the system event listener back to the original implementation SystemEventListenerFactory.setSystemEventListener(_originalSystemEventListener); _originalSystemEventListener = null; _running = false; if (LOGGER.isDebugEnabled()) { LOGGER.debug("Resource change service stopped."); } } }
notifier.subscribeChildResource( resource, child ); ResourceChangeNotifier notifier = entry.getKey(); ChangeSet changeSet = entry.getValue(); notifier.publishChangeSet( changeSet );
public void afterPropertiesSet() throws Exception { ResourceFactory.getResourceChangeScannerService().setInterval( this.interval ); if (enabled != null && enabled.equalsIgnoreCase("true")) { ResourceFactory.getResourceChangeNotifierService().start(); ResourceFactory.getResourceChangeScannerService().start(); } }
sconf.setProperty( "drools.resource.scanner.interval", Integer.toString(getUpdateInterval()) ); ResourceFactory.getResourceChangeScannerService().configure( sconf ); ResourceFactory.getResourceChangeNotifierService().start(); ResourceFactory.getResourceChangeScannerService().start();
ResourceFactory.getResourceChangeNotifierService().start();
protected KnowledgeAgent buildKnowledgeAgent(GuvnorConnectionUtils guvnorUtils) { try { ResourceChangeScannerConfiguration sconf = ResourceFactory.getResourceChangeScannerService().newResourceChangeScannerConfiguration(); sconf.setProperty( "drools.resource.scanner.interval", "10" ); ResourceFactory.getResourceChangeScannerService().configure( sconf ); ResourceFactory.getResourceChangeScannerService().start(); ResourceFactory.getResourceChangeNotifierService().start(); KnowledgeAgentConfiguration aconf = KnowledgeAgentFactory.newKnowledgeAgentConfiguration(); aconf.setProperty("drools.agent.newInstance", "false"); KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent("Guvnor default", aconf); kagent.applyChangeSet(ResourceFactory.newReaderResource(guvnorUtils.createChangeSet())); return kagent; } catch (Throwable t) { logger.error("Could not load processes from Guvnor: " + t.getMessage(), t); return null; } } }