public abstract class AbstractConfigurationRepository<T extends Configuration,Loader extends ConfigurationLoader<T>,Writer extends ConfigurationWriter<T>> extends Object implements ConfigurationRepository<T,Loader,Writer>, Reloadable
| 限定符和类型 | 字段和说明 |
|---|---|
protected boolean |
inited |
protected Loader |
loader |
protected String |
name |
protected int |
reloadIntervalInSeconds
units: seconds
scan interval, if <=0, will not refresh
|
protected boolean |
running |
protected Writer |
writer |
| 构造器和说明 |
|---|
AbstractConfigurationRepository() |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
add(T configuration)
Add a configuration to the repository
it equals:
add(T configuration, true) |
T |
add(T configuration,
boolean sync) |
Map<String,T> |
getAll() |
T |
getById(String id)
Get a configuration bean by a specified id
|
Comparator<T> |
getComparator() |
EventPublisher |
getEventPublisher() |
String |
getName() |
Timer |
getTimer() |
void |
init() |
void |
reload() |
void |
removeById(String id)
Remove a configuration by id
it equals:
removeById(T configuration, true) |
void |
removeById(String id,
boolean sync)
Remove a configuration by id
|
void |
setCache(Cache<String,T> cache) |
void |
setComparator(Comparator<T> comparator) |
void |
setConfigurationLoader(Loader loader)
set a loader
|
void |
setConfigurationWriter(Writer writer)
set a writer
|
void |
setEventFactory(ConfigurationEventFactory<T> eventFactory) |
void |
setEventPublisher(EventPublisher publisher) |
void |
setName(String name) |
void |
setReloadIntervalInSeconds(int reloadIntervalInSeconds) |
void |
setTimer(Timer timer) |
void |
shutdown() |
void |
startup() |
void |
update(T configuration)
update the configuration to storage
it equals:
update(T configuration, true) |
void |
update(T configuration,
boolean sync)
update the configuration to storage
|
@NonNull protected Loader extends ConfigurationLoader<T> loader
@Nullable protected Writer extends ConfigurationWriter<T> writer
protected volatile boolean inited
protected volatile boolean running
protected int reloadIntervalInSeconds
public void setReloadIntervalInSeconds(int reloadIntervalInSeconds)
public void setComparator(Comparator<T> comparator)
public Comparator<T> getComparator()
public void setName(String name)
setName 在接口中 ConfigurationRepository<T extends Configuration,Loader extends ConfigurationLoader<T>,Writer extends ConfigurationWriter<T>>public String getName()
getName 在接口中 ConfigurationRepository<T extends Configuration,Loader extends ConfigurationLoader<T>,Writer extends ConfigurationWriter<T>>public void setEventFactory(ConfigurationEventFactory<T> eventFactory)
public EventPublisher getEventPublisher()
getEventPublisher 在接口中 EventPublisherAwarepublic void setEventPublisher(EventPublisher publisher)
setEventPublisher 在接口中 EventPublisherAwarepublic Timer getTimer()
public void setTimer(Timer timer)
public void setConfigurationLoader(Loader loader)
ConfigurationRepositorysetConfigurationLoader 在接口中 ConfigurationRepository<T extends Configuration,Loader extends ConfigurationLoader<T>,Writer extends ConfigurationWriter<T>>loader - the configuration loaderpublic void setConfigurationWriter(Writer writer)
ConfigurationRepositorysetConfigurationWriter 在接口中 ConfigurationRepository<T extends Configuration,Loader extends ConfigurationLoader<T>,Writer extends ConfigurationWriter<T>>writer - the configuration writerpublic T getById(String id)
ConfigurationRepositorygetById 在接口中 ConfigurationRepository<T extends Configuration,Loader extends ConfigurationLoader<T>,Writer extends ConfigurationWriter<T>>getById 在接口中 Repository<T extends Configuration,String>id - the idpublic void removeById(String id)
ConfigurationRepositoryremoveById(T configuration, true)removeById 在接口中 ConfigurationRepository<T extends Configuration,Loader extends ConfigurationLoader<T>,Writer extends ConfigurationWriter<T>>removeById 在接口中 Repository<T extends Configuration,String>id - the configuration idpublic void removeById(String id, boolean sync)
ConfigurationRepositoryremoveById 在接口中 ConfigurationRepository<T extends Configuration,Loader extends ConfigurationLoader<T>,Writer extends ConfigurationWriter<T>>id - the configuration idsync - whether sync to the real storage or notpublic void add(T configuration)
ConfigurationRepositoryadd(T configuration, true)add 在接口中 ConfigurationRepository<T extends Configuration,Loader extends ConfigurationLoader<T>,Writer extends ConfigurationWriter<T>>add 在接口中 Repository<T extends Configuration,String>configuration - the configuration beanpublic T add(T configuration, boolean sync)
add 在接口中 ConfigurationRepository<T extends Configuration,Loader extends ConfigurationLoader<T>,Writer extends ConfigurationWriter<T>>configuration - the configurationsync - whether sync to the real storage or notpublic void update(T configuration)
ConfigurationRepositoryupdate(T configuration, true)update 在接口中 ConfigurationRepository<T extends Configuration,Loader extends ConfigurationLoader<T>,Writer extends ConfigurationWriter<T>>update 在接口中 Repository<T extends Configuration,String>configuration - the configuration beanpublic void update(T configuration, boolean sync)
ConfigurationRepositoryupdate 在接口中 ConfigurationRepository<T extends Configuration,Loader extends ConfigurationLoader<T>,Writer extends ConfigurationWriter<T>>configuration - the configuration beansync - whether sync to the real storage or notpublic void init()
throws InitializationException
init 在接口中 InitializableInitializationExceptionpublic Map<String,T> getAll()
getAll 在接口中 ConfigurationRepository<T extends Configuration,Loader extends ConfigurationLoader<T>,Writer extends ConfigurationWriter<T>>public void reload()
reload 在接口中 ReloadableCopyright © 2020. All rights reserved.