public class LookupReferencesManager extends Object
LookupExtractorFactory
references manager.
It allows basic operations fetching, listing, adding and deleting of LookupExtractor
objects
It is be used by queries to fetch the lookup reference.
It is used by Lookup configuration manager to add/remove or list lookups configuration via HTTP or other protocols.
It does periodic snap shot of the list of lookup in order to bootstrap nodes after restart.Constructor and Description |
---|
LookupReferencesManager(LookupConfig lookupConfig,
com.fasterxml.jackson.databind.ObjectMapper objectMapper) |
Modifier and Type | Method and Description |
---|---|
LookupExtractorFactory |
get(String lookupName) |
Map<String,LookupExtractorFactory> |
getAll() |
boolean |
isClosed() |
void |
put(Map<String,LookupExtractorFactory> lookups) |
boolean |
put(String lookupName,
LookupExtractorFactory lookupExtractorFactory) |
boolean |
remove(String lookupName) |
void |
start() |
void |
stop() |
boolean |
updateIfNew(String lookupName,
LookupExtractorFactory lookupExtractorFactory)
Add or update a lookup factory
|
@Inject public LookupReferencesManager(LookupConfig lookupConfig, com.fasterxml.jackson.databind.ObjectMapper objectMapper)
public void start()
public void stop()
public boolean put(String lookupName, LookupExtractorFactory lookupExtractorFactory)
lookupName
- name of the lookupExtractorFactory objectlookupExtractorFactory
- LookupExtractorFactory
implementation reference.IllegalStateException
- If the manager is closed or if start of lookup returns false.public void put(Map<String,LookupExtractorFactory> lookups)
lookups
- Map
containing all the lookup as one batch.IllegalStateException
- if the manager is closed or if LookupExtractorFactory.start()
returns falsepublic boolean updateIfNew(String lookupName, LookupExtractorFactory lookupExtractorFactory)
lookupName
- The name of the lookuplookupExtractorFactory
- The factory of the lookupIllegalStateException
- if start of the factory failspublic boolean remove(String lookupName)
lookupName
- name of LookupExtractorFactory
to delete from the reference registry.
this function does call the cleaning method LookupExtractorFactory.close()
lookupName
is removed and the lookup correctly stopped@Nullable public LookupExtractorFactory get(String lookupName)
lookupName
- key to fetch the reference of the object LookupExtractor
LookupExtractorFactory
that correspond the lookupName
or null if absentIllegalStateException
- if the LookupReferencesManager
is closed or did not start yetpublic Map<String,LookupExtractorFactory> getAll()
public boolean isClosed()
Copyright © 2011–2017. All rights reserved.