Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support to display multithreaded links #7656

Closed
wants to merge 0 commits into from
Closed

Support to display multithreaded links #7656

wants to merge 0 commits into from

Conversation

zhangyinhao1234
Copy link
Contributor

@zhangyinhao1234 zhangyinhao1234 commented Feb 9, 2021

Refer to the implementation of spring's async. We use our own runable and thread pool to realize the display of multithreaded links. This code has been developed and run on version 1.8.3, and has been running stably for one year.

example:

<dependency> <groupId>com.navercorp.pinpoint</groupId> <artifactId>pinpoint-java-sdk</artifactId> <version>2.3-SNAPSHOT</version> </dependency>

`

private ThreadPoolExecutor triggerPool = new AsyncThreadPoolExecutor(
32,
256,
60L,
TimeUnit.SECONDS,
new LinkedBlockingQueue(1000));

@GetMapping("/hello1")
public String test11(String name) throws InterruptedException {
    String hello = helloService.hello();
    triggerPool.execute(new AsyncRun() {
        @Override
        public Object asyncRun() {
            String pp = helloService.hello2(name, "PP");
            return pp;
        }
    }.getRunnable());
    return hello;
}


@GetMapping("/hello2")
public String test12(String name) throws InterruptedException, ExecutionException {
    String hello = helloService.hello();
    Future pp = triggerPool.submit(new AsyncRun() {
        @Override
        public Object asyncRun() {
            String pp = helloService.hello2(name, "PP");
            return pp;
        }
    }.getCallable());
    return hello;
}

`

image

image

@zhangyinhao1234
Copy link
Contributor Author

CI error so create new to master
#7649

@emeroad emeroad closed this Mar 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants