java单独开子线程,不等待操作结束直接返回调用成功


    @Override
    public Result tow() {
    
    
        Thread thread = new Thread(() -> {
    
    //里边写需要的操作。return之后也不停止运行,直到结束
            while (1 == 1) {
    
    
                System.out.println(1);
            }
        });
        thread.start();
        return new Result();
    }

猜你喜欢

转载自blog.csdn.net/weixin_43329956/article/details/120833437
今日推荐