You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by GitBox <gi...@apache.org> on 2022/06/25 02:05:24 UTC

[GitHub] [incubator-seatunnel] iture123 opened a new issue, #2059: [Bug] [seatunnel-connector-seatunnel-fake] Incorrect use ThreadLocalRandom

iture123 opened a new issue, #2059:
URL: https://github.com/apache/incubator-seatunnel/issues/2059

   ### Search before asking
   
   - [X] I had searched in the [issues](https://github.com/apache/incubator-seatunnel/issues?q=is%3Aissue+label%3A%22bug%22) and found no similar issues.
   
   
   ### What happened
   
    
   Error in class org.apache.seatunnel.connectors.seatunnel.fake.source.FakeSourceReader
   ```
       private final Random random = ThreadLocalRandom.current();
   
       public void pollNext(Collector<SeaTunnelRow> output) throws InterruptedException {
           // Generate a random number of rows to emit.
           int size = random.nextInt(10);
       }
   ```
   `int size = random.nextInt(10);`
   The variable size actually is a fixed value, not a random number,because can not share ThreadLocalRandom  in multi-thread.The correct usage is as follows:
   `
   int size = ThreadLocalRandom.current().nextInt(10);
   `
   
   
   
   
   ### SeaTunnel Version
   
   api-draft 2.1.1-SNAPSHOT
   
   ### SeaTunnel Config
   
   ```conf
   FakeSource {
         result_table_name = "fake"
         field_name = "name,age"
       }
   ```
   
   
   ### Running Command
   
   ```shell
   run org.apache.seatunnel.example.flink.SeaTunnelApiExample
   ```
   
   
   ### Error Exception
   
   ```log
   no
   ```
   
   
   ### Flink or Spark Version
   
   _No response_
   
   ### Java or Scala Version
   
   _No response_
   
   ### Screenshots
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
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: commits-unsubscribe@seatunnel.apache.org.apache.org

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


[GitHub] [incubator-seatunnel] Hisoka-X commented on issue #2059: [Bug] [seatunnel-connector-seatunnel-fake] Incorrect use ThreadLocalRandom

Posted by GitBox <gi...@apache.org>.
Hisoka-X commented on issue #2059:
URL: https://github.com/apache/incubator-seatunnel/issues/2059#issuecomment-1169456616

   Close by #2060 


-- 
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: commits-unsubscribe@seatunnel.apache.org

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


[GitHub] [incubator-seatunnel] Hisoka-X closed issue #2059: [Bug] [seatunnel-connector-seatunnel-fake] Incorrect use ThreadLocalRandom

Posted by GitBox <gi...@apache.org>.
Hisoka-X closed issue #2059: [Bug] [seatunnel-connector-seatunnel-fake] Incorrect use ThreadLocalRandom
URL: https://github.com/apache/incubator-seatunnel/issues/2059


-- 
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: commits-unsubscribe@seatunnel.apache.org

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