You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2020/10/02 15:14:55 UTC

[shardingsphere-elasticjob] branch master updated: Polish java doc (#1536)

This is an automated email from the ASF dual-hosted git repository.

zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere-elasticjob.git


The following commit(s) were added to refs/heads/master by this push:
     new e932974  Polish java doc (#1536)
e932974 is described below

commit e932974fc3c7283b340787072a6dc4325d219398
Author: Liang Zhang <te...@163.com>
AuthorDate: Fri Oct 2 23:08:21 2020 +0800

    Polish java doc (#1536)
    
    * For code format
    
    * Polish java doc
---
 .../elasticjob/http/executor/HttpJobExecutor.java          | 10 +++++-----
 .../elasticjob/http/props/HttpJobProperties.java           | 14 +++++++-------
 .../infra/listener/ElasticJobListenerFactory.java          |  3 +--
 .../elasticjob/infra/spi/ElasticJobServiceLoader.java      | 14 +++++++-------
 4 files changed, 20 insertions(+), 21 deletions(-)

diff --git a/elasticjob-executor/elasticjob-executor-type/elasticjob-http-executor/src/main/java/org/apache/shardingsphere/elasticjob/http/executor/HttpJobExecutor.java b/elasticjob-executor/elasticjob-executor-type/elasticjob-http-executor/src/main/java/org/apache/shardingsphere/elasticjob/http/executor/HttpJobExecutor.java
index 123cc08..0818654 100644
--- a/elasticjob-executor/elasticjob-executor-type/elasticjob-http-executor/src/main/java/org/apache/shardingsphere/elasticjob/http/executor/HttpJobExecutor.java
+++ b/elasticjob-executor/elasticjob-executor-type/elasticjob-http-executor/src/main/java/org/apache/shardingsphere/elasticjob/http/executor/HttpJobExecutor.java
@@ -74,7 +74,7 @@ public final class HttpJobExecutor implements TypedJobItemExecutor {
             if (isRequestSucceed(code)) {
                 resultInputStream = connection.getInputStream();
             } else {
-                log.warn("Http job {} executed with response code {}", jobConfig.getJobName(), code);
+                log.warn("HTTP job {} executed with response code {}", jobConfig.getJobName(), code);
                 resultInputStream = connection.getErrorStream();
             }
             StringBuilder result = new StringBuilder();
@@ -85,9 +85,9 @@ public final class HttpJobExecutor implements TypedJobItemExecutor {
                 }
             }
             if (isRequestSucceed(code)) {
-                log.debug("http job execute result : {}", result.toString());
+                log.debug("HTTP job execute result : {}", result.toString());
             } else {
-                log.warn("Http job {} executed with response body {}", jobConfig.getJobName(), result.toString());
+                log.warn("HTTP job {} executed with response body {}", jobConfig.getJobName(), result.toString());
             }
         } catch (final IOException ex) {
             throw new JobExecutionException(ex);
@@ -101,11 +101,11 @@ public final class HttpJobExecutor implements TypedJobItemExecutor {
     private HttpParam getHttpParam(final Properties props) {
         String url = props.getProperty(HttpJobProperties.URI_KEY);
         if (Strings.isNullOrEmpty(url)) {
-            throw new JobConfigurationException("Cannot find http url, job is not executed.");
+            throw new JobConfigurationException("Cannot find HTTP URL, job is not executed.");
         }
         String method = props.getProperty(HttpJobProperties.METHOD_KEY);
         if (Strings.isNullOrEmpty(method)) {
-            throw new JobConfigurationException("Cannot find http method, job is not executed.");
+            throw new JobConfigurationException("Cannot find HTTP method, job is not executed.");
         }
         String data = props.getProperty(HttpJobProperties.DATA_KEY);
         int connectTimeout = Integer.parseInt(props.getProperty(HttpJobProperties.CONNECT_TIMEOUT_KEY, "3000"));
diff --git a/elasticjob-executor/elasticjob-executor-type/elasticjob-http-executor/src/main/java/org/apache/shardingsphere/elasticjob/http/props/HttpJobProperties.java b/elasticjob-executor/elasticjob-executor-type/elasticjob-http-executor/src/main/java/org/apache/shardingsphere/elasticjob/http/props/HttpJobProperties.java
index 221e651..49567c2 100644
--- a/elasticjob-executor/elasticjob-executor-type/elasticjob-http-executor/src/main/java/org/apache/shardingsphere/elasticjob/http/props/HttpJobProperties.java
+++ b/elasticjob-executor/elasticjob-executor-type/elasticjob-http-executor/src/main/java/org/apache/shardingsphere/elasticjob/http/props/HttpJobProperties.java
@@ -18,12 +18,12 @@
 package org.apache.shardingsphere.elasticjob.http.props;
 
 /**
- * Http job properties.
+ * HTTP job properties.
  */
 public final class HttpJobProperties {
     
     /**
-     * Http request uri.
+     * HTTP request URI.
      */
     public static final String URI_KEY = "http.uri";
     
@@ -33,27 +33,27 @@ public final class HttpJobProperties {
     public static final String METHOD_KEY = "http.method";
     
     /**
-     * Http request data.
+     * HTTP request data.
      */
     public static final String DATA_KEY = "http.data";
     
     /**
-     * Http connect timeout in milliseconds.
+     * HTTP connect timeout in milliseconds.
      */
     public static final String CONNECT_TIMEOUT_KEY = "http.connect.timeout.milliseconds";
     
     /**
-     * Http read timeout in milliseconds.
+     * HTTP read timeout in milliseconds.
      */
     public static final String READ_TIMEOUT_KEY = "http.read.timeout.milliseconds";
     
     /**
-     * Http content type.
+     * HTTP content type.
      */
     public static final String CONTENT_TYPE_KEY = "http.content.type";
     
     /**
-     * Http sharding context.
+     * HTTP sharding context.
      */
     public static final String SHARDING_CONTEXT_KEY = "shardingContext";
 }
diff --git a/elasticjob-infra/elasticjob-infra-common/src/main/java/org/apache/shardingsphere/elasticjob/infra/listener/ElasticJobListenerFactory.java b/elasticjob-infra/elasticjob-infra-common/src/main/java/org/apache/shardingsphere/elasticjob/infra/listener/ElasticJobListenerFactory.java
index c5f7cfc..93f9a04 100644
--- a/elasticjob-infra/elasticjob-infra-common/src/main/java/org/apache/shardingsphere/elasticjob/infra/listener/ElasticJobListenerFactory.java
+++ b/elasticjob-infra/elasticjob-infra-common/src/main/java/org/apache/shardingsphere/elasticjob/infra/listener/ElasticJobListenerFactory.java
@@ -40,7 +40,6 @@ public final class ElasticJobListenerFactory {
      * @return optional job listener instance
      */
     public static Optional<ElasticJobListener> createListener(final String type) {
-        return ElasticJobServiceLoader.newServiceInstances(ElasticJobListener.class)
-                .stream().filter(listener -> listener.getType().equalsIgnoreCase(type)).findFirst();
+        return ElasticJobServiceLoader.newServiceInstances(ElasticJobListener.class).stream().filter(listener -> listener.getType().equalsIgnoreCase(type)).findFirst();
     }
 }
diff --git a/elasticjob-infra/elasticjob-infra-common/src/main/java/org/apache/shardingsphere/elasticjob/infra/spi/ElasticJobServiceLoader.java b/elasticjob-infra/elasticjob-infra-common/src/main/java/org/apache/shardingsphere/elasticjob/infra/spi/ElasticJobServiceLoader.java
index a7e9e6f..78024f7 100644
--- a/elasticjob-infra/elasticjob-infra-common/src/main/java/org/apache/shardingsphere/elasticjob/infra/spi/ElasticJobServiceLoader.java
+++ b/elasticjob-infra/elasticjob-infra-common/src/main/java/org/apache/shardingsphere/elasticjob/infra/spi/ElasticJobServiceLoader.java
@@ -36,35 +36,35 @@ import java.util.stream.Collectors;
 @NoArgsConstructor(access = AccessLevel.PRIVATE)
 public final class ElasticJobServiceLoader {
     
-    private static final ConcurrentMap<Class<?>, Collection<Class<?>>> SERVICE_MAP = new ConcurrentHashMap<>();
+    private static final ConcurrentMap<Class<?>, Collection<Class<?>>> SERVICES = new ConcurrentHashMap<>();
     
     /**
-     * Register SPI service into map for new instance.
+     * Register SPI service.
      *
      * @param service service type
-     * @param <T>     type of service
+     * @param <T> type of service
      */
     public static <T> void register(final Class<T> service) {
-        if (SERVICE_MAP.containsKey(service)) {
+        if (SERVICES.containsKey(service)) {
             return;
         }
         ServiceLoader.load(service).forEach(each -> registerServiceClass(service, each));
     }
     
     private static <T> void registerServiceClass(final Class<T> service, final T instance) {
-        SERVICE_MAP.computeIfAbsent(service, unused -> new LinkedHashSet<>()).add(instance.getClass());
+        SERVICES.computeIfAbsent(service, unused -> new LinkedHashSet<>()).add(instance.getClass());
     }
     
     /**
      * New service instances.
      *
      * @param service service class
-     * @param <T>     type of service
+     * @param <T> type of service
      * @return service instances
      */
     @SuppressWarnings("unchecked")
     public static <T> Collection<T> newServiceInstances(final Class<T> service) {
-        return SERVICE_MAP.containsKey(service) ? SERVICE_MAP.get(service).stream().map(each -> (T) newServiceInstance(each)).collect(Collectors.toList()) : Collections.emptyList();
+        return SERVICES.containsKey(service) ? SERVICES.get(service).stream().map(each -> (T) newServiceInstance(each)).collect(Collectors.toList()) : Collections.emptyList();
     }
     
     private static Object newServiceInstance(final Class<?> clazz) {