很多时候写功能或者接口需要进行压力测试,
今天发现jwt在生成token的时候,如果输入都是一样的
仅有一个签发时间不一样,生成的token是有可能是一样的
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| public void testCreate() { ThreadFactory namedThreadFactory = new ThreadFactoryBuilder().setNameFormat("hisenyuan").build(); ExecutorService pool = new ThreadPoolExecutor( 20, 50, 10000L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(10240), namedThreadFactory, new ThreadPoolExecutor.AbortPolicy()); for (int i = 0; i < 50; i++) { pool.execute(this::createTokenTest); } pool.shutdown(); try { while (!pool.awaitTermination(500, TimeUnit.MILLISECONDS)) { LOGGER.debug("Waiting for terminate"); } } catch (InterruptedException e) { LOGGER.error(e); } }
|