Merge pull request #11863 from rjernst/remove/mapper-close

Mappings: Remove close() from Mapper
This commit is contained in:
Ryan Ernst 2015-06-24 14:33:56 -07:00
commit 6ad6cf6b8d
9 changed files with 2 additions and 69 deletions

View File

@ -442,10 +442,6 @@ public class DocumentMapper implements ToXContent {
public void close() {
documentParser.close();
mapping.root.close();
for (RootMapper rootMapper : mapping.rootMappers) {
rootMapper.close();
}
}
@Override

View File

@ -129,6 +129,4 @@ public interface Mapper extends ToXContent, Iterable<Mapper> {
String name();
void merge(Mapper mergeWith, MergeResult mergeResult) throws MergeMappingException;
void close();
}

View File

@ -564,11 +564,6 @@ public abstract class AbstractFieldMapper implements FieldMapper {
protected abstract String contentType();
@Override
public void close() {
multiFields.close();
}
public static class MultiFields {
public static MultiFields empty() {
@ -702,12 +697,6 @@ public abstract class AbstractFieldMapper implements FieldMapper {
});
}
public void close() {
for (ObjectCursor<FieldMapper> cursor : mappers.values()) {
cursor.value.close();
}
}
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
if (pathType != Defaults.PATH_TYPE) {
builder.field("path", pathType.name().toLowerCase(Locale.ROOT));

View File

@ -335,10 +335,6 @@ public abstract class NumberFieldMapper extends AbstractFieldMapper implements A
}
}
@Override
public void close() {
}
protected NumericTokenStream popCachedStream() {
if (fieldType().numericPrecisionStep() == 4) {
return tokenStream4.get();

View File

@ -739,20 +739,6 @@ public class GeoPointFieldMapper extends AbstractFieldMapper implements ArrayVal
multiFields.parse(this, context);
}
@Override
public void close() {
super.close();
if (latMapper != null) {
latMapper.close();
}
if (lonMapper != null) {
lonMapper.close();
}
if (geohashMapper != null) {
geohashMapper.close();
}
}
@Override
public Iterator<Mapper> iterator() {
List<Mapper> extras = new ArrayList<>();

View File

@ -116,13 +116,6 @@ public class VersionFieldMapper extends AbstractFieldMapper implements RootMappe
}
}
private final ThreadLocal<Field> fieldCache = new ThreadLocal<Field>() {
@Override
protected Field initialValue() {
return new NumericDocValuesField(NAME, -1L);
}
};
public VersionFieldMapper(Settings indexSettings) {
super(Defaults.FIELD_TYPE, true, null, indexSettings);
}
@ -134,8 +127,8 @@ public class VersionFieldMapper extends AbstractFieldMapper implements RootMappe
@Override
protected void parseCreateField(ParseContext context, List<Field> fields) throws IOException {
// see UidFieldMapper.parseCreateField
final Field version = fieldCache.get();
// see InternalEngine.updateVersion to see where the real version value is set
final Field version = new NumericDocValuesField(NAME, -1L);
context.version(version);
fields.add(version);
}
@ -180,9 +173,4 @@ public class VersionFieldMapper extends AbstractFieldMapper implements RootMappe
public void merge(Mapper mergeWith, MergeResult mergeResult) throws MergeMappingException {
// nothing to do
}
@Override
public void close() {
fieldCache.remove();
}
}

View File

@ -544,13 +544,6 @@ public class ObjectMapper implements Mapper, AllFieldMapper.IncludeInAll, Clonea
}
@Override
public void close() {
for (Mapper mapper : mappers.values()) {
mapper.close();
}
}
@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
toXContent(builder, params, null);

View File

@ -236,15 +236,6 @@ public class ExternalMapper extends AbstractFieldMapper {
return Iterators.concat(super.iterator(), Lists.newArrayList(binMapper, boolMapper, pointMapper, shapeMapper, stringMapper).iterator());
}
@Override
public void close() {
binMapper.close();
boolMapper.close();
pointMapper.close();
shapeMapper.close();
stringMapper.close();
}
@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
builder.startObject(fieldType().names().shortName());

View File

@ -52,10 +52,6 @@ public class ExternalRootMapper implements RootMapper {
return Collections.emptyIterator();
}
@Override
public void close() {
}
@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
return builder.startObject(CONTENT_TYPE).endObject();