我想从mysql数据库生成模型类,但我找不到容易在IDEA 14中搜索的持久性工具窗口.
我想在特定时间段内获取 date_histogram,如何限制日期时间段?我应该使用extended_bounds 参数吗?例如:我想查询'2016-08-01'和'2016-08-31'之间的date_histogram,间隔为天。我用这个表达式查询:
{
"aggs": {
"cf_loan": {
"date_histogram": {
"field": "createDate",
"interval": "day",
"format": "yyyy-MM-dd",
"min_doc_count": 0,
"extended_bounds": {
"min": "2016-08-01",
"max": "2016-08-31"
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
但是我得到的 date_histogram 不在范围内。
这是我的主要方法:
public static void main(String[] args) {
BasicCookieStore cookieStore = null;
HttpResponse httpResponse = null;
HttpClient httpClient = HttpClients.createDefault();
while (true) {
HttpUriRequest request = new HttpGet("http://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/org/apache/http/impl/client/HttpClientBuilder.html");
try {
httpResponse = httpClient.execute(request);
System.out.println(httpResponse.getStatusLine().getStatusCode());
} catch (Exception e) {
System.out.println(httpResponse.getStatusLine().getStatusCode());
e.printStackTrace();
}
}
}
Run Code Online (Sandbox Code Playgroud)
执行2次后,HttpClient停止执行相同的HttpGet.虽然,我在循环中实例化一个新的HttpClient,但它不会停止.如果有什么策略阻止HttpClient执行相同的HttpGet方法超过2次,我会徘徊?谁能帮助我,我将非常感激!
我想知道在第一个线程的run方法中中断另一个线程是否违法.如果是,当我在第一个线程的run方法中调用另一个线程的中断方法时,会抛出"InterruptedException"吗?像这样:
public static void main(String[] args) {
Thread thread1 = new Thread(() -> {
while (true) {
}
}, "thread1");
try {
thread1.sleep(10000);
} catch (InterruptedException e) {
System.out.println("Oops! I'm interrupted!");
}
Thread thread2 = new Thread(() -> {
System.out.println("I will interrupt thread1!");
thread1.interrupt();
System.out.println("Thread1 interruption done!");
}, "thread2");
thread1.start();
thread2.start();
}
Run Code Online (Sandbox Code Playgroud)
但我没有留言"哎呀!我被打断了!" 在控制台中.
我在JDK中看到Integer.MIN_VALUE是0x80000000.考虑到原始是0x80000000,那么相反的是0x8fffffff,最后补码是0x8fffffff +( - 1)= -2 ^ 32?那么-2 ^ 32是否是1000 0000 0000 0000 0000 0000 0000 0000 in bit?