pom version to 3.2.2
This commit is contained in:
commit
dae949b8ce
|
|
@ -20,14 +20,14 @@ import org.lionsoul.ip2region.service.Ip2Region;
|
|||
// 1, 创建 v4 的配置:指定缓存策略和 v4 的 xdb 文件路径
|
||||
final Config v4Config = Config.custom()
|
||||
.setCachePolicy(Config.VIndexCache) // 指定缓存策略: NoCache / VIndexCache / BufferCache
|
||||
.setSeachers(15) // 设置初始化的查询器数量
|
||||
.setSearchers(15) // 设置初始化的查询器数量
|
||||
.setXdbPath("ip2region v4 xdb path") // 设置 v4 xdb 文件的路径
|
||||
.asV4(); // 指定为 v4 配置
|
||||
|
||||
// 2, 创建 v6 的配置:指定缓存策略和 v6 的 xdb 文件路径
|
||||
final Config v6Config = Config.custom()
|
||||
.setCachePolicy(Config.VIndexCache) // 指定缓存策略: NoCache / VIndexCache / BufferCache
|
||||
.setSeachers(15) // 设置初始化的查询器数量
|
||||
.setSearchers(15) // 设置初始化的查询器数量
|
||||
.setXdbPath("ip2region v6 xdb path") // 设置 v6 xdb 文件的路径
|
||||
.asV6(); // 指定为 v6 配置
|
||||
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ public class ConfigBuilder {
|
|||
return this;
|
||||
}
|
||||
|
||||
public ConfigBuilder setSeachers(int searchers) {
|
||||
public ConfigBuilder setSearchers(int searchers) {
|
||||
this.searchers = searchers;
|
||||
return this;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,6 +67,13 @@ public class SearcherPool {
|
|||
return this;
|
||||
}
|
||||
|
||||
public int getLoanCount() {
|
||||
lock.lock();
|
||||
int lc = this.loanCount;
|
||||
lock.unlock();
|
||||
return lc;
|
||||
}
|
||||
|
||||
public Searcher borrowSearcher() throws InterruptedException {
|
||||
lock.lock();
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ public class ConfigTest {
|
|||
final Config v4Config = Config.custom()
|
||||
.setCachePolicy(Config.BufferCache)
|
||||
.setXdbPath(getDataPath("ip2region_v4.xdb"))
|
||||
.setSeachers(20)
|
||||
.setSearchers(20)
|
||||
.asV4();
|
||||
log.debugf("builded config: %s", v4Config);
|
||||
}
|
||||
|
|
@ -35,7 +35,7 @@ public class ConfigTest {
|
|||
final Config v4Config = Config.custom()
|
||||
.setCachePolicy(Config.VIndexCache)
|
||||
.setXdbPath(getDataPath("ip2region_v6.xdb"))
|
||||
.setSeachers(20)
|
||||
.setSearchers(20)
|
||||
.asV6();
|
||||
log.debugf("builded config: %s", v4Config);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,13 +19,13 @@ public class Ip2RegionTest {
|
|||
public void TestConfigCreate() throws IOException, XdbException, InetAddressException, InterruptedException {
|
||||
final Config v4Config = Config.custom()
|
||||
.setCachePolicy(Config.NoCache)
|
||||
.setSeachers(10)
|
||||
.setSearchers(10)
|
||||
.setXdbPath(ConfigTest.getDataPath("ip2region_v4.xdb"))
|
||||
.asV4();
|
||||
|
||||
final Config v6Config = Config.custom()
|
||||
.setCachePolicy(Config.VIndexCache)
|
||||
.setSeachers(10)
|
||||
.setSearchers(10)
|
||||
.setXdbPath(ConfigTest.getDataPath("ip2region_v6.xdb"))
|
||||
.asV6();
|
||||
|
||||
|
|
@ -92,13 +92,13 @@ public class Ip2RegionTest {
|
|||
public void TestConcurrentCall() throws IOException, XdbException, InetAddressException, InterruptedException {
|
||||
final Config v4Config = Config.custom()
|
||||
.setCachePolicy(Config.VIndexCache)
|
||||
.setSeachers(15)
|
||||
.setSearchers(15)
|
||||
.setXdbPath(ConfigTest.getDataPath("ip2region_v4.xdb"))
|
||||
.asV4();
|
||||
|
||||
final Config v6Config = Config.custom()
|
||||
.setCachePolicy(Config.VIndexCache)
|
||||
.setSeachers(15)
|
||||
.setSearchers(15)
|
||||
.setXdbPath(ConfigTest.getDataPath("ip2region_v6.xdb"))
|
||||
.asV6();
|
||||
|
||||
|
|
|
|||
|
|
@ -9,10 +9,10 @@ public class SearcherPoolTest {
|
|||
private static final Log log = Log.getLogger(SearcherPoolTest.class).setLevel(Log.DEBUG);
|
||||
|
||||
@Test
|
||||
public void testV4SeacherPool() throws Exception {
|
||||
public void testV4SearcherPool() throws Exception {
|
||||
final Config v4Config = Config.custom()
|
||||
.setCachePolicy(Config.VIndexCache)
|
||||
.setSeachers(5)
|
||||
.setSearchers(5)
|
||||
.setXdbPath(ConfigTest.getDataPath("ip2region_v4.xdb"))
|
||||
.asV4();
|
||||
|
||||
|
|
@ -33,10 +33,10 @@ public class SearcherPoolTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testV6SeacherPool() throws Exception {
|
||||
public void testV6SearcherPool() throws Exception {
|
||||
final Config v6Config = Config.custom()
|
||||
.setCachePolicy(Config.VIndexCache)
|
||||
.setSeachers(5)
|
||||
.setSearchers(5)
|
||||
.setXdbPath(ConfigTest.getDataPath("ip2region_v6.xdb"))
|
||||
.asV6();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue