Renamed the methods in DocumentListenerType to actually reflect when these are invoked.
This commit is contained in:
parent
92c32dca9e
commit
f9ff733eb8
|
@ -24,17 +24,17 @@ package org.elasticsearch.index.mapper;
|
||||||
public interface DocumentTypeListener {
|
public interface DocumentTypeListener {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Invoked when a new document type has been created.
|
* Invoked just before a new document type has been created.
|
||||||
*
|
*
|
||||||
* @param type The document type that has been created
|
* @param type The new document type
|
||||||
*/
|
*/
|
||||||
void created(String type);
|
void beforeCreate(String type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Invoked when an existing document type has been removed.
|
* Invoked just after an existing document type has been removed.
|
||||||
*
|
*
|
||||||
* @param type The document type that has been removed
|
* @param type The existing document type
|
||||||
*/
|
*/
|
||||||
void removed(String type);
|
void afterRemove(String type);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -291,7 +291,7 @@ public class MapperService extends AbstractIndexComponent implements Iterable<Do
|
||||||
mapper.addObjectMapperListener(objectMapperListener, false);
|
mapper.addObjectMapperListener(objectMapperListener, false);
|
||||||
|
|
||||||
for (DocumentTypeListener typeListener : typeListeners) {
|
for (DocumentTypeListener typeListener : typeListeners) {
|
||||||
typeListener.created(mapper.type());
|
typeListener.beforeCreate(mapper.type());
|
||||||
}
|
}
|
||||||
mappers = newMapBuilder(mappers).put(mapper.type(), mapper).map();
|
mappers = newMapBuilder(mappers).put(mapper.type(), mapper).map();
|
||||||
return mapper;
|
return mapper;
|
||||||
|
@ -335,7 +335,7 @@ public class MapperService extends AbstractIndexComponent implements Iterable<Do
|
||||||
mappers = newMapBuilder(mappers).remove(type).map();
|
mappers = newMapBuilder(mappers).remove(type).map();
|
||||||
removeObjectAndFieldMappers(docMapper);
|
removeObjectAndFieldMappers(docMapper);
|
||||||
for (DocumentTypeListener typeListener : typeListeners) {
|
for (DocumentTypeListener typeListener : typeListeners) {
|
||||||
typeListener.removed(type);
|
typeListener.afterRemove(type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -193,14 +193,14 @@ public class PercolatorQueriesRegistry extends AbstractIndexShardComponent {
|
||||||
private class PercolateTypeListener implements DocumentTypeListener {
|
private class PercolateTypeListener implements DocumentTypeListener {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void created(String type) {
|
public void beforeCreate(String type) {
|
||||||
if (PercolatorService.TYPE_NAME.equals(type)) {
|
if (PercolatorService.TYPE_NAME.equals(type)) {
|
||||||
enableRealTimePercolator();
|
enableRealTimePercolator();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removed(String type) {
|
public void afterRemove(String type) {
|
||||||
if (PercolatorService.TYPE_NAME.equals(type)) {
|
if (PercolatorService.TYPE_NAME.equals(type)) {
|
||||||
disableRealTimePercolator();
|
disableRealTimePercolator();
|
||||||
clear();
|
clear();
|
||||||
|
|
Loading…
Reference in New Issue