TAG
Java
229 notes
- Exceptionhistorical
Java's exception hierarchy distinguishes Error from Exception, with checked and unchecked exceptions. These notes organize their meaning and handling.
- How to Handle Exceptions Elegantlyhistorical
Exception-handling wrappers can obscure business logic. These notes compare template-method and interface approaches for separating business code from error handling.
- BloomFilterhistorical
These notes begin with Guava BloomFilter usage and trace construction, writes, and lookups through hashing and bit-array operations.
- How Lombok Workshistorical
Lombok generates code through annotation processing during javac compilation. These notes examine how that process works.
- Introductionhistorical
JDBC embeds SQL in Java, while Hibernate's object mapping involves flexibility trade-offs. These notes introduce MyBatis through those issues.
- Spring Cloudhistorical
Spring Cloud provides microservice components on top of Spring Boot. These notes organize gateways, discovery, configuration, monitoring, load balancing, and circuit breaking.
- Spring Boothistorical
Spring Boot builds on Spring with auto-configuration for starting projects quickly. These notes connect usage with related auto-configuration topics.
- 2.7 Introductionhistorical
Spring MVC uses DispatcherServlet as its entry point, with HandlerMapping, HandlerAdapter, and ViewResolver handling requests and views.
- RateLimiterhistorical
Guava RateLimiter provides a rate-limiting utility based on the token-bucket approach. These notes begin with usage and continue into its implementation.
- Usagehistorical
JDBC properties, MyBatis configuration, and mapper files demonstrate the basic integration of MyBatis into a project.
- 2.10 Spring Moduleshistorical
Spring Framework consists of multiple modules, with its core layer providing container capabilities. These notes organize responsibilities by module.
- 2.12 Usagehistorical
These notes start with dependencies and web.xml to demonstrate Spring MVC setup and how DispatcherServlet connects to framework configuration.
- MyBatis Source Analysishistorical
MyBatis can add interceptors through dynamic proxies when creating core objects. These notes trace the plugin mechanism through its four main objects.
- Spring MVC Source Analysishistorical
Controller breakpoints reveal the request call stack, which these notes follow through HttpServlet, FrameworkServlet, and DispatcherServlet.
- Thread Safetyhistorical
Mutable instance fields in singleton Spring MVC objects can cause problems under concurrent updates. These notes examine thread-safety approaches through that case.
- Usagehistorical
Server and client examples demonstrate basic Netty usage, including startup and request handling.
- Netty 3.x Source Analysishistorical
Netty 3.x creates thread pools and initializes Boss and Worker components. These notes trace its networking implementation through thread organization.
- 2.20 Apollohistorical
Apollo centrally manages configuration and stores changes in a database. These notes examine how clients obtain changes after publication.
- Eurekahistorical
Eureka provides service registration and discovery through a client-server architecture. These notes examine how registrations are stored and maintained.
- Feignhistorical
Feign invokes remote interfaces. These notes examine declarative calls through annotations, Ribbon, RestTemplate, and related components.
- Gatewayhistorical
Spring Cloud Gateway processes requests through routes, predicates, and filters. These notes begin with Route composition and examine matching and forwarding.
- Hystrixhistorical
Hystrix provides fault tolerance for microservice calls. These notes start with failure propagation and examine circuit breaking, fallback, and related mechanisms.
- 2.25 Ribbonhistorical
Ribbon is a client-side load-balancing component. These notes introduce its need and examine selection and execution during service calls.
- 2.26 Sleuthhistorical
Sleuth records traces for Spring Cloud calls and can work with Zipkin to display interactions between services.
- Zuulhistorical
Zuul is a Spring Cloud gateway component. These notes cover routing, filtering, and traffic-based rollout of new features.
- ApplicationListenerhistorical
ApplicationListener uses the observer pattern to decouple event publishers from listeners. These notes illustrate it with separate email and logging actions after ticket events.
- Bean Scopeshistorical
Singleton scope returns the same bean from the container, while prototype scope creates a new instance each time. These notes examine scope behavior.
- Usagehistorical
Examples such as HelloWorld demonstrate Spring AOP usage and the relationship between aspect configuration and target-method calls.
- Usagehistorical
Examples such as AopConfig and Calc demonstrate Spring AOP configuration and how aspects work with target objects.
- 2.32 Autowired Principlehistorical
Spring handles dependency injection during post-processor registration and bean creation. These notes trace @Autowired through AutowiredAnnotationBeanPostProcessor.
- Spring Transaction Source Analysishistorical
@EnableTransactionManagement imports transaction-management components. These notes trace registration and execution of Spring transaction objects from that annotation.
- 2.34 Custom Startershistorical
A custom starter begins with its dependencies and auto-configuration. These notes organize the steps for extending Spring Boot.
- 2.35 Usagehistorical
Application and test-class examples demonstrate Spring Boot caching, including application configuration and cache calls.
- Spring Boot Jar Startup Principlehistorical
Project configuration and main-class examples introduce how a Spring Boot application starts after being packaged as a Jar.
- MyBatis Auto-Configurationhistorical
Spring Boot creates MyBatis-related objects through auto-configuration. These notes trace integration through configuration-class initialization callbacks.
- Spring MVC Auto-Configuration Principlehistorical
Spring Boot configures Web MVC through WebMvcAutoConfiguration. These notes examine the objects and methods through its inner configuration class.
- 2.39 Usagehistorical
Examples such as Application demonstrate basic Spring Boot usage, including configuration and startup.
- Embedded Tomcat Auto-Configuration Principlehistorical
Spring Boot creates an embedded Servlet container according to dependencies on the classpath. These notes trace auto-configuration using Tomcat as an example.
- Learning Resourceshistorical
This page collects Netty learning references for further study of framework usage and source-code analysis.
- Summaryhistorical
This page connects Netty source-analysis topics on server startup, Channel registration, and port binding through their call relationships.
- 2.43 Thread Isolationhistorical
Thread isolation separates calls into distinct thread resources to prevent failing calls from exhausting a service. These notes use Hystrix configuration and execution as examples.
- Bean Lifecyclehistorical
A Spring bean is instantiated and then undergoes property injection and further processing. These notes organize its lifecycle stages and extension points.
- What Spring AOP Ishistorical
AOP adds cross-cutting behavior without directly changing business code. These notes use logging to explain separating aspects from business logic.
- What It Ishistorical
IOC delegates object creation and management to a container, from which business code obtains dependencies. These notes compare that arrangement with manual construction.
- 2.47 Common Spring Annotationshistorical
Spring annotations declare configuration classes, scan components, and register objects in the IOC container. These notes organize common annotations and their usage.
- Spring Transaction Propagationhistorical
Transaction propagation behavior is an enhancement that Spring provides on top of database transactions. It describes how a transaction propagates when a method annotated with a particular propagation behavior is nested inside another method.
- Spring Boot Cache Auto-Configuration Principlehistorical
Spring Boot creates cache-management objects through cache auto-configuration. These notes trace configuration selection and object creation from CacheAutoConfiguration.
- Component Introductionhistorical
Netty is an asynchronous event-driven networking framework built around Java I/O. These notes organize its main roles through components such as Bootstrap.
- Off-Heap Memoryhistorical
Off-heap memory lies outside the Java heap. These notes compare ByteBuffer allocation approaches and their relationship to data transfer.
- BeanFactoryhistorical
BeanFactory instantiates, configures, and manages beans, while ApplicationContext adds further capabilities. These notes examine relationships among container interfaces.
- 2.53 Usagehistorical
DbConfig and Service examples demonstrate Spring transaction usage and the relationship between data-source configuration and transactional methods.
- Circular Dependencieshistorical
Circular Dependencies: Suppose there are two Beans, Bean1 and Bean2. If Bean1 depends on Bean2, and Bean2 depends on Bean1, then when Spring creates Bean1 it first needs to create Bean2, while creating Bean2 requires creating Bean1 first.
- How to Load Beans A and B in Order in Springhistorical
Controller and Service examples examine loading relationships between Spring beans and ways to control their initialization order.
- 2.56 1. Create NioEventLoopGrouphistorical
NioEventLoopGroup manages multiple NioEventLoops and accepts Runnable tasks. These notes trace how the group is created through its constructors.
- 2. Bootstrap Creationhistorical
After creating ServerBootstrap, Channel types, handlers, and options must be configured. These notes focus on how the Channel type is set.
- 3. Bind the Porthistorical
These notes follow bind calls to examine how Netty port-binding requests reach the concrete Channel implementation.
- 1. Detect a New Connectionhistorical
When a connection arrives, NioEventLoop handles an OP_ACCEPT event. These notes trace connection detection with breakpoints and a client connection.
- Pipeline Initializationhistorical
Each Netty Channel has its own pipeline, created during AbstractChannel construction. These notes examine pipeline initialization.
- 1. Creating the Serverhistorical
Starting from the server bind method, these notes follow the call chain to AbstractBootstrap.doBind and examine server creation.
- 1. Create the Spring Containerhistorical
Creating a Spring container triggers refresh. These notes trace container initialization and bean retrieval from ApplicationContext creation.
- Spring Boot Startup Principlehistorical
These notes start with a Spring Boot application's startup statement and trace the startup process while omitting simple nested calls.
- Create Executorhistorical
These notes trace Netty Executor creation, starting with the thread factory and executor initialization.
- 2. Create NioSocketChannelhistorical
Netty wraps accepted Java NIO connections in NioSocketChannel. These notes trace construction of that object and its parent classes.
- Adding and Removing ChannelHandlershistorical
These notes begin with methods such as DefaultChannelPipeline.addLast and trace ChannelHandler insertion, validation, and removal.
- 2. Server Initializationhistorical
These notes follow bind and doBind calls to trace the work performed during Netty server initialization.
- 2. Call BeanFactoryPostProcessor's postProcess Methodhistorical
Spring invokes BeanFactoryPostProcessors during container refresh. These notes trace their execution from invokeBeanFactoryPostProcessors.
- Spring Boot Auto-Configuration Principlehistorical
@SpringBootApplication connects annotations such as @EnableAutoConfiguration. These notes trace how Spring Boot auto-configuration takes effect from those entry points.
- Create the NioEventLoop Arrayhistorical
NioEventLoopGroup creates individual NioEventLoops through newChild. These notes follow that call to examine event-loop-array initialization.
- 3. Allocate a Thread and Register the Selectorhistorical
After a new connection passes through the pipeline, it needs a processing thread and Selector registration. These notes trace the related calls from connection acceptance.
- 3. Register the Selectorhistorical
Starting from the server's bind call, these notes trace how a Channel is assigned an event loop and registered with the Selector.
- 3. Register BeanPostProcessorhistorical
Spring registers bean post-processors through registerBeanPostProcessors. These notes follow the delegated calls that perform registration.
- 4. Register Read Events with the Selectorhistorical
After Channel registration, read events must be registered with the Selector. These notes trace the process through AbstractChannel's register operation.
- 4. Bind the Server Porthistorical
These notes trace the server bind call chain to examine how Netty binds a listening port to the underlying network channel.
- Spring IoC Source: Instantiating All Non-Lazy Singleton Beanshistorical
FinishBeanFactoryInitialization instantiates non-lazy singleton beans. These notes focus on the execution of preInstantiateSingletons.
- Server Startuphistorical
This page organizes Netty server-startup analysis into creation, initialization, Selector registration, and port binding.
- UML Diagramhistorical
UML diagrams organize relationships among Spring IOC classes as a structural reference for reading container source code.
- 2.79 1. Instantiate the Channelhistorical
Netty invokes the NioServerSocketChannel constructor through reflection and creates the underlying Java NIO channel. These notes trace that instantiation.
- Netty Bind Source: Actually Binding the Listening Porthistorical
Netty wraps port binding as a task for the Channel's NioEventLoop. These notes trace the calls after task submission.
- Inbound Eventshistorical
Experiments with multiple InboundHandlers show how Netty inbound events propagate through the pipeline.
- ByteBufhistorical
ByteBuf uses reader and writer indexes to divide consumed, readable, and writable regions. These notes examine read and write API behavior through those indexes.
- 1. Inject AspectJAnnotationAutoProxyCreator into the Containerhistorical
Enabling @EnableAspectJAutoProxy imports AOP components into Spring. These notes trace automatic proxy creator registration from the annotation's source.
- 2.1 How the AnnotationAwareAspectJAutoProxyCreator Bean Instance Is Createdhistorical
AnnotationAwareAspectJAutoProxyCreator is both a bean post-processor and BeanFactoryAware. These notes use breakpoints to examine its creation and initialization.
- Spring AOP Source Analysis Summaryhistorical
Spring AOP's automatic proxy creator participates in bean initialization and generates proxies at the relevant stage. This page summarizes related interfaces and call relationships.
- 2. Initialize Channelhistorical
Channel initialization adds a ChannelInitializer to the pipeline and connects the handlers configured in ServerBootstrap.
- Netty Source: NioEventLoop run Methodhistorical
NioEventLoop's run method repeatedly processes I/O events and tasks. These notes separate the main parts of the loop and trace execution.
- Outbound Eventshistorical
Code examples with multiple OutboundHandlers show how Netty outbound events propagate through the pipeline.
- ByteBufAllocatorhistorical
ByteBufAllocator allocates ByteBuf instances. These notes follow the abstract buffer method to examine choices such as heap and direct memory.
- 2.2 When Does AnnotationAwareAspectJAutoProxyCreator Take Effect?historical
Breakpoints around bean initialization show when AnnotationAwareAspectJAutoProxyCreator participates in the bean lifecycle.
- 2.91 3. Register the Channelhistorical
A server Channel uses EventLoopGroup to choose an event loop and register itself. These notes trace the process through ServerBootstrap calls.
- Exception Eventshistorical
Server and Handler examples generate exceptions to examine how Netty propagates and handles exception events in the pipeline.
- Usagehistorical
Code examples record Netty memory-related usage and provide a practical starting point for reading allocator implementations.
- 2.3 How AnnotationAwareAspectJAutoProxyCreator Creates Proxy Objectshistorical
These notes follow target-bean creation through the automatic proxy creator to examine aspect checks and proxy generation.
- Channel Class Hierarchyhistorical
Channel abstracts network I/O in Netty. These notes examine skeletal implementations and relationships among channel types through the class hierarchy.
- 2.4 How the Target Method Is Executedhistorical
Calls to a proxied target enter an interceptor. These notes trace the interceptor chain and target execution from CglibAopProxy.intercept.
- PooledByteBufAllocatorhistorical
PooledByteBufAllocator obtains a thread cache and its PoolArena, then allocates memory through the arena. These notes trace both stages.
- PoolThreadCachehistorical
PoolThreadCache creates caches for memory regions of different sizes. These notes examine initialization of tiny, small, and normal MemoryRegionCache instances.
- 3.1 Comparison of the Three I/O Modelshistorical
BIO, NIO, and AIO differ in blocking behavior, thread organization, and completion reporting. These notes compare them through server connections and request handling.
- 3.2 Multithreaded Server Implemented with BIOhistorical
Multithreaded Server Implemented with BIO: Traditionally, server-side programming uses BIO.
- AIOhistorical
Java AIO uses asynchronous file and socket channels. These notes examine asynchronous read and write organization through the related classes and examples.
- 3.4 BIOhistorical
BIO reads and writes through input and output streams organized as bytes or characters. These notes introduce blocking I/O through those concepts.
- Bufferhistorical
Buffer usage commonly follows writing, flip, reading, and clear or compact. These notes use its internal properties to explain state changes.
- 3.6 Server Implemented with NIOhistorical
NIO server examples cover read and write events and connection closure, including how read return values indicate connection state.
- AIO Serverhistorical
Server and client examples demonstrate Java asynchronous-I/O server programming and how connections and reads and writes complete.
- Basic Streamshistorical
InputStream.read reads bytes and returns -1 at the end of the stream. These notes examine basic stream behavior through single-byte and bulk reads.
- Channelhistorical
Data can both be read from a channel and written to a channel, while stream reading and writing are usually one-way.
- 3.10 Serialization Protocolhistorical
Serialization converts objects or data structures into bytes for storage or transmission. These notes use examples such as ByteBuffer to examine protocol organization.
- File Streamshistorical
Files can be read and written through byte or character streams. Examples with FileOutputStream, FileWriter, and related APIs cover writing, reading, and metadata access.
- Fileshistorical
Files provides operations for existence checks, directory creation, copying, moving, deletion, and recursive traversal. These notes record them through code examples.
- Heartbeat Mechanismhistorical
Heartbeats help servers clear idle channels and clients detect disconnections and decide whether to reconnect. These notes record both sides' handling.
- BIO Serverhistorical
Server and client examples demonstrate BIO programming and the organization of blocking connections, reads, and writes.
- 3.15 NIOhistorical
NIO organizes reads and writes around channels and buffers rather than BIO byte and character streams. These notes introduce usage through those components.
- Packet Protocolhistorical
Application protocols must distinguish message boundaries in TCP data. These notes examine packet-protocol design through data examples and sticky-packet behavior.
- Pathhistorical
Path represents a file-system path, with capabilities related to File. These notes use examples to record path creation and manipulation.
- NIO Serverhistorical
Client and server code demonstrate Java NIO programming and how Channel, Buffer, and Selector cooperate on connections and data.
- enumhistorical
Enum defines a set of named values implemented through Enum-related structures after compilation. These notes examine enumeration behavior through code.
- switchhistorical
Switch selects a branch from an expression's value. These notes compare compiled implementations for integers, strings, and enums.
- transienthistorical
Fields marked transient are excluded from default serialization and receive initial values after deserialization. These notes examine that behavior through examples.
- finalhistorical
Final has different meanings on classes, methods, and variables. These notes record inheritance, overriding, and assignment restrictions.
- Cloneable and Object.clonehistorical
Cloneable and Object.clone: It is a marker interface. An object that implements this interface can call Object.clone to copy the current object. What is copied here is the object's fields.
- 5.2 Integerhistorical
Integer is immutable. These notes examine its structure and wrapper-type behavior through implementation details such as its final class.
- 5.3 ArrayListhistorical
ArrayList is a resizable array-backed list that preserves order and allows duplicates. These notes trace its implementation through class relationships and the backing array.
- 5.4 Hashtablehistorical
Hashtable provides thread-safe key-value storage, implements Map, and supports cloning and serialization. These notes examine operations through class relationships.
- Objecthistorical
Object provides basic methods such as getClass, hashCode, and equals. These notes connect them with runtime types and hash-container usage.
- PriorityQueuehistorical
PriorityQueue orders elements by priority rather than insertion order alone. These notes examine ordering rules and internal operations through examples.
- 5.7 Serializablehistorical
Serialization stores or transmits memory objects, while deserialization restores them. These notes examine Serializable and its read and write methods.
- 5.8 HashSethistorical
HashSet uses HashMap to store distinct elements. These notes examine set operations and source code through its structure.
- Stringhistorical
String represents immutable strings that can be shared across threads. These notes examine the implementation of immutability and related operations.
- 5.10 LinkedListhistorical
LinkedList is a doubly linked list that preserves order, allows duplicates, and supports deque operations. These notes examine its structure and operations.
- LinkedHashMaphistorical
LinkedHashMap uses a doubly linked list to maintain order on top of HashMap. These notes compare their structures and trace operations.
- Immutable Objecthistorical
Immutable objects do not change state after construction. These notes examine constraints such as final classes and fields when constructing them.
- LinkedHashSethistorical
LinkedHashSet organizes data with LinkedHashMap and uses a placeholder value. These notes examine how that relationship supports set operations.
- StringBufferhistorical
StringBuffer provides thread-safe mutable-string operations through synchronization. These notes compare it with StringBuilder.
- Converting Between List and Arrayhistorical
Arrays and lists often need conversion. These notes use code examples to record conversions in both directions and their behavioral differences.
- Java Map Implementations Comparedhistorical
HashMap implementations differ between JDK 1.7 and 1.8. These notes compare collision handling, tree conversion, and concurrent resizing.
- Collections.synchronizedSethistorical
SynchronizedSet wraps set operations with synchronized protection. These notes connect its wrapper with the implementations of synchronized collections.
- StringBuilderhistorical
StringBuilder stores characters in a resizable array and supports mutation without thread-safety guarantees. These notes trace append and resize operations.
- List Comparisonhistorical
ArrayList and LinkedList use different underlying structures. A comparison table examines access, insertion, deletion, and related operations.
- Collections.synchronizedMaphistorical
SynchronizedMap wraps map operations in synchronization blocks. These notes connect it with SynchronizedList to examine synchronized wrappers.
- TreeSethistorical
TreeSet uses TreeMap to store distinct elements. These notes examine insertion, lookup, and iteration through the underlying method calls.
- String Comparisonhistorical
String is immutable, while StringBuilder and StringBuffer are mutable. A comparison table examines thread safety and usage scenarios.
- Collections.synchronizedListhistorical
SynchronizedList adds synchronization around list operations. These notes cover its wrapper and source code through the need for thread safety.
- 5.24 TreeMaphistorical
TreeMap stores key-value pairs in a red-black tree with O(log N) basic operations. These notes examine key ordering and iteration.
- 5.25 Vectorhistorical
Vector is a thread-safe list with indexed access, cloning, and serialization. These notes examine usage and implementation through its class relationships.
- 5.26 fail-fasthistorical
Fail-fast stops immediately on an error, while fail-safe allows continued operation in some cases. These notes connect that distinction with collection iteration.
- HashMap in JDK 7historical
JDK 1.7 HashMap derives bucket indexes from hashes and array length, then handles collisions with linked lists. These notes trace the related methods.
- HashMap in JDK 8historical
JDK 1.8 HashMap organizes key-value data with arrays, linked lists, and red-black trees. These notes trace its implementation through access behavior and class relationships.
- 6.1 Start with the Hardwarehistorical
Understanding the Java Memory Model starts with CPU, memory, and cache relationships. These notes introduce the hardware issues through the von Neumann architecture.
- 6.2 2.Synchronizedhistorical
Synchronized protects Java synchronization blocks. These notes examine usage and implementation through atomicity, ordering, visibility, and locking overhead.
- 6.3 3.volatilehistorical
These volatile notes examine ordering, visibility, and atomicity, compare volatile with synchronized, and record usage scenarios.
- 6.4 CAShistorical
CAS can be introduced through the distinction between optimistic and pessimistic locking. These notes compare conflict handling before examining compare-and-swap.
- 6.5 5.AQShistorical
AQS is a queued synchronizer for building JUC concurrency utilities. These notes examine when and how to use it for custom synchronization tools.
- 6.6 6.ReentrantLockhistorical
ReentrantLock provides explicit locking and unlocking. These notes compare it with synchronized and trace its implementation through AQS-related classes.
- 6.7 7.Lock Conditionhistorical
Condition works with Lock for condition waiting and notification. These notes compare it with Object.wait and notify through producer-consumer scenarios.
- 6.8 8.CyclicBarrierhistorical
CyclicBarrier makes threads wait for one another before proceeding and can be reused. These notes trace its implementation through Lock and Condition.
- 6.9 9.CountDownLatchhistorical
CountDownLatch lets threads wait for tasks to complete and resumes them when the counter reaches zero. These notes trace its one-shot behavior through AQS.
- 6.10 10.CopyOnWriteArrayListhistorical
CopyOnWriteArrayList separates reads from writes, allowing unlocked reads while copying data on writes. These notes examine the mechanism and its consistency behavior.
- 6.11 11.CopyOnWriteArraySethistorical
CopyOnWriteArraySet stores distinct elements using CopyOnWriteArrayList. These notes trace its copy-on-write implementation through methods such as addIfAbsent.
- 6.12 ArrayBlockingQueuehistorical
ArrayBlockingQueue is a bounded blocking queue backed by an object array. These notes trace waiting and notification through its shared lock.
- 6.13 13.ThreadLocalhistorical
ThreadLocal stores independent data for each thread rather than sharing one variable's state. These notes examine its internal map through data isolation.
- 6.14 14.ThreadPoolhistorical
Thread pools separate submission from execution and reuse threads to reduce creation and destruction. These notes examine Java pool structure and execution.
- 6.15 CompletableFuturehistorical
CompletableFuture organizes asynchronous computation by running work on separate threads and continuing processing when results become available.
- 6.16 ConcurrentHashMap in JDK 1.7historical
JDK 1.7 ConcurrentHashMap uses segmented locking with arrays and linked lists for concurrent updates. These notes trace the implementation through Segment and HashEntry.
- 6.17 fork_joinhistorical
Fork/Join splits large work into parallel subtasks and combines their results. These notes introduce the framework through limitations of ordinary thread pools.
- 6.18 Exchangerhistorical
Exchanger: Used to exchange data between two threads. The data flow is bidirectional. That is, if there are two threads, Thread1 and Thread2, Thread1 sends one piece of data to Thread2, while Thread2 also sends one piece of data to Thread1.
- 6.19 ReentrantReadWriteLockhistorical
Exclusive locks prevent concurrent readers, while read-write locks allow them. These notes introduce ReentrantReadWriteLock through that need.
- 6.20 Semaphorehistorical
Semaphore limits concurrent resource access through permits. These notes examine fair and nonfair policies and permit acquisition and release.
- 6.21 Kernel-Level Threadhistorical
User-level threads are managed by applications, while kernel threads are visible to and scheduled by the operating system. These notes connect the distinction with Java threads.
- 6.22 Unsafehistorical
Unsafe exposes low-level operations such as direct memory access. These notes introduce them through C pointers and memory allocation and examine why care is required.
- 6.23 Revisiting the JMMhistorical
Processor architectures impose different constraints on memory operations. These notes examine how JMM abstracts those differences through observable execution order.
- 6.24 Lock Optimizationhistorical
Java has introduced several synchronized optimizations. These notes begin with lock elimination and examine how compilers and runtimes reduce synchronization costs.
- 6.25 Implementing a Simple AQS by Handhistorical
Writing a simplified AQS illustrates how an exclusive lock records its owner and how other threads wait and resume.
- 6.27 BlockingQueuehistorical
BlockingQueue provides a thread-safe blocking-queue interface. These notes examine enqueue and dequeue operations, waiting, timeouts, and failure behaviors.
- 6.28 Executorshistorical
Executors provides factory methods for different thread pools. These notes compare cached, fixed-size, single-threaded, and scheduled pools through examples.
- 6.29 ConcurrentHashMap in JDK 1.8historical
JDK 1.8 ConcurrentHashMap combines synchronized, CAS, arrays, linked lists, and red-black trees for thread-safe access. These notes trace execution through methods such as putVal.
- 6.30 Producer-Consumerhistorical
Producers and consumers wait when conditions are unmet and wake one another when work can proceed. These notes compare wait/notify and two-Condition approaches.
- 6.31 Nonfair ReadWriteLockhistorical
These notes follow ReentrantReadWriteLock source code to examine nonfair read-write lock acquisition and direct acquisition attempts.
- 6.32 Nonfair Semaphorehistorical
A nonfair semaphore allows direct competition for permits. These notes trace acquisition and waiting through NonfairSync.
- 6.33 Thread.sleephistorical
After Thread.sleep ends, a thread can compete for the CPU again but is not guaranteed immediate execution. These notes illustrate that distinction with a timing example.
- 6.34 Nonfair Lockhistorical
A nonfair lock allows threads to attempt acquisition when the lock becomes free without requiring arrival order. These notes trace NonfairSync.lock.
- 6.35 LinkedBlockingQueuehistorical
LinkedBlockingQueue uses a singly linked list with separately coordinated reads and writes. These notes trace waiting and notification through its node structure.
- 6.36 RejectedExecutionHandlerhistorical
When a thread pool's workers and queue are full, a rejection handler processes new tasks. These notes examine RejectedExecutionHandler implementations.
- 6.37 Deadlockhistorical
Java examples create a deadlock and inspect thread states to show how mutual waiting prevents progress.
- 6.38 Fair ReadWriteLockhistorical
These notes follow ReentrantReadWriteLock source code to examine fair read-write locking and how the wait queue participates in acquisition.
- 6.39 Fair Semaphorehistorical
A fair semaphore allocates permits under a fairness policy. These notes trace permit acquisition and queuing through FairSync.
- 6.40 Thread Stateshistorical
Java threads transition between execution states. These notes use the thread-state enumeration and a state diagram to organize those relationships.
- 6.41 PriorityBlockingQueuehistorical
PriorityBlockingQueue uses a binary heap for a priority-ordered blocking queue. These notes examine its array representation, ordering, and waiting on an empty queue.
- 6.42 SynchronousQueuehistorical
SynchronousQueue stores no elements, so writes must pair with reads or wait. These notes trace the process through its transfer structures.
- 6.43 Atomichistorical
Atomic classes provide thread-safe atomic operations through mechanisms such as CAS. These notes trace implementation using AtomicInteger.
- Java Production Issue Troubleshootinghistorical
Java production troubleshooting can start by finding resource-heavy processes with tools such as top, then locating related threads or code. These notes record diagnostic steps.
- Garbage Collection Conceptshistorical
Object reclamation can use approaches such as reference counting or reachability. These notes begin with counters and examine circular-reference problems.
- 7.4 Class Lifecyclehistorical
Java classes pass through loading, linking, initialization, use, and unloading. These notes organize the work performed at each stage.
- 7.5 Memory Regionshistorical
The JVM uses runtime memory areas for objects and other data. These notes begin with the heap and examine each area's role and creation timing.
- 7.6 Tuning Approachhistorical
Tuning Approach: Reduce the number of Full GCs / reduce Full GC duration / reduce memory usage.
- Garbage Collection Algorithmshistorical
Garbage collection identifies reachable objects and handles those no longer used. These notes organize algorithms around marking and reclamation.
- Class Initialization Orderhistorical
Active use can trigger Java class initialization, including prior parent-class initialization. These notes use code examples to examine class and instance initialization order.
- 7.9 Object Allocation Ruleshistorical
Object Allocation Rules: Objects are preferentially allocated in the Eden area. If there is not enough space in Eden, the virtual machine performs a Minor GC.
- 7.10 3. Garbage Collectorshistorical
Objects have different lifetimes, motivating generational memory organization and collection. These notes compare collectors through young- and old-generation characteristics.
- Custom Class Loaderhistorical
Custom class loaders can load classes from selected paths and isolate same-named classes in different applications. These notes examine implementations through those scenarios.
- Escape Analysishistorical
Escape analysis examines an object's scope and whether code outside a method or thread can access it. These notes organize cases such as method escape.
- 7.13 4. Selecting a Specific Garbage Collector with JVM Parametershistorical
JVM startup options select garbage collectors. These notes record collector combinations for young and old generations and their corresponding flags.
- 7.14 Object Creation Processhistorical
Java object creation involves allocation, constructor invocation, and storing a reference. These notes trace a new expression through bytecode.
- Garbage Collectionhistorical
JVM garbage collection can be studied through its concepts, algorithms, collectors, and selection flags. This page links those topics.
- 7.16 Object Layout in Memoryhistorical
Java objects store headers and instance data, with arrays also carrying length information. These notes compare ordinary-object and array layouts.
- 7.17 Referenceshistorical
Java references have different strengths that affect whether an object can be reclaimed. These notes compare them through examples, starting with strong references.
- How Objects Are Locatedhistorical
Java can locate objects through direct pointers. These notes compare object-access approaches and examine references when garbage collection moves objects.
- 7.19 OOM Exampleshistorical
GC cannot reclaim strongly reachable objects, which may continue consuming memory. These notes illustrate out-of-memory failures across memory areas.
- 7.20 Performance Analysis Toolshistorical
JVM performance troubleshooting begins with process information and suitable diagnostic tools. These notes organize tools by their commands and output.
- 7.21 JVM Parameter Tuninghistorical
JVM heap size can be configured with options such as -Xms and -Xmx. These notes continue with generation ratios and their relationship to GC costs.
- 7.22 GC Log Analysishistorical
GC logs expose young- and old-generation collections. These notes use Parallel GC logs to explain output fields and analysis tools.
- OOPhistorical
Inheritance affects constructors, fields, and methods in Java. These notes examine those relationships through parent-child class examples.
- 9. Reflectionhistorical
Reflection retrieves information such as class fields and methods at runtime. These notes use examples to examine dynamic inspection and object operations.
- 10. Sockethistorical
Socket programming involves connections and I/O. These notes compare ServerSocket, Socket, and NIO channels to examine server-client relationships.
- Servlethistorical
A Servlet calls init after creation and service for requests, dispatching to methods such as doGet and doPost. These notes organize the lifecycle.
- 11.2 Tuninghistorical
Tomcat tuning can start with JVM options in startup scripts and continue with connector settings. These notes record configuration methods and inspection commands.
- 11.3 Usagehistorical
Examples such as HelloServlet demonstrate Servlet usage and how requests enter the application handler.
- 11.4 Connectorhistorical
Tomcat Connector accepts network requests and passes them to the adapter and container. These notes examine its structure through Boss/Worker responsibilities.
- Tomcat Startup Flowhistorical
Tomcat's startup.bat calls catalina.bat. These notes follow the scripts into the main class and trace container startup.
- Tomcat Request Processing: Source Viewhistorical
Tomcat startup includes init and start stages. These notes trace request-handling source code through the distinction between binding a port and accepting connections.
- Building Tomcat from Sourcehistorical
These notes record Maven configuration for Tomcat source and startup and debugging through the Bootstrap class.
- 11.8 Containerhistorical
A Tomcat Server can contain multiple Services, each combining Connectors and a Container. These notes organize the architecture by those levels.
- 11.9 Configuration-File Levelhistorical
Using a local Tomcat URL, these notes examine how configuration maps a request to its application and handling path.
- 11.10 LifeCyclehistorical
This note records Tomcat LifeCycle structures in diagrams as a reference for reading container-lifecycle source code.
- 11.11 Architecturehistorical
Tomcat serves as both an HTTP server and a Servlet container, handing requests to application classes. These notes examine its architecture through that division.
- Genericshistorical
Generics parameterize types so the same logic can serve multiple data types. These notes compare them with overloading and Object parameters through sorting requirements.
- Java 8 New Featureshistorical
Java 8 introduced features such as lambda expressions and the Stream API. These notes organize syntax and examples by feature.
- Comparehistorical
Comparator defines comparison rules. These notes use a custom compare method to show how its return value determines element order.
- Estimating Thread Pool Sizehistorical
Thread counts can be estimated from QPS and response time, then checked with load testing. These notes record that estimation and validation process.
- Multithreaded Folder Size Statisticshistorical
Directory-size calculation is split across threads and their results combined, illustrating how to organize parallel tasks.