mirror of https://github.com/apache/druid.git
hide decrement and update close logic to call decrement
This commit is contained in:
parent
e92e0c35a4
commit
dc169d9fcd
|
@ -56,6 +56,7 @@ import com.metamx.emitter.service.ServiceMetricEvent;
|
|||
import org.joda.time.Interval;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
@ -191,7 +192,12 @@ public class ServerManager implements QuerySegmentWalker
|
|||
dataSourceCounts.add(dataSource, -1L);
|
||||
}
|
||||
|
||||
oldQueryable.decrement();
|
||||
try {
|
||||
oldQueryable.close();
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new SegmentLoadingException(e, "Unable to close segment %s", segment.getIdentifier());
|
||||
}
|
||||
} else {
|
||||
log.info(
|
||||
"Told to delete a queryable on dataSource[%s] for interval[%s] and version [%s] that I don't have.",
|
||||
|
|
|
@ -112,8 +112,12 @@ public class ReferenceCountingSegment implements Segment
|
|||
{
|
||||
synchronized (lock) {
|
||||
if (!isClosed) {
|
||||
baseSegment.close();
|
||||
isClosed = true;
|
||||
if (numReferences > 0) {
|
||||
decrement();
|
||||
} else {
|
||||
baseSegment.close();
|
||||
isClosed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -140,7 +144,7 @@ public class ReferenceCountingSegment implements Segment
|
|||
}
|
||||
}
|
||||
|
||||
public void decrement()
|
||||
private void decrement()
|
||||
{
|
||||
synchronized (lock) {
|
||||
if (!isClosed) {
|
||||
|
|
Loading…
Reference in New Issue