Reflection in Java
Reflection inspects and manipulates classes at runtime. It powers most frameworks and should be rare in application code.
Notes related to the Java language.
100 notes tagged
Reflection inspects and manipulates classes at runtime. It powers most frameworks and should be rare in application code.
Java can still leak: any object the program keeps reachable but no longer needs. Here is how to find and fix them.
The collector reclaims objects that can no longer be reached. Understanding reachability explains both leaks and pauses.
Where each piece of data actually lives, and what runs out when each area is exhausted.
Classes are found, verified, prepared and initialised on first use, by a hierarchy of loaders that delegate upwards.
The class loader, the runtime data areas and the execution engine, and how a class file becomes running machine code.
The rules that decide when a write by one thread becomes visible to another, expressed as the happens-before relationship.
Purpose built collections for shared access, which are both safer and far faster than wrapping an ordinary one in a lock.
A Future is a placeholder for a result that is not ready yet. CompletableFuture adds composition, so results can be chained without blocking.
An executor separates submitting work from running it, so threads are reused instead of created per task.
The two failures that define concurrency: results that depend on timing, and threads that wait for each other forever.
Explicit locks offer timeouts, fairness and multiple conditions, and the atomic classes give lock free updates for single variables.