Promotion
CodeGym University
Learning
Course
Tasks
Surveys & Quizzes
Games
Help
Schedule
Community
Users
Forum
Chat
Articles
Success stories
Activity
Reviews
Subscriptions
Light theme
Lessons
Reviews
About us
Start
Start learning
Start learning now
Quest map
Lessons
Level 1
Exit conditions. StackOverflowError
All lectures for EN purposes
Level 1,
Lesson 60
Let's take another look at a recursive problem. As an example, consider calculating Fibonacci numbers. Everybody will recall that the Fibonacci sequence is a numerical sequence...
Additional lessons for the level
All lectures for EN purposes
Level 1,
Lesson 61
In programming, recursion initially scares many people. But the fact is that you just need to sit down and dig into it properly, and then solidify what you've learned through practice. You will benefit from this...
Additional lessons for the level
All lectures for EN purposes
Level 1,
Lesson 62
Previously, when we studied class methods, we usually just wrote something like: "method name" -> "what the method does". We can't do that for methods of the Thread class :) They have more complex logic...
Factory method pattern
All lectures for EN purposes
Level 1,
Lesson 63
At this point, you've probably already encountered design patterns. For example, singleton. Let's recall what patterns are, why they are needed, and what creational patterns are (singleton is an example)...
Callable and Future
All lectures for EN purposes
Level 1,
Lesson 64
You are already familiar with the Runnable interface and the Thread class that implements it. Let's recall what this interface looks like...
ExecutorService interface
All lectures for EN purposes
Level 1,
Lesson 65
Prior to Java 5, you had to write all your own code thread management in your application. In addition, creating a new Thread object is a resource-intensive operation, and it doesn't make sense to create a new thread for every lightweight task. And because this problem...
Stopping an ExecutorService
All lectures for EN purposes
Level 1,
Lesson 66
Consider a simple program...
ThreadPoolExecutor
All lectures for EN purposes
Level 1,
Lesson 67
When developing a multi-threaded application, we must usually deal with organizing the work of threads. The larger our application and the more threads we need for multithreaded tasks, the more Runnable objects we create...
newSingleThreadExecutor method
All lectures for EN purposes
Level 1,
Lesson 68
You can use the Executors.newSingleThreadExecutor method to create an ExecutorService with a pool that includes a single thread. The pool's logic is as follows: The service executes only one task at a time. If we submit N tasks...
newFixedThreadPool method
All lectures for EN purposes
Level 1,
Lesson 69
The newFixedThreadPool method of the Executors class creates an executorService with a fixed number of threads. Unlike the newSingleThreadExecutor method, we specify how many threads we want in the pool. Under the hood, the following code is called...
newCachedThreadPool method
All lectures for EN purposes
Level 1,
Lesson 70
Another type of thread pool is "cached". Such thread pools are just as commonly used as fixed ones. As indicated by the name, this kind of thread pool caches threads. It keeps unused threads alive...
newWorkStealingPool method
All lectures for EN purposes
Level 1,
Lesson 71
Let's figure out the newWorkStealingPool method, which prepares a ExecutorService for us. This thread pool is special. Its behavior is based on the idea of...
Show more
1
...
4
5
6
7
8
...
98
Please enable JavaScript to continue using this application.