mirror of https://github.com/apache/druid.git
move the close method to the segment object
This commit is contained in:
parent
f55e12040f
commit
35d8a82879
|
@ -24,13 +24,21 @@ import com.metamx.druid.kv.Indexed;
|
|||
import org.joda.time.Interval;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
*/
|
||||
public interface QueryableIndex extends ColumnSelector, Closeable
|
||||
public interface QueryableIndex extends ColumnSelector
|
||||
{
|
||||
public Interval getDataInterval();
|
||||
public int getNumRows();
|
||||
public Indexed<String> getColumnNames();
|
||||
public Indexed<String> getAvailableDimensions();
|
||||
|
||||
/**
|
||||
* The close method shouldn't actually be here as this is nasty. We will adjust it in the future.
|
||||
* @throws IOException
|
||||
*/
|
||||
@Deprecated
|
||||
public void close() throws IOException;
|
||||
}
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -38,7 +38,7 @@
|
|||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<metamx.java-util.version>0.22.5-SNAPSHOT</metamx.java-util.version>
|
||||
<metamx.java-util.version>0.22.5</metamx.java-util.version>
|
||||
<apache.curator.version>2.1.0-incubating</apache.curator.version>
|
||||
</properties>
|
||||
|
||||
|
|
|
@ -185,7 +185,7 @@ public class ServerManager implements QuerySegmentWalker
|
|||
}
|
||||
|
||||
try {
|
||||
oldQueryable.asQueryableIndex().close();
|
||||
oldQueryable.close();
|
||||
}
|
||||
catch (Exception e) {
|
||||
log.error("Unable to close queryable index %s", oldQueryable.getIdentifier());
|
||||
|
|
|
@ -24,6 +24,8 @@ import com.metamx.druid.index.v1.IncrementalIndex;
|
|||
import com.metamx.druid.index.v1.IncrementalIndexStorageAdapter;
|
||||
import org.joda.time.Interval;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class IncrementalIndexSegment implements Segment
|
||||
|
@ -60,4 +62,10 @@ public class IncrementalIndexSegment implements Segment
|
|||
{
|
||||
return new IncrementalIndexStorageAdapter(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,8 @@ import com.metamx.druid.StorageAdapter;
|
|||
import com.metamx.druid.index.v1.QueryableIndexStorageAdapter;
|
||||
import org.joda.time.Interval;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class QueryableIndexSegment implements Segment
|
||||
|
@ -59,4 +61,11 @@ public class QueryableIndexSegment implements Segment
|
|||
{
|
||||
return new QueryableIndexStorageAdapter(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException
|
||||
{
|
||||
// this is kinda nasty
|
||||
index.close();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,9 +22,11 @@ package com.metamx.druid.index;
|
|||
import com.metamx.druid.StorageAdapter;
|
||||
import org.joda.time.Interval;
|
||||
|
||||
import java.io.Closeable;
|
||||
|
||||
/**
|
||||
*/
|
||||
public interface Segment
|
||||
public interface Segment extends Closeable
|
||||
{
|
||||
public String getIdentifier();
|
||||
public Interval getDataInterval();
|
||||
|
|
|
@ -352,6 +352,12 @@ public class ServerManagerTest
|
|||
{
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static class MyQueryRunnerFactory implements QueryRunnerFactory<Result<SearchResultValue>, SearchQuery>
|
||||
|
|
|
@ -27,6 +27,7 @@ import com.metamx.druid.index.Segment;
|
|||
import org.joda.time.Interval;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
@ -68,6 +69,11 @@ public class CacheTestSegmentLoader implements SegmentLoader
|
|||
{
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException
|
||||
{
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue