You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@eventmesh.apache.org by GitBox <gi...@apache.org> on 2021/08/24 16:54:52 UTC

[GitHub] [incubator-eventmesh] tydhot opened a new pull request #510: [ISSUE #505]remove all RandomStringUtils.

tydhot opened a new pull request #510:
URL: https://github.com/apache/incubator-eventmesh/pull/510


   <!--
   ### Contribution Checklist
   
     - Name the pull request in the form "[ISSUE #XXXX] Title of the pull request", 
       where *XXXX* should be replaced by the actual issue number.
       Skip *[ISSUE #XXXX]* if there is no associated github issue for this pull request.
   
     - Fill out the template below to describe the changes contributed by the pull request. 
       That will give reviewers the context they need to do the review.
     
     - Each pull request should address only one issue. 
       Please do not mix up code from multiple issues.
     
     - Each commit in the pull request should have a meaningful commit message.
   
     - Once all items of the checklist are addressed, remove the above text and this checklist, 
       leaving only the filled out template below.
   
   (The sections below can be removed for hotfixes of typos)
   -->
   
   <!--
   (If this PR fixes a GitHub issue, please add `Fixes ISSUE#<XXX>`.)
   -->
   
   Fixes ISSUE#<XXXX>.
   
   ### Motivation
   
   *Explain the content here.*
   *Explain why you want to make the changes and what problem you're trying to solve.*
   
   
   
   ### Modifications
   
   *Describe the modifications you've done.*
   
   
   
   ### Documentation
   
   - Does this pull request introduce a new feature? (yes / no)
   - If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)
   - If a feature is not applicable for documentation, explain why?
   - If a feature is not documented yet in this PR, please create a followup issue for adding the documentation
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] tydhot commented on a change in pull request #510: [ISSUE #505]remove all RandomStringUtils.

Posted by GitBox <gi...@apache.org>.
tydhot commented on a change in pull request #510:
URL: https://github.com/apache/incubator-eventmesh/pull/510#discussion_r695436853



##########
File path: eventmesh-sdk-java/src/test/java/org/apache/eventmesh/client/http/demo/AsyncPublishInstance.java
##########
@@ -32,6 +32,9 @@
 
     public static Logger logger = LoggerFactory.getLogger(AsyncPublishInstance.class);
 
+    private final static RandomStringGenerator randomGenerator = new RandomStringGenerator.Builder()

Review comment:
       yes, a util is better
   




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] ruanwenjun commented on a change in pull request #510: [ISSUE #505]remove all RandomStringUtils.

Posted by GitBox <gi...@apache.org>.
ruanwenjun commented on a change in pull request #510:
URL: https://github.com/apache/incubator-eventmesh/pull/510#discussion_r695399598



##########
File path: eventmesh-sdk-java/src/test/java/org/apache/eventmesh/client/http/demo/AsyncPublishInstance.java
##########
@@ -32,6 +32,9 @@
 
     public static Logger logger = LoggerFactory.getLogger(AsyncPublishInstance.class);
 
+    private final static RandomStringGenerator randomGenerator = new RandomStringGenerator.Builder()

Review comment:
       It seems RandomStringGenerator is thread safe, so we can just hold one instance in our application.
   Can we add a new utils or factory to Wrapper RandomStringGenerator.
   ```java
   public class InnerStringUtils {
   
   	/**
   	 *  generate random number string
   	 * @param length string length
   	 * @return
   	 */
   	public static String generateRandomNumber(int length) {
   		return RandomStringGeneratorHolder.instance.generate(length);
   	}
   
   	public static class RandomStringGeneratorHolder() {
   		private static RandomStringGenerator instance = new RandomStringGenerator.Builder()
   				.withinRange('0', '9').build();
   	}
   
   }
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] xwm1992 merged pull request #510: [ISSUE #505]remove all RandomStringUtils.

Posted by GitBox <gi...@apache.org>.
xwm1992 merged pull request #510:
URL: https://github.com/apache/incubator-eventmesh/pull/510


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] ruanwenjun commented on a change in pull request #510: [ISSUE #505]remove all RandomStringUtils.

Posted by GitBox <gi...@apache.org>.
ruanwenjun commented on a change in pull request #510:
URL: https://github.com/apache/incubator-eventmesh/pull/510#discussion_r695399598



##########
File path: eventmesh-sdk-java/src/test/java/org/apache/eventmesh/client/http/demo/AsyncPublishInstance.java
##########
@@ -32,6 +32,9 @@
 
     public static Logger logger = LoggerFactory.getLogger(AsyncPublishInstance.class);
 
+    private final static RandomStringGenerator randomGenerator = new RandomStringGenerator.Builder()

Review comment:
       It seems RandomStringGenerator is thread safe, so we can just hold one instance in our application.
   Can we add a new utils or factory to Wrapper RandomStringGenerator.
   ```java
   public class InnerStringUtils {
           private static RandomStringGenerator randomStringGenerator = new RandomStringGenerator.Builder()
   				.withinRange('0', '9').build();
   
   	/**
   	 *  generate random number string
   	 * @param length string length
   	 * @return
   	 */
   	public static String generateRandomNumber(int length) {
   		return randomStringGenerator.generate(length);
   	}
   
   }
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org