TAG
Java
234 notes
- Spring Learning Resourceshistorical
Spring interview questions with detailed answers; how Spring resolves circular dependencies.
- Usagehistorical
Create a Maven project, configure MyBatis, create the mapper, test it, and inspect the project structure
- 2.10 Spring Moduleshistorical
Spring core container, data access/integration, Web, AOP, Instrumentation, Test, and miscellaneous modules.
- Spring Boot Learning Resourceshistorical
20 Spring Boot interview questions - Java Technology Stack - SegmentFault.
- 2.12 Usagehistorical
Create a Spring MVC project in two ways, configure Maven and Spring MVC, add controllers/JSP/HTML, configure Tomcat, and run the project.
- MyBatis Source Analysishistorical
Framework layers, four core objects, SqlSessionFactory configuration parsing, SqlSession and Executor creation, mapper proxy creation, CRUD execution, mapped statements, first-level and second-level cache, and JDBC execution.
- Spring MVC Source Analysishistorical
Breakpoint call stack, servlet class relationships, DispatcherServlet loading, request dispatch, HandlerMapping, HandlerAdapter, handler invocation, and view rendering.
- Thread Safetyhistorical
Thread-safety issues caused by Spring MVC singleton beans, solutions, and a reference.
- Spring MVC Learning Resourceshistorical
Common Spring MVC interview questions with detailed answers - CSDN Blog.
- Netty 3.x Source Analysishistorical
1. Overview 2. Boss-array initialization 3. Worker-array initialization 4. Bind
- 2.20 Apollohistorical
What Apollo is, how to use it, and how its push-pull configuration update mechanism works.
- Feignhistorical
What Feign is, why it exists, and how its interface proxy, Ribbon, Eureka, and HTTP request construction work.
- Gatewayhistorical
What Spring Cloud Gateway is, its Route/Predicate/Filter concepts, and its asynchronous non-blocking thread model.
- Hystrixhistorical
1. What Hystrix is 2. Why Hystrix is needed 3. Usage 4. Features 5. Principles 6. References
- 2.25 Ribbonhistorical
What Ribbon is, why load balancing is needed, usage, working flow, and load-balancing strategies.
- ApplicationListenerhistorical
1. What ApplicationListener is 2. How to use the event-listener mechanism 3. References
- 2.32 Autowired Principlehistorical
Class inheritance diagram and principle analysis of Spring's AutowiredAnnotationBeanPostProcessor.
- Spring Transaction Source Analysishistorical
1. Enable transaction management. 2. TransactionManagementConfigurationSelector imports AutoProxyRegistrar and ProxyTransactionManagementConfiguration. 3. Study AutoProxyRegistrar. 4. Study ProxyTransactionManagementConfiguration and transaction interception.
- 2.34 Custom Startershistorical
Two questions behind a custom Spring Boot starter and a complete hello-spring-boot-starter example.
- 2.35 Usagehistorical
Create a project, configure pom.xml, and use Spring Boot caching with Application, TestController, and TestService.
- Spring Boot Jar Startup Principlehistorical
1. Experiment. 2. Structure of an executable Jar. 3. How the program entry point is found. 4. Jar packages that can start without the java -jar command. 5. Reference.
- MyBatis Auto-Configurationhistorical
How Spring Boot enables MyBatis auto-configuration and how AutoConfiguredMapperScannerRegistrar determines which package to scan for @Mapper interfaces.
- Spring MVC Auto-Configuration Principlehistorical
1. Auto-configuration classes pre-imported by spring-boot-starter-web. 2. How custom configuration takes effect. 3. Why @EnableWebMvc disables Spring Boot MVC auto-configuration. 4. Reference.
- Embedded Tomcat Auto-Configuration Principlehistorical
1. Enable ServletContainer auto-configuration. 2. Inject the Tomcat container factory. 3. How custom configuration takes effect. 4. How to modify Tomcat configuration. 5. Summary.
- 2.43 Thread Isolationhistorical
Why thread isolation is needed, isolation modes, and thread-pool versus semaphore isolation.
- 2.47 Common Spring Annotationshistorical
Common Spring annotations and Aware interfaces, including Configuration, ComponentScan, Bean, Scope, Lazy, Conditional, Import, Value, Autowired, Qualifier, Primary, and Profile.
- Spring Transaction Propagationhistorical
1. What transaction propagation is. 1.1. Propagation behaviors including REQUIRED, SUPPORTS, MANDATORY, REQUIRES_NEW, NOT_SUPPORTED, and NEVER. 1.2. Notes. 2. References.
- Spring Boot Cache Auto-Configuration Principlehistorical
How the cache manager and cache classes are generated, how cache proxy classes are generated, and the overall execution flow.
- Off-Heap Memoryhistorical
1. What off-heap memory is 2. NIO off-heap memory 3. Netty off-heap memory 4. References
- 2.53 Usagehistorical
Create a project, configure pom.xml, and use Spring transactions with DbConfig, TestService, and TestDao.
- Circular Dependencieshistorical
1. What a circular dependency is 2. What problems it causes 3. How to solve it 4. References
- 2.56 1. Create NioEventLoopGrouphistorical
NioEventLoopGroup class hierarchy, constructor chain, initialization of selector/select strategy/rejection policy, EventLoop count, executor, child EventLoops, and chooser.
- 2. Bootstrap Creationhistorical
1. Code to analyze 2. Create ServerBootstrap 3. Set ServerBootstrap properties 4. ReflectiveChannelFactory
- Pipeline Initializationhistorical
1. When pipeline is created 2. What pipeline looks like 3. Tail and Head
- 1. Create the Spring Containerhistorical
1. Code to analyze 2. Create ApplicationContext and trace the refresh process
- Spring Boot Startup Principlehistorical
1. Start Spring Boot. 2. Process of creating SpringApplication: determine web environment, load ApplicationContextInitializer and ApplicationListener instances, save the main configuration class, and run the application.
- 2. Call BeanFactoryPostProcessor's postProcess Methodhistorical
1. Code to study 2. Process BeanDefinitionRegistryPostProcessors 3. Process BeanFactoryPostProcessors
- Spring Boot Auto-Configuration Principlehistorical
1. Enable Spring Boot auto-configuration. 2. Inject AutoConfigurationImportSelector into the container and import auto-configuration classes from META-INF/spring.factories. 3. Summary. 4. Reference.
- Create the NioEventLoop Arrayhistorical
1. Code to analyze 2. Parameters passed to NioEventLoop 3. NioEventLoop is a single-threaded thread pool 4. Constructor
- 3. Allocate a Thread and Register the Selectorhistorical
1. Code to analyze 2. Propagate through the pipeline 3. Pass through ServerBootstrapAcceptor 4. Analyze channelRead
- 3. Register BeanPostProcessorhistorical
1. Code to study 2. Obtain BeanPostProcessors 3. Classify them 4-7. Register each group
- 4. Register Read Events with the Selectorhistorical
1. Code to analyze 2. Set a breakpoint and connect with nc 3. Propagate channelActive 4. Reach HeadContext 5. Read through AbstractUnsafe
- 4. Bind the Server Porthistorical
Call path, AbstractBootstrap, AbstractUnsafe, and AbstractNioChannel
- Spring IoC Source: Instantiating All Non-Lazy Singleton Beanshistorical
Source tracing of finishBeanFactoryInitialization and preInstantiateSingletons through getBean, singleton lookup and creation, BeanPostProcessors, bean instantiation, property population, initialization, proxy creation, and destruction registration.
- 2.79 1. Instantiate the Channelhistorical
Instantiate NioServerSocketChannel through reflection, configure it as non-blocking, and create channelId, Unsafe, and pipeline.
- Netty Bind Source: Actually Binding the Listening Porthistorical
1. Code to analyze. 1.1. How NioEventLoop executes the Runnable. 1.2. What the bind task executed by NioEventLoop does, including JDK NIO bind, channelActive propagation, and registering interest in accept events.
- Inbound Eventshistorical
1. Add handlers for the experiment 2. Start from the pipeline 3. Forward through AbstractChannelHandlerContext 4. Enter HeadContext 5-8. Traverse inbound handlers to TailContext
- 1. Inject AspectJAnnotationAutoProxyCreator into the Containerhistorical
Enable AOP, register AspectJAnnotationAutoProxyCreator, and trace when ImportBeanDefinitionRegistrar.registerBeanDefinitions is called
- 2.1 How the AnnotationAwareAspectJAutoProxyCreator Bean Instance Is Createdhistorical
Class hierarchy, call-stack analysis, BeanFactoryAware setBeanFactory, registration and initialization of AnnotationAwareAspectJAutoProxyCreator
- Spring AOP Source Analysis Summaryhistorical
Created on Monday, July 22, 2019. Source analysis of Spring AOP from @EnableAspectJAutoProxy through auto-proxy creation and target-method interceptor execution.
- 2. Initialize Channelhistorical
1. Code to analyze 2. Obtain the channel pipeline and add a ChannelInitializer
- Netty Source: NioEventLoop run Methodhistorical
Code analysis of the NioEventLoop run loop: select, selector rebuild, selected-key optimization, processSelectedKeys, and asynchronous task execution.
- Outbound Eventshistorical
1. Add handlers for the experiment 2. Start from the pipeline 3. Enter TailContext 4-7. Traverse outbound handlers back to HeadContext
- ByteBufAllocatorhistorical
ByteBufAllocator class hierarchy, AbstractByteBufAllocator, unpooled allocation, and pooled allocation
- 2.2 When Does AnnotationAwareAspectJAutoProxyCreator Take Effect?historical
Trace postProcessBeforeInstantiation and postProcessAfterInitialization while creating singleton Beans
- 2.91 3. Register the Channelhistorical
Select a NioEventLoop, create a ChannelPromise/Future, register the channel through Unsafe with the JDK NIO selector, and invoke handlerAdded/initChannel callbacks.
- Exception Eventshistorical
1. Prepare experiment data 2. Start debugging 3-7. Propagate the exception through handlers to TailContext
- Usagehistorical
Historical example of allocating, reading, writing, and releasing a pooled direct ByteBuf
- 2.3 How AnnotationAwareAspectJAutoProxyCreator Creates Proxy Objectshistorical
Trace to postProcessBeforeInstantiation, determine whether a proxy is needed, wrap the Bean with advisors, and create JDK/CGLIB proxies
- 2.4 How the Target Method Is Executedhistorical
Invoke Calc.div, enter the proxy intercept method, build the interceptor chain, and execute interceptors plus the target method
- PooledByteBufAllocatorhistorical
newDirectBuffer, PoolThreadLocalCache, PoolThreadCache, and PoolArena
- 3.1 Comparison of the Three I/O Modelshistorical
Relationship between Java I/O and system calls, BIO/NIO/AIO classification, comparison, and references.
- 3.2 Multithreaded Server Implemented with BIOhistorical
Traditional server-side programming with BIO and its blocking points.
- AIOhistorical
Asynchronous NIO classes and AsynchronousFileChannel examples for reading and writing with Future polling and CompletionHandler callbacks.
- 3.6 Server Implemented with NIOhistorical
NIO vs BIO and common questions about channel reads, selector.select, and SelectionKey.OP_WRITE.
- Basic Streamshistorical
Byte streams with InputStream and OutputStream, and character streams with Reader and Writer.
- 3.10 Serialization Protocolhistorical
What serialization is, a custom ByteBuffer-based serialization rule, and a complete custom Serializer example.
- Fileshistorical
Check whether a file exists, create directories, copy files, move or rename files, delete files, and recursively traverse files.
- Heartbeat Mechanismhistorical
For servers, periodically clear idle channels; for clients, detect disconnected sessions and whether to reconnect.
- Packet Protocolhistorical
What sticky packets and split packets are, why the phenomenon appears with TCP byte streams, and how application-layer framing solves it.
- transienthistorical
Used during serialization. Fields marked transient are not serialized; after deserialization they take their initial values such as null or 0.
- Cloneable and Object.clonehistorical
1. What the Cloneable interface is. 2. What object cloning is. 3. How to implement object cloning: shallow cloning and deep cloning. 4. References.
- 5.2 Integerhistorical
Usage and implementation analysis of Integer, including immutability, valueOf, IntegerCache, and autoboxing behavior.
- 5.3 ArrayListhistorical
What ArrayList is, how to use it, and source analysis of construction, add, remove, resizing, and fail-fast behavior.
- 5.4 Hashtablehistorical
What Hashtable is, how to use it, and source analysis of construction, synchronized put/get/remove/containsKey, hashing, chaining, and rehashing.
- Objecthistorical
Methods on Object, the equals/hashCode contract, and the difference between wait and sleep.
- PriorityQueuehistorical
1. What PriorityQueue is. 2. Usage. 3. Source analysis: fields, constructors, heapify, insertion, deletion, sift-up, and sift-down. 4. Reference.
- 5.7 Serializablehistorical
Serialization and deserialization in Java, custom readObject/writeObject hooks, implementation flow, serialVersionUID, and serialization algorithm.
- Stringhistorical
1. What String is. 2. Usage. 3. Source analysis: class definition, constructors, constant pool, equals, toCharArray, toString, valueOf, intern, and substring. 4. Common questions. 5. References.
- 5.10 LinkedListhistorical
What LinkedList is, usage, and source analysis of its doubly linked list, add/remove operations, and node traversal.
- LinkedHashMaphistorical
What LinkedHashMap is, insertion-order and access-order usage, and source analysis of construction, put, get, contains, remove, and iteration.
- StringBufferhistorical
1. What It Is: a thread-safe mutable string, essentially StringBuilder with synchronized methods. 2. Usage. 3. Implementation analysis: constructor, append, toString, and substring.
- Java Map Implementations Comparedhistorical
Comparison of HashMap 1.7 and 1.8, HashMap and Hashtable, and TreeMap, LinkedHashMap, and HashMap.
- Collections.synchronizedSethistorical
Synchronized Set wrappers and the need for external synchronization during compound operations and iteration.
- StringBuilderhistorical
1. What It Is: a mutable, thread-unsafe string. 2. Usage. 3. Implementation analysis: constructor, append, toString, and substring.
- List Comparisonhistorical
Comparison of ArrayList and LinkedList, Vector and ArrayList, and SynchronizedList and Vector.
- Collections.synchronizedMaphistorical
Synchronized Map wrappers, compound-operation atomicity, iteration locking, and concurrent alternatives.
- Collections.synchronizedListhistorical
1. What It Is: a thread-safe list. 2. Usage. 3. Source analysis: synchronizedList, SynchronizedList construction, mutex initialization, and synchronized method delegation.
- 5.24 TreeMaphistorical
What TreeMap is, usage, and source analysis of constructors, put, get, containsKey, and remove.
- 5.25 Vectorhistorical
What Vector is, usage, source analysis, synchronization, and thread-safety limitations of compound operations.
- 5.26 fail-fasthistorical
fail-fast and fail-safe, Java iterator design, examples, implementation analysis, and summary.
- HashMap in JDK 7historical
1. Questions: hand-written HashMap, why capacity is converted to a power of 2, resizing, hash collisions, head insertion, concurrent resize loops, null keys, and ConcurrentModificationException. 2. References.
- HashMap in JDK 8historical
What HashMap is, usage, source analysis of construction, put, resize, treeification, get, containsKey, remove, containsValue, and differences from JDK 7.
- 6.1 Start with the Hardwarehistorical
Hardware foundations needed to understand the JMM: von Neumann architecture, caches, coherence, pipelines, reordering, memory barriers, and memory consistency models.
- 6.2 2.Synchronizedhistorical
1. What it is. An implementation of pessimistic locking in Java. Compared with volatile, it is a heavyweight lock and can guarantee atomicity, ordering, and visibility. 2. When to use it. 3. How to use it. 4. Principle analysis of synchronized blocks. 5. Principle analysis of synchronized methods.
- 6.3 3.volatilehistorical
What volatile is, when it is more suitable than synchronized, an assembly experiment, and visibility/ordering analysis.
- 6.4 CAShistorical
1. What it is. To understand CAS, first understand optimistic and pessimistic locking. 1.1. Optimistic vs. pessimistic locking. 1.2. CAS. 2. How to use it.
- 6.5 5.AQShistorical
1. What it is. A queue synchronizer used to implement other concurrency utilities in JUC. 2. How to use it. 3. Principle analysis: queue structure, lock acquisition, enqueueing, parking, cancellation, interruption recovery, and lock release.
- 6.6 6.ReentrantLockhistorical
What ReentrantLock is, comparison with synchronized, implementation principle, and references.
- 6.7 7.Lock Conditionhistorical
1. What it is. Similar to Object.wait/notify with synchronized; Condition.await/signal work with Lock to implement conditional waiting and wake-up. 2. Usage. 3. Implementation principles: Condition queue, await, transfer to AQS queue, signalAll, and signal.
- 6.8 8.CyclicBarrierhistorical
What CyclicBarrier is, usage with and without a barrier action, and source analysis based on Lock, Condition, generations, and await.
- 6.9 9.CountDownLatchhistorical
What CountDownLatch is, how to use it, comparison with CyclicBarrier, and its AQS-based countDown/await implementation.
- 6.10 10.CopyOnWriteArrayListhistorical
1. What it is. This list adopts the idea of separating reads and writes (weak consistency): reads can proceed concurrently without locking; writes require locking, copying the original data, modifying the copy, and then writing it back to the list. 2. How to use it. 3. Principles. 3.1. Constructor. The underlying implementation uses an Object array and accesses it through getArray/setArray.
- 6.11 11.CopyOnWriteArraySethistorical
1. What it is. A copy-on-write set: ordered and without duplicates, implemented internally with CopyOnWriteArrayList. 2. How to use it. 3. Principle analysis. 3.1. Constructor. 3.1.1. The underlying implementation uses CopyOnWriteArrayList. 3.2. add method. 3.2.1. Delegates to CopyOnWriteArrayList.
- 6.12 ArrayBlockingQueuehistorical
What ArrayBlockingQueue is, how to use it, and source analysis of its array, lock, conditions, put/take/offer/poll/add/remove/element/peek methods.
- 6.13 13.ThreadLocalhistorical
What ThreadLocal is, how to use it, and source analysis of ThreadLocalMap, set/get/remove, open addressing, weak keys, and memory-leak concerns.
- 6.14 14.ThreadPoolhistorical
1. What it is. Java's thread-pool framework separates task submission from task execution. 1.1. Why thread pools are needed: reuse threads, because creating/destroying threads is expensive and too many threads cause excessive CPU context switching. 1.2. Use cases: individual tasks should not run too long, and there are many tasks.
- 6.15 CompletableFuturehistorical
1. What it is. Used for asynchronous programming. In Java, so-called asynchronous programming means putting blocking code into a separate thread for execution and notifying the main thread when a result is available. 2. Future vs CompletableFuture. 3. Usage. 4. Source-code analysis.
- 6.16 ConcurrentHashMap in JDK 1.7historical
1. Constructor 2. put method 2.1. hash 2.2. ensureSegment 2.3. Segment.put 2.3.1. scanAndLockForPut 2.3.2. rehash 3. get 4. containsKey 5. remove 5.1. segmentForHash 5.2. Segment.remove
- 6.18 Exchangerhistorical
1. What it is. Used for exchanging data between two threads; data flows in both directions. 1.1. Exchanger vs. SynchronousQueue. 2. Usage. 3. Implementation analysis.
- 6.19 ReentrantReadWriteLockhistorical
1. What ReentrantReadWriteLock is. 2. ReentrantReadWriteLock categories. 3. References.
- 6.20 Semaphorehistorical
1. What it is. A rate-limiting utility class that allows only n threads to access a resource at the same time. 2. Implementation analysis. 2.1. UML.
- 6.21 Kernel-Level Threadhistorical
1. What it is. 2. How to verify that Java threads are kernel-level threads. 2.1. Before running. 2.2. After running.
- 6.22 Unsafehistorical
What Unsafe is, how it relates to manual memory access, and examples of reading and atomically updating fields by memory offset.
- 6.23 Revisiting the JMMhistorical
After understanding the underlying computer architecture, revisit why the Java Memory Model is needed, what it defines, and happens-before.
- 6.24 Lock Optimizationhistorical
1. JVM optimizations for locks: lock elimination, lock coarsening, biased locking, and adaptive locking. 2. Analysis of lock inflation. 3. Application-level optimization of lock usage. 4. Adjusting the number of spins.
- 6.25 Implementing a Simple AQS by Handhistorical
Build a simple AQS-like lock by hand to better understand the real AQS source code: requirements, fields, blocking/waking, waiter queue, lock/unlock flow, fairness, final implementation, test, and flow.
- 6.26 Fair Lockhistorical
A fair lock follows the first-come, first-served principle. Even after the lock has been released, a later-arriving thread cannot barge in; it must wait until nobody is ahead of it. 1. Usage. 2. Principle analysis.
- 6.27 BlockingQueuehistorical
1. What it is. A thread-safe blocking queue. Characteristics: FIFO; blocking insertion when the queue is full and blocking removal when the queue is empty; bounded or unbounded capacity; thread safety. 2. Use cases. Producer-consumer. 3. How to use it. 4. Detailed comparison of BlockingQueue implementations.
- 6.28 Executorshistorical
1. Usage 2. newCachedThreadPool 3. newScheduledThreadPool 4. newFixedThreadPool 5. newSingleThreadExecutor
- 6.29 ConcurrentHashMap in JDK 1.8historical
1. What it is. A thread-safe HashMap implemented with synchronized + CAS + the HashMap structure (array + linked list + red-black tree). 2. How to use it. 3. Principle analysis: constructor, Node, put, initialization, insertion, resizing, get, remove, and containsKey.
- 6.30 Producer-Consumerhistorical
1. Using BlockingQueue. 2. Using wait/notify. 3. Using Lock/Condition. Compared with wait/notify, two Conditions are used so producers and consumers are not woken together; each side wakes only the other side.
- 6.31 Nonfair ReadWriteLockhistorical
1. What it is. A nonfair read-write lock may let a newly arriving thread compete without strictly following queue order. 2. How to use it. 3. Source-code analysis: constructor, read locking/unlocking, write locking/unlocking, and AQS integration.
- 6.32 Nonfair Semaphorehistorical
1. What it is. Rate limiting using a nonfair strategy. 2. Usage. 3. Principle analysis: constructor, NonfairSync, acquire, shared acquisition through AQS, nonfair acquisition, release, and shared release.
- 6.33 Thread.sleephistorical
1. When a thread wakes after sleep. 2. Thread.sleep vs. Object.wait. 3. References.
- 6.34 Nonfair Lockhistorical
A nonfair lock allows any arriving thread to compete for the lock once it has been released, regardless of arrival order. 1. Usage. 2. Implementation principles.
- 6.35 LinkedBlockingQueuehistorical
What LinkedBlockingQueue is, usage, and source analysis of its linked-list structure, separate put/take locks, conditions, and queue operations.
- 6.36 RejectedExecutionHandlerhistorical
1. What is RejectedExecutionHandler? When corePoolSize is full, blockingQueue is full, and maxPoolSize is also full, how should a new task be handled? This is determined by RejectedExecutionHandler. 2. Types: CallerRunsPolicy, AbortPolicy, DiscardPolicy, DiscardOldestPolicy.
- 6.38 Fair ReadWriteLockhistorical
1. What it is. A fair read-write lock follows queue order: if threads are already waiting ahead, the current thread should not barge in. 2. How to use it. 3. Source-code analysis: constructor, read locking/unlocking, write locking/unlocking, and AQS integration.
- 6.39 Fair Semaphorehistorical
1. What it is. Rate limiting using a fair strategy. 2. Usage. 3. Principle analysis: constructor, FairSync, acquire, shared acquisition through AQS, fair acquisition, release, and shared release.
- 6.41 PriorityBlockingQueuehistorical
What PriorityBlockingQueue is, binary-heap basics, usage, and source analysis of growth, offer/put, take, and heap adjustment.
- 6.42 SynchronousQueuehistorical
1. What it is. A blocking queue implemented internally with a singly linked structure that does not store elements. A writer must have a reader at the same time in order to proceed, and vice versa; otherwise the writer or reader remains blocked. 2. Usage. 3. Principles. 3.1. Constructor. 3.1.1. Transfer. 3.1.2. QNode. 3.2. put blocking. 3.2.1. Calls TransferQueue.
- 6.43 Atomichistorical
1. What it is. Thread-safe atomic classes implemented with CAS. 2. Usage, using AtomicInteger as an example. 3. Principle analysis. 4. Problems with AtomicInteger: high CPU usage and the ABA problem, plus a version-number solution with AtomicStampedReference.
- Java Production Issue Troubleshootinghistorical
Troubleshooting memory saturation, CPU/thread problems, deadlocks, JVM tuning, and related references.
- Garbage Collection Conceptshistorical
Reference counting, reachability analysis, GC Roots, concrete garbage collection algorithms, and references.
- 7.4 Class Lifecyclehistorical
The class lifecycle: loading, linking, initialization, use, unloading, class loaders, parent delegation, and related questions.
- 7.5 Memory Regionshistorical
JVM memory regions: shared heap and method area, per-thread stack and program counter, and PermGen/Metaspace.
- 7.6 Tuning Approachhistorical
Goals of tuning, overall production steps, JMeter load-test tuning, and CMS tuning flow.
- Garbage Collection Algorithmshistorical
Mark-sweep, mark-compact, copying, and generational collection.
- Class Initialization Orderhistorical
When initialization is triggered, initialization rules, and examples for a single class and an inheritance hierarchy.
- 7.10 3. Garbage Collectorshistorical
Generational collection and historical Serial, Parallel, CMS, and G1 collectors, including CMS/G1 details and comparison.
- Custom Class Loaderhistorical
When a custom class loader is needed, how to implement one with findClass or loadClass, an example, and a reference.
- Escape Analysishistorical
What escape analysis is, how to enable it, optimizations for non-escaping objects, lock elimination, scalar replacement, stack allocation, and references.
- 7.13 4. Selecting a Specific Garbage Collector with JVM Parametershistorical
Matching young- and old-generation collectors, JVM parameters, and how to choose.
- 7.14 Object Creation Processhistorical
Code, bytecode, explanation, and a proposed solution for object-creation instruction reordering.
- Garbage Collectionhistorical
Garbage-collection concepts, when GC happens, what gets collected, what GC does, and references.
- 7.16 Object Layout in Memoryhistorical
Object composition, object headers, instance data, padding, and a JOL experiment.
- How Objects Are Locatedhistorical
Oracle JDK and OpenJDK use direct pointers: fast access, but pointers need to be updated if GC moves surviving objects.
- 7.19 OOM Exampleshistorical
Why OOM occurs and examples for heap, Metaspace, stack overflow, GC overhead, direct buffer memory, and native-thread exhaustion.
- 7.20 Performance Analysis Toolshistorical
Built-in JDK tools such as jps, jinfo, jstack, jmap, jstat, and jhat, plus JMX, MAT, Java Mission Control, BTrace, flame graphs, YourKit, JProfiler, and GC log tools.
- 7.21 JVM Parameter Tuninghistorical
Which JVM parameters to tune, JVM parameter types, how to inspect them, common options, examples, and a typical configuration.
- OOPhistorical
Whether creating a subclass object also creates a parent object, whether private fields are inherited, and references.
- 11.3 Usagehistorical
Create a project, create a Servlet, configure web.xml and Tomcat, run it, and deploy IDEA-generated files.
- 11.4 Connectorhistorical
Overview and class diagrams for Tomcat Connector, Endpoint, Processor, and Adapter.
- Tomcat Startup Flowhistorical
Startup entry classes, sequence diagram, and source tracing through Tomcat init and start from Bootstrap/Catalina to Server, Service, Connector, Endpoint, and Acceptor.
- Tomcat Request Processing: Source Viewhistorical
Sequence diagram and source tracing from NioEndpoint accept/poll processing through SocketProcessor, Processor, CoyoteAdapter, valves, filters, and servlet invocation.
- Building Tomcat from Sourcehistorical
1. Download and extract the source. 2. Convert it into a Maven project. 3. Configure the startup class and JVM arguments. 4. Configure JSP compilation. 5. References.
- 11.9 Configuration-File Levelhistorical
Use http://localhost:8080/tomcat_test/hello as an example to locate the connector, engine/service, host/context, and wrapper.
- 11.11 Architecturehistorical
What Tomcat is and why its HTTP server and Servlet container are designed as separate modules.
- Genericshistorical
What generics are, their benefits and usage, why Java generics are sometimes described as fake, and references.
- Java 8 New Featureshistorical
Java 8 features and a groupingBy example that converts a List into Map<String, List>.
- Estimating Thread Pool Sizehistorical
1. Estimate the number of threads 1.1. Throughput = concurrency / response time 1.2. TPS estimation 1.3. I/O-intensive or CPU-intensive 1.4. Dark Magic 2. References
- Multithreaded Folder Size Statisticshistorical
Start three threads to calculate separately; use the final thread to aggregate the result.