Fundamentals 11 min read

Java Fundamentals: Spring Lifecycle, TCP Handshake, Thread Pool, JVM Memory, JMM, Spring MVC, JDBC, Spring Cloud, and Dubbo Overview

This article provides a comprehensive overview of core Java concepts and related technologies, covering Spring's lifecycle, TCP three-way handshake and four-way termination, thread pool execution flow, JVM memory structure and Java Memory Model, as well as Spring MVC, JDBC, Spring Cloud components, and Dubbo service framework.

Java Captain
Java Captain
Java Captain
Java Fundamentals: Spring Lifecycle, TCP Handshake, Thread Pool, JVM Memory, JMM, Spring MVC, JDBC, Spring Cloud, and Dubbo Overview

1. Spring Lifecycle

Spring, as the most popular lightweight container framework in Java, requires understanding its bean lifecycle, including container startup, bean initialization, property injection, Aware interface processing, BeanPostProcessor pre- and post-processing, custom init methods, and destruction callbacks.

2. TCP Three-Way Handshake and Four-Way Termination

The three-way handshake establishes a TCP connection through SYN, SYN‑ACK, and ACK exchanges, moving client and server to the ESTABLISHED state.

The four-way termination involves FIN and ACK exchanges (FIN‑WAIT‑1, CLOSE‑WAIT, LAST‑ACK, TIME‑WAIT) to gracefully close the connection.

3. Thread Pool Execution Flow

When a task is submitted, the pool creates a core thread if the current core count is below corePoolSize . If core threads are full, the task is queued in workQueue . When the queue is also full, non‑core threads are created up to maximumPoolSize . If the maximum is reached, the task is handled by a rejection policy.

The JDK provides four rejection policies: AbortPolicy , DiscardPolicy , DiscardOldestPolicy , and CallerRunsPolicy .

4. JVM Memory Structure

The JVM memory is divided into several runtime data areas: Program Counter (PC) register, Java Virtual Machine Stack, Native Method Stack, Java Heap, Method Area (including the runtime constant pool), and others.

The heap is the largest memory region, shared among threads, configurable via -Xms and -Xmx , and divided into young and old generations.

5. Java Memory Model (JMM)

JMM defines how multiple threads interact through shared memory, addressing visibility, atomicity, and ordering issues. It separates main memory and each thread's working memory, requiring synchronization actions to transfer data between them.

6. Spring MVC Execution Flow

User sends a request; DispatcherServlet intercepts it.

HandlerMapping resolves the appropriate handler.

HandlerAdapter is selected.

Request data is bound to handler method parameters.

Handler (controller) returns a ModelAndView .

ViewResolver selects a view.

View renders the response and returns it to the client.

7. JDBC Execution Process

Establish a connection to the data source.

Send SQL queries or updates.

Process the database response and return results.

8. Spring Cloud Component Architecture

Spring Cloud, built on Spring Boot, provides cloud‑native solutions such as service registration (Eureka), circuit breaking (Hystrix), configuration management (Config Server), API gateway (Zuul), distributed tracing (Sleuth + Zipkin), client‑side load balancing (Ribbon), and declarative REST clients (Feign).

9. Dubbo Invocation Model

Dubbo is a high‑performance RPC framework consisting of Provider (service exporter), Consumer (service caller), Registry (service discovery), Monitor (call statistics), and Container (runtime environment).

10. Future Updates

(Content to be added later.)

(End)

JavajvmDubbospringThreadPoolTCPSpringCloud
Java Captain
Written by

Java Captain

Focused on Java technologies: SSM, the Spring ecosystem, microservices, MySQL, MyCat, clustering, distributed systems, middleware, Linux, networking, multithreading; occasionally covers DevOps tools like Jenkins, Nexus, Docker, ELK; shares practical tech insights and is dedicated to full‑stack Java development.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.