类 FileRefreshableDataSource<T>
java.lang.Object
com.alibaba.csp.sentinel.datasource.AbstractDataSource<String,T>
com.alibaba.csp.sentinel.datasource.AutoRefreshDataSource<String,T>
com.alibaba.csp.sentinel.datasource.FileRefreshableDataSource<T>
- 所有已实现的接口:
ReadableDataSource<String,T>
A ReadableDataSource based on file. This class will automatically
fetches the backend file every isModified period.
Limitations: Default read buffer size is 1 MB. If file size is greater than buffer size, exceeding bytes will be ignored. Default charset is UTF-8.
- 作者:
- Carpenter Lee, Eric Zhao
-
字段概要
从类继承的字段 com.alibaba.csp.sentinel.datasource.AutoRefreshDataSource
recommendRefreshMs从类继承的字段 com.alibaba.csp.sentinel.datasource.AbstractDataSource
parser, property -
构造器概要
构造器构造器说明FileRefreshableDataSource(File file, Converter<String, T> configParser) Create a file basedReadableDataSourcewhose read buffer size is 1MB, charset is UTF8, and read interval is 3 seconds.FileRefreshableDataSource(File file, Converter<String, T> configParser, int bufSize) FileRefreshableDataSource(File file, Converter<String, T> configParser, long recommendRefreshMs, int bufSize, Charset charset) FileRefreshableDataSource(String fileName, Converter<String, T> configParser) -
方法概要
修饰符和类型方法说明voidclose()Close the data source.protected booleanRead original data from the data source.从类继承的方法 com.alibaba.csp.sentinel.datasource.AbstractDataSource
getProperty, loadConfig, loadConfig
-
构造器详细资料
-
FileRefreshableDataSource
public FileRefreshableDataSource(File file, Converter<String, T> configParser) throws FileNotFoundExceptionCreate a file basedReadableDataSourcewhose read buffer size is 1MB, charset is UTF8, and read interval is 3 seconds.- 参数:
file- the file to readconfigParser- the config decoder (parser)- 抛出:
FileNotFoundException
-
FileRefreshableDataSource
public FileRefreshableDataSource(String fileName, Converter<String, T> configParser) throws FileNotFoundException -
FileRefreshableDataSource
public FileRefreshableDataSource(File file, Converter<String, T> configParser, int bufSize) throws FileNotFoundException -
FileRefreshableDataSource
-
FileRefreshableDataSource
-
-
方法详细资料
-
readSource
从接口复制的说明:ReadableDataSourceRead original data from the data source.- 返回:
- the original data.
- 抛出:
Exception- IO or other error occurs
-
isModified
protected boolean isModified()- 覆盖:
isModified在类中AutoRefreshDataSource<String,T>
-
close
从接口复制的说明:ReadableDataSourceClose the data source.- 指定者:
close在接口中ReadableDataSource<String,T> - 覆盖:
close在类中AutoRefreshDataSource<String,T> - 抛出:
Exception- IO or other error occurs
-