| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
package org.kuali.rice.kew.lifecycle; |
| 18 |
|
|
| 19 |
|
import org.kuali.rice.core.api.config.property.ConfigContext; |
| 20 |
|
import org.kuali.rice.core.api.lifecycle.BaseLifecycle; |
| 21 |
|
import org.kuali.rice.core.api.lifecycle.BaseLifecycle; |
| 22 |
|
import org.kuali.rice.kew.batch.XmlPollerService; |
| 23 |
|
import org.kuali.rice.kew.service.KEWServiceLocator; |
| 24 |
|
|
| 25 |
|
import java.util.concurrent.Executors; |
| 26 |
|
import java.util.concurrent.ScheduledExecutorService; |
| 27 |
|
import java.util.concurrent.ScheduledFuture; |
| 28 |
|
import java.util.concurrent.TimeUnit; |
| 29 |
|
|
|
|
|
| 0% |
Uncovered Elements: 30 (30) |
Complexity: 7 |
Complexity Density: 0.39 |
|
| 30 |
|
public class XmlPipelineLifeCycle extends BaseLifecycle { |
| 31 |
|
|
| 32 |
|
protected final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(XmlPipelineLifeCycle.class); |
| 33 |
|
|
| 34 |
|
private ScheduledExecutorService scheduledExecutor; |
| 35 |
|
private ScheduledFuture future; |
| 36 |
|
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 2 |
Complexity Density: 0.29 |
|
| 37 |
0
|
public void start() throws Exception {... |
| 38 |
0
|
LOG.info("Configuring XML ingestion pipeline..."); |
| 39 |
0
|
scheduledExecutor = Executors.newScheduledThreadPool(1); |
| 40 |
0
|
final XmlPollerService xmlPoller = KEWServiceLocator.getXmlPollerService(); |
| 41 |
0
|
LOG.info("Starting XML data loader. Polling at " + xmlPoller.getPollIntervalSecs() + "-second intervals"); |
| 42 |
0
|
if (!ConfigContext.getCurrentContextConfig().getDevMode()) { |
| 43 |
0
|
future = scheduledExecutor.scheduleWithFixedDelay(xmlPoller, xmlPoller.getInitialDelaySecs(), xmlPoller.getPollIntervalSecs(), TimeUnit.SECONDS); |
| 44 |
0
|
super.start(); |
| 45 |
|
} |
| 46 |
|
} |
| 47 |
|
|
|
|
|
| 0% |
Uncovered Elements: 19 (19) |
Complexity: 5 |
Complexity Density: 0.45 |
|
| 48 |
0
|
public void stop() throws Exception {... |
| 49 |
0
|
if (isStarted()) { |
| 50 |
0
|
LOG.warn("Shutting down XML file polling timer"); |
| 51 |
0
|
try { |
| 52 |
0
|
if (future != null) { |
| 53 |
0
|
if (!future.cancel(false)) { |
| 54 |
0
|
LOG.warn("Failed to cancel the XML Poller service."); |
| 55 |
|
} |
| 56 |
0
|
future = null; |
| 57 |
|
} |
| 58 |
0
|
if (scheduledExecutor != null) { |
| 59 |
0
|
scheduledExecutor.shutdownNow(); |
| 60 |
0
|
scheduledExecutor = null; |
| 61 |
|
} |
| 62 |
|
} finally { |
| 63 |
0
|
super.stop(); |
| 64 |
|
} |
| 65 |
|
} |
| 66 |
|
} |
| 67 |
|
|
| 68 |
|
} |