@Override public void afterRun() throws Exception { prepareForNextCleanup(); }
@Override public void run() throws Exception { if (getNodeEngine().getLocalMember().isLiteMember()) { // this operation shouldn't run on lite members. This situation can potentially be seen // when converting a data-member to lite-member during merge operations. return; } MapService mapService = getService(); MapServiceContext mapServiceContext = mapService.getMapServiceContext(); PartitionContainer partitionContainer = mapServiceContext.getPartitionContainer(getPartitionId()); ConcurrentMap<String, RecordStore> recordStores = partitionContainer.getMaps(); boolean backup = !isOwner(); for (final RecordStore recordStore : recordStores.values()) { if (recordStore.size() > 0 && recordStore.isExpirable()) { recordStore.evictExpiredEntries(expirationPercentage, backup); recordStore.disposeDeferredBlocks(); } } }
private boolean isOwner() { final NodeEngine nodeEngine = getNodeEngine(); final Address owner = nodeEngine.getPartitionService().getPartitionOwner(getPartitionId()); return nodeEngine.getThisAddress().equals(owner); }
protected void prepareForNextCleanup() { MapService mapService = getService(); MapServiceContext mapServiceContext = mapService.getMapServiceContext(); PartitionContainer partitionContainer = mapServiceContext.getPartitionContainer(getPartitionId()); partitionContainer.setHasRunningCleanup(false); partitionContainer.setLastCleanupTime(Clock.currentTimeMillis()); }
@Override protected Operation newPrimaryExpiryOp(int expirationPercentage, PartitionContainer container) { int partitionId = container.getPartitionId(); return new ClearExpiredOperation(expirationPercentage) .setNodeEngine(nodeEngine) .setCallerUuid(nodeEngine.getLocalMember().getUuid()) .setPartitionId(partitionId) .setValidateTarget(false) .setServiceName(SERVICE_NAME); }
@Override public void run() throws Exception { if (getNodeEngine().getLocalMember().isLiteMember()) { // this operation shouldn't run on lite members. This situation can potentially be seen // when converting a data-member to lite-member during merge operations. return; } MapService mapService = getService(); MapServiceContext mapServiceContext = mapService.getMapServiceContext(); PartitionContainer partitionContainer = mapServiceContext.getPartitionContainer(getPartitionId()); ConcurrentMap<String, RecordStore> recordStores = partitionContainer.getMaps(); boolean backup = !isOwner(); for (final RecordStore recordStore : recordStores.values()) { if (recordStore.size() > 0 && recordStore.isExpirable()) { recordStore.evictExpiredEntries(expirationPercentage, backup); recordStore.disposeDeferredBlocks(); } } }
private boolean isOwner() { final NodeEngine nodeEngine = getNodeEngine(); final Address owner = nodeEngine.getPartitionService().getPartitionOwner(getPartitionId()); return nodeEngine.getThisAddress().equals(owner); }
protected void prepareForNextCleanup() { MapService mapService = getService(); MapServiceContext mapServiceContext = mapService.getMapServiceContext(); PartitionContainer partitionContainer = mapServiceContext.getPartitionContainer(getPartitionId()); partitionContainer.setHasRunningCleanup(false); partitionContainer.setLastCleanupTime(Clock.currentTimeMillis()); }
@Override protected Operation newPrimaryExpiryOp(int expirationPercentage, PartitionContainer container) { int partitionId = container.getPartitionId(); return new ClearExpiredOperation(expirationPercentage) .setNodeEngine(nodeEngine) .setCallerUuid(nodeEngine.getLocalMember().getUuid()) .setPartitionId(partitionId) .setValidateTarget(false) .setServiceName(SERVICE_NAME); }
@Override public void afterRun() throws Exception { prepareForNextCleanup(); }
@Override public void onExecutionFailure(Throwable e) { try { super.onExecutionFailure(e); } finally { prepareForNextCleanup(); } }
@Override public void onExecutionFailure(Throwable e) { try { super.onExecutionFailure(e); } finally { prepareForNextCleanup(); } }