You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2021/02/23 23:32:36 UTC

[GitHub] [shardingsphere] twillouer opened a new issue #9479: Avoid "toString" for error message

twillouer opened a new issue #9479:
URL: https://github.com/apache/shardingsphere/issues/9479


   ## Feature Request
   
   Less "toString" in some part of job to permit more performance
   
   ### Is your feature request related to a problem?
   
   in code, we can see something like this :
   
   ```java
       @Override
       public Collection<String> doSharding(final Collection<String> availableTargetNames, final Collection<RouteValue> shardingValues, final ConfigurationProperties properties) {
           RouteValue shardingValue = shardingValues.iterator().next();
           if (properties.<Boolean>getValue(ConfigurationPropertyKey.ALLOW_RANGE_QUERY_WITH_INLINE_SHARDING) && shardingValue instanceof RangeRouteValue) {
               return availableTargetNames;
           }
           Preconditions.checkState(shardingValue instanceof ListRouteValue, "Inline strategy cannot support this type sharding:" + shardingValue.toString());
           Collection<String> shardingResult = doSharding((ListRouteValue) shardingValue);
           Collection<String> result = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
           for (String each : shardingResult) {
               if (availableTargetNames.contains(each)) {
                   result.add(each);
               }
           }
           return result;
       }
   ```
   
   ### Describe the feature you would like.
   
   Precondictions.checkState(..., +toString()) will generate the string each time the call is done.
   Something like a lambda or avoid this precondition here can be mode effective
   ![image](https://user-images.githubusercontent.com/2970220/108922632-b2348f80-7637-11eb-8bba-48c12af7992d.png)
   
   


----------------------------------------------------------------
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.

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



[GitHub] [shardingsphere] twillouer closed issue #9479: Avoid "toString" for error message

Posted by GitBox <gi...@apache.org>.
twillouer closed issue #9479:
URL: https://github.com/apache/shardingsphere/issues/9479


   


----------------------------------------------------------------
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.

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



[GitHub] [shardingsphere] twillouer commented on issue #9479: Avoid "toString" for error message

Posted by GitBox <gi...@apache.org>.
twillouer commented on issue #9479:
URL: https://github.com/apache/shardingsphere/issues/9479#issuecomment-784616209


   not the same code in 5.0.0


----------------------------------------------------------------
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.

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