format code

pull/451/head
maxisvest 3 years ago
parent a54a4464ae
commit 5f82214b2b

@ -28,9 +28,9 @@ import java.util.function.Supplier;
*/
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class Singleton {
private static final ConcurrentHashMap<String, Object> SINGLE_OBJECT_POOL = new ConcurrentHashMap();
/**
* Get a singleton object by key.
*
@ -42,7 +42,7 @@ public final class Singleton {
Object result = SINGLE_OBJECT_POOL.get(key);
return result == null ? null : (T) result;
}
/**
* Get a singleton object by key.
*
@ -60,7 +60,7 @@ public final class Singleton {
}
return result != null ? (T) result : null;
}
/**
* Object into container.
*
@ -69,7 +69,7 @@ public final class Singleton {
public static void put(Object value) {
put(value.getClass().getName(), value);
}
/**
* Object into container.
*

@ -1,3 +1,20 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.hippo4j.monitor.es;
import cn.hippo4j.common.config.ApplicationContextHolder;

@ -66,7 +66,7 @@ public class EsMonitorHandler extends AbstractDynamicThreadPoolMonitor {
if (!this.isExists(indexName)) {
List<String> rawMapping = FileUtil.readLines(new File(Thread.currentThread().getContextClassLoader().getResource("mapping.json").getPath()), StandardCharsets.UTF_8);
String mapping = String.join(" ", rawMapping);
//if index doesn't exsit, this function may try to create one, but recommend to create index manually.
// if index doesn't exsit, this function may try to create one, but recommend to create index manually.
this.createIndex(indexName, "_doc", mapping, null, null, null);
}
@ -96,7 +96,7 @@ public class EsMonitorHandler extends AbstractDynamicThreadPoolMonitor {
}
public synchronized boolean isExists(String index) {
//cache check result
// cache check result
if (Objects.isNull(isIndexExist)) {
boolean exists = false;
GetIndexRequest request = new GetIndexRequest();
@ -121,8 +121,8 @@ public class EsMonitorHandler extends AbstractDynamicThreadPoolMonitor {
}
if (!Objects.isNull(shards) && !Objects.isNull(replicas)) {
request.settings(Settings.builder()
.put("index.number_of_shards", shards) //5
.put("index.number_of_replicas", replicas));//1
.put("index.number_of_shards", shards) // 5
.put("index.number_of_replicas", replicas));// 1
}
if (StringUtils.hasText(alias)) {
request.alias(new Alias(alias));

@ -1,3 +1,20 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.hippo4j.monitor.es.model;
import cn.hippo4j.common.model.ThreadPoolRunStateInfo;
@ -10,7 +27,7 @@ import lombok.Setter;
*/
@Getter
@Setter
public class EsThreadPoolRunStateInfo extends ThreadPoolRunStateInfo{
public class EsThreadPoolRunStateInfo extends ThreadPoolRunStateInfo {
private String Id;

Loading…
Cancel
Save