How To Use Threads In Java

Today, I want to talk about threads in Angular. Sometimes our services takes much longer time than we expected. And the service could get time out error. We must use services with threads in order to prevent from time out errors.

Let’s start with writing our web service with a thread. As you see below, our service works first and give a quick response and thread runs in background.

Now we can write the front end side code with angular. Firstly we will define our services in the ts.

Then we will use service methods in our component ts file.

Then we call the service in the component ts code. We will renew page per 1 second and control the service status 60 seconds time interval. That’s so easy and fast coding. If you have any questions about this post or any other subjects just mail to me.

1 Response

  1. V says:

    Smart logic, thank you!

Leave a Reply

Your email address will not be published. Required fields are marked *