Skip to main content

Tech Conversant Weekly May 08 - May 20

Topic: General                                                                                                                Level: All

Welcome to the world of cutting-edge technology! Every bi-week, we bring you the latest and most incredible advancements in the tech industry that are sure to leave you feeling inspired and empowered.

Stay ahead of the game and be the first to know about the newest innovations shaping our world. Discover new ways to improve your daily life, become more efficient, and enjoy new experiences.

This time, we've got some exciting news to share with you!

Persisting a collection like List in JPA is attained in two following ways,
1. ElementCollection annotation - specifying CollectionTable annotation with the column onto which the OneToMany relationship has to be established 
2. AttributeConverter Implementation - override the convertToDatabaseColumn and convertToEntityAttribute for persisting and retrieval of the collection values, and annotating the entity class member variable with Convert annotation specifying the converter
The deviation arises from how each of these fetches (EAGER/LAZY) the corresponding collection, capacity size and length, and extra entity creation

Situations to name a few and not restricted to which,
1. Not properly closing a DB connection 
2. Not handling file I/O adequately 
3. Managing the thread lifecycle 
4. Retaining references to unused objects 
This could lead to memory leaks and the application eats away the CPU resources, by placing a few checks we offer insights on behavior and can help to prevent/debug the existential issues and mitigate cascading failures in memory management.
1. Logging the state of data as it flows through the application 
2. JConsole profiler to plot a graph on heap memory usage 
3. Logging GC information and scrutinizing the memory growth rate 
4. Heap dump to visualize the object instances depleting more memory

Nesting lambda behavior could alter the way how the lambda definitions are evaluated as they are unwrapped during execution.
... In a Java method call, the arguments to a method invocation are always evaluated before the method is actually called. 
However, the value of a lambda is an object that contains the method the lambda describes. 
Java does not execute that method in constructing that object, and that means that when a lambda is passed as an argument, the method represented by the lambda has not been executed prior to the actual invocation of the method to which the lambda is being passed...
This is in turn a design for lazy execution and terms as thunk design - a block of code that is wrapped in a thunk before being passed into an as-yet-unexecuted method. This is typically described as passing parameters by name.
An interesting use case to contemplate.

The benefits of using Virtual Threads in WebLogic Application Servers are thread concurrency management and improved throughput for request/response thus alleviating the performance bottleneck in the Jakarta EE applications.
Check out to learn more about the current state of platform threads and the future state of Virtual threads in the Weblogic servers.

Ensuring atomicity in the sequence of operations by uniting the processes in the same local transactions would cause cascading rollbacks on failures rather than partial data commits in intermediate states.
Transactionally staging the processes in DB and executing them in the same local transaction that performed the originating sequence is a design of the Outbox pattern or the Transactional outbox.
An engaging usecase of custom library db-scheduler that runs on the staged task ensuring atomicity on transactions 

Spring 6 employs virtual threads on ApacheTomcat the default application server on the Boot framework replacing the single thread per request design with multiple virtual threads handling the servlet request.
The key pointer here is the configuration class specifying the Beans AsyncTaskExecutor - TaskExecutorAdapter and TomcatProtocolHandlerCustomizer<?> defining the executors to use
Executors.newVirtualThreadPerTaskExecutor()
https://www.baeldung.com/spring-6-virtual-threads

Generating the primary key id for an entity with Hibernate 5 implementation of SequenceGenerator creates a global id sequence of continuous ids used across multiple entities. From Hibernate 6 onwards, the sequences are created per table on request with allocation size, and if you want to fallback to the older implementation of the sequences then the id column should be annotated with SequenceGenerator taking in the allocationSize 
https://vladmihalcea.com/hibernate-default-entity-sequence/

Java 8 introduced CompletableFuture on the Concurrent API, which is an implementation of the Future interface - performs blocking get on the current thread to retrieve the results and 
the CompletionStage interface - provides chaining action tasks to be performed in succession, and together we have a chain of multiple computations that can run concurrently. This functionality allows us to create a chain of tasks where the next task is triggered when the current task is completed without blocking the current thread.
1. supplyAsync()
2. thenApply()
3. thenCompose()
4. allOf()
With the above methods operating in a non-blocking way returning CompletableFuture for piping the tasks.
However, invoking get and join blocks the current thread on CompletableFuture, which can be used with vigilance by checking with isDone() before obtaining the results 

Jakarta REST API provides custom data type format implementation for request body and response content-type, by implementing the interfaces for reader and writer as MessageBodyReader and MessageBodyWriter respectively and overriding the definition for readFrom and writeTo methods handling the data format conversion (here it is YAML)
The custom reader and writer implementations are Provider annotated such that mapping happens at runtime REST call with Produces and Consumes annotation decorated as application/x-yaml

CyclicBarrier is a threshold point, on which all the incoming threads are made to wait until the threshold is met.
Coupling the CyclicBarrier with an ExecutorService managing the thread pool and its lifecycle by specifying the number of threads to be allocated creates a grouping construct on thread execution and dispatch.
Having less number of threads in the pool with a higher threshold on the barrier would eventually put the threads in a wait/blocked state, with no available threads to meet the barrier release

Connecting to DB from the application code and the diverse available possibilities

Evaluating the SQL order of execution with an ExecutionPlan offers insights into the query performance and room for improvement/optimization

Coordinate Restore at Checkpoint (CRaC) for speeding up the application startup on JVM

Disclaimer: 
This is a personal blog. Any views or opinions represented in this blog are personal and belong solely to the blog owner and do not represent those of people, institutions or organizations that the owner may or may not be associated with in a professional or personal capacity, unless explicitly stated. Any views or opinions are not intended to malign any religion, ethnic group, club, organization, company, or individual. All content provided on this blog is for informational purposes only. The owner of this blog makes no representations as to the accuracy or completeness of any information on this site or found by following any link on this site. The owner will not be liable for any errors or omissions in this information nor for the availability of this information. The owner will not be liable for any losses, injuries, or damages from the display or use of this information.
Downloadable Files and ImagesAny downloadable file, including but not limited to pdfs, docs, jpegs, pngs, is provided at the user’s own risk. The owner will not be liable for any losses, injuries, or damages resulting from a corrupted or damaged file.
  • Comments are welcome. However, the blog owner reserves the right to edit or delete any comments submitted to this blog without notice due to :
  • Comments deemed to be spam or questionable spam.
  • Comments including profanity.
  • Comments containing language or concepts that could be deemed offensive.
  • Comments containing hate speech, credible threats, or direct attacks on an individual or group.
The blog owner is not responsible for the content in the comments. This blog disclaimer is subject to change at any time.

Comments

Popular posts from this blog

Tech Conversant Weekly Jul 03 - Jul 15

Topic: General                                                                                                                                              Level: All Welcome to the world of cutting-edge technology! Every bi-week, we bring you the latest and most incredible advancements in the tech industry that are sure to leave you feeling inspired and empowered. Stay ahead of the game and be the first to know about the newest innovations shaping our world. Discover new ways to improve your daily life, become more efficient, and enjoy new experiences. This time, we've got some exciting news to share with you! Boosting Java startup with Class Data Sharing (CDS) https://www.youtube.com/watch?v=vvlQv1Dh-HU JDK21 LTS Maintenance and Support https://www.youtube.com/watch?v=3bfR22iv8Pc Health checking of multiple cloud applications with Spring Cloud Gateway https://spring.io/blog/2023/07/05/active-health-check-strategies-with-spring-cloud-gateway Functional Style Non-reactive HTTP clie

Tech Conversant Weekly Jun 19 - Jul 01

Topic: General                                                                                                                                              Level: All Welcome to the world of cutting-edge technology! Every bi-week, we bring you the latest and most incredible advancements in the tech industry that are sure to leave you feeling inspired and empowered. Stay ahead of the game and be the first to know about the newest innovations shaping our world. Discover new ways to improve your daily life, become more efficient, and enjoy new experiences. This time, we've got some exciting news to share with you! Modelling common behaviors between the List and the Set interface has been partially provided by LinkedHashSet. Now from JDK21 with the new interface SequencedCollection extending the Collection interface and is also extended by the List, SortedSet via SequencedSet (for reversal operation), Deque. The SequencedMap interface extends the Map interface by providing the below me

Microservices - Design Patterns

Topic: Software Design                                                                                                        Level: Intermediate Microservices - What? Microservice is a software design methodology, delegated to perform an isolated decoupled single functionality (following the Single-Responsibility Principle from object-oriented SOLID design principles).  Moreover, microservices by design, are decoupled making it easy to develop, test, maintain, deploy, configure, monitor and scale modules independently. Microservices - Why? Having one microservice would not be helpful without it being able to interact with other microservices, to aid in bringing an end-to-end business solution. So arises a question, how can I design a software system that is resilient, decentralized, fault-tolerant, scalable, maintainable, and extensible that complies with the microservice architecture? Design Patterns - What? Design patterns are solutions for commonly occurring problems within a given