Lovepreet S (Java Experts) ☁️ (@java_experts) header
Lovepreet S (Java Experts) ☁️ (@java_experts) profile picture

★ Sr Backend Developer | 9+ years Experience ★ Sharing my experience via tweets & threads ★ Explains complex concepts

Punjab
Joined May 2022
Q: How do you share variable in thread life cycle? A: Java ThreadLocal class allows the storage of data that is specific to each thread separately. It is often used to implement thread-specific context or to avoid synchronisation for thread-local data
4
1,093
Replying to @dolapo_47
Lets break the threads together
1
76
What do you think most difficult/complex topic in JAVA ?
7
1
21
3,734
Handle Resource Cleanup with try-with-resources: Use try-with-resources when dealing with resources like as files or database connections to guarantee that resources are automatically closed at the conclusion of the block, limiting the possibility of resource leaks.
1
256
Defensive programming: The approach emphasises anticipating and handling potential errors, exceptional conditions, and unexpected inputs in a proactive manner it includes: -Input Validation -Fail Fast -Assertions -Avoid Magic Numbers -Handle Edge Cases -Graceful Error handling
1
69
Functional Approach: Rather to directly catching and managing exceptions, functional techniques frequently handle error scenarios through higher-order functions such as map, flatMap, and fold. the `divide` function returns an `Optional<Integer>` instead of throwing an exception
1
62
6 Effective error handling in Java: Discover the best practices and strategies to ensure smooth sailing in our Java applications! 🚀🔍
2
2
1
7
1,330
Coding Paradigms: Exploring the Art of Software Development 🚀🎨 #CodingParadigms #SoftwareEngineering Lets learn the type of coding paradigms it helps in - Architectural Decisions - Critical Thinking - Code Optimisations - Future-Proofing
1
4
1,047
5/ Producer-Consumer: Very basic design pattern, but it has the ability to address all use cases in threads. In simple terms there are always producers and consumers visualising application in terms of the producer and consumer paradigms, can help applying this design pattern.
1
6
305
4/Thread-Safe Singleton: use Singleton Pattern to manage global resources without having to worry about race situations. Make sure your singleton objects are only created once and can be safely accessed by several threads
1
3
193
3/Observer Pattern: The Observer Pattern is a behavioural design pattern that builds object-to-object dependencies. It is used to alert each thread about a change in a shared resource so that they can take appropriate action.
1
2
127
2/ Thread Pool: The creation and maintenance of threads is extremely difficult and error prone. Java provides a rich collection of thread pools that address fundamental thread concerns. It solves problems • Avoid costly thread creation • Manage threads and exceptions • Easy
1
2
167
1/ Shared-exclusive lock: Be careful with the resource's readers and writers. Use this pattern to enable several readers but only one writer at a time. In Java, the implementation class for this pattern is ReentrantReadWriteLock.
1
2
218