Revision 42972
Added by Claudio Atzori almost 8 years ago
GarbageActionManagerActionFromHDFS.java | ||
---|---|---|
9 | 9 |
import eu.dnetlib.enabling.tools.blackboard.BlackboardJob; |
10 | 10 |
import eu.dnetlib.enabling.tools.blackboard.BlackboardServerAction; |
11 | 11 |
import eu.dnetlib.enabling.tools.blackboard.BlackboardServerHandler; |
12 |
import eu.dnetlib.miscutils.datetime.DateUtils; |
|
13 | 12 |
import eu.dnetlib.rmi.data.hadoop.ClusterName; |
14 | 13 |
import eu.dnetlib.rmi.data.hadoop.HadoopService; |
15 | 14 |
import eu.dnetlib.rmi.data.hadoop.actionmanager.ActionManagerSet; |
16 | 15 |
import eu.dnetlib.rmi.data.hadoop.actionmanager.RawSet; |
17 | 16 |
import eu.dnetlib.rmi.enabling.ISRegistryService; |
17 |
import org.apache.commons.lang3.time.DateUtils; |
|
18 | 18 |
import org.apache.commons.logging.Log; |
19 | 19 |
import org.apache.commons.logging.LogFactory; |
20 | 20 |
import org.springframework.beans.factory.annotation.Autowired; |
... | ... | |
35 | 35 |
try { |
36 | 36 |
final String basePath = isClient.getBasePathHDFS(); |
37 | 37 |
final Integer garbageRetain = Integer.valueOf(isClient.getGarbageRetainThreshold()); |
38 |
final Long dateLimit = DateUtils.now() - Long.valueOf(isClient.getGarbageTimeMargin());
|
|
38 |
final Long dateLimit = new Date().getTime() - Long.valueOf(isClient.getGarbageTimeMargin());
|
|
39 | 39 |
|
40 | 40 |
final HadoopService hadoopService = serviceLocator.getService(HadoopService.class); |
41 | 41 |
final ISRegistryService isRegistry = serviceLocator.getService(ISRegistryService.class); |
42 | 42 |
|
43 | 43 |
for (ActionManagerSet set : isClient.listValidSets()) { |
44 | 44 |
for (RawSet expired : Iterables.limit(set.getExpired(), garbageRetain)) { |
45 |
final Date d = org.apache.commons.lang.time.DateUtils.parseDate(expired.getLastUpdate(), ActionManagerSet.DATE_PATTERNS);
|
|
45 |
final Date d = DateUtils.parseDate(expired.getLastUpdate(), ActionManagerSet.DATE_PATTERNS); |
|
46 | 46 |
if (d.getTime() < dateLimit) { |
47 | 47 |
|
48 | 48 |
log.info(String.format("removing raw action set %s/%s", set.getId(), expired.getId())); |
Also available in: Unified diff
updated to commons-lang3, excluded tons of clashing libs