优化搜索超限退出
This commit is contained in:
-1
@@ -44,7 +44,6 @@ class SeaweedPoiDetail {
|
||||
static void main(String[] args) {
|
||||
DBObject query = new BasicDBObject()
|
||||
query.put("status", 1)
|
||||
query.put("city", "东莞")
|
||||
conn136.find(query).batchSize(1000).each {objTemp ->
|
||||
final def obj = objTemp
|
||||
executorService.submit(new Runnable() {
|
||||
|
||||
+48
-4
@@ -90,12 +90,25 @@ class GaoDeUtils {
|
||||
if (json && json.info && json.info == "OK") {
|
||||
count = json.getString("count").toInteger()
|
||||
result.addAll(DataUtil.toMongoDbObj(json.pois))
|
||||
} else if (json && json.infocode && json.infocode == 10003) {
|
||||
throw new RuntimeException("开发者的日访问量超限,被系统自动封停,第二天0:00会自动解封")
|
||||
} else if (json && json.infocode && json.infocode == 10004) {
|
||||
} else if (json && json.infocode && json.infocode == "10044") {
|
||||
synchronized (this) {
|
||||
for (int i = 0; i < GAO_DE_AK.size(); i++) {
|
||||
if (GAO_DE_AK[i] == params.key) {
|
||||
if (i + 1 > GAO_DE_AK.size()) {
|
||||
System.exit(1)
|
||||
}
|
||||
keyUsed = new AtomicInteger(i+1)
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else if (json && json.infocode && json.infocode == "10004") {
|
||||
// 开发者的单位时间内(1分钟)访问量超限,被系统自动封停,下一分钟自动解封。
|
||||
Thread.sleep(60000)
|
||||
break;
|
||||
} else if (json && json.infocode && json.infocode == "10017") {
|
||||
// 所请求的资源不可用
|
||||
System.exit(1)
|
||||
} else {
|
||||
break
|
||||
}
|
||||
@@ -224,6 +237,17 @@ class GaoDeUtils {
|
||||
} catch(Exception ex) {
|
||||
ex.printStackTrace()
|
||||
}
|
||||
} else if (json && json.infocode && json.infocode == "10044") {
|
||||
synchronized (this) {
|
||||
for (int i = 0; i < GAO_DE_AK.size(); i++) {
|
||||
if (GAO_DE_AK[i] == params.key) {
|
||||
if (i + 1 > GAO_DE_AK.size()) {
|
||||
System.exit(1)
|
||||
}
|
||||
keyUsed = new AtomicInteger(i+1)
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (json && json.infocode && json.infocode == "10004") {
|
||||
// 开发者的单位时间内(1分钟)访问量超限,被系统自动封停,下一分钟自动解封。
|
||||
Thread.sleep(60000)
|
||||
@@ -253,6 +277,17 @@ class GaoDeUtils {
|
||||
} catch(Exception ex) {
|
||||
ex.printStackTrace()
|
||||
}
|
||||
} else if (json && json.infocode && json.infocode == "10044") {
|
||||
synchronized (this) {
|
||||
for (int i = 0; i < GAO_DE_AK.size(); i++) {
|
||||
if (GAO_DE_AK[i] == params.key) {
|
||||
if (i + 1 > GAO_DE_AK.size()) {
|
||||
System.exit(1)
|
||||
}
|
||||
keyUsed = new AtomicInteger(i+1)
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (json && json.infocode && json.infocode == "10004") {
|
||||
// 开发者的单位时间内(1分钟)访问量超限,被系统自动封停,下一分钟自动解封。
|
||||
Thread.sleep(60000)
|
||||
@@ -398,7 +433,16 @@ class GaoDeUtils {
|
||||
return ["lng": arrs[0], "lat": arrs[1]]
|
||||
}
|
||||
} else if (json && json.infocode && json.infocode == "10044") {
|
||||
System.exit(1)
|
||||
synchronized (this) {
|
||||
for (int i = 0; i < GAO_DE_AK.size(); i++) {
|
||||
if (GAO_DE_AK[i] == params.key) {
|
||||
if (i + 1 > GAO_DE_AK.size()) {
|
||||
System.exit(1)
|
||||
}
|
||||
keyUsed = new AtomicInteger(i+1)
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (json && json.infocode && json.infocode == "10004") {
|
||||
// 开发者的单位时间内(1分钟)访问量超限,被系统自动封停,下一分钟自动解封。
|
||||
Thread.sleep(60000)
|
||||
|
||||
Reference in New Issue
Block a user