Tag: java
All the articles with the tag "java".
Locks in Java (Part 2): Implementing a Custom Lock
Introduces lock memory semantics and the use of AQS and the Lock interface to implement custom synchronization components, including an example that allows two concurrent threads. It also compares polling with wait/notify and discusses notification, competing for a lock again, and checking conditions.
Locks in Java (Part 1): Lock Categories
Focusing on the object header’s Mark Word, this article explains acquisition, contention, release, and promotion of biased, lightweight, and heavyweight locks. JOL examples inspect lock flags before and after synchronized code, followed by discussion of spinning, blocking, and suitable use cases.
Analyzing the ShardingJDBC Execution Flow
Uses the MyBatis call flow to analyze how ShardingJDBC 4.1.1 integrates with JDBC through custom DataSource, Connection, and PreparedStatement implementations. It traces parameter buffering, physical connection acquisition, and result-set handling, then simulates the proxy workflow with simplified code.
Getting Started with Redis (Part 4): Monitoring and Automatic Recovery with Sentinel
Redis Sentinel configuration and logs illustrate monitoring and automatic failover, including subjective and objective down states, leader election, and selection of a new primary. The article also shows replica promotion and replication changes, and discusses deploying multiple Sentinels and configuring voting thresholds.
Getting Started with Redis (Part 3): Primary/Replica Replication
This article covers Redis RDB and AOF persistence configuration and recovery, then demonstrates primary/replica replication. It explains full, incremental, and diskless replication and describes manually promoting a replica and updating replication relationships after a primary failure.
Getting Started with Redis (Part 2): Basic Data Types and Commands
Basic usage of the Redis server and client, with common commands for strings, hashes, lists, sets, and sorted sets illustrated through examples of key and data operations. The article also distinguishes the atomicity of individual commands from that of an entire business workflow, and discusses the role of Lua scripts.
Integrating GitHub with CircleCI, with a Sample Configuration
Connecting a GitHub project to CircleCI, with a config.yml example explaining workflows, jobs, and execution steps. Topics include Maven builds, dependency caching, saving test results, branch filtering, scheduled builds, and verification that the configuration takes effect.
Using ShardingSphere Database Middleware: ShardingProxy (Part 1), Data Sharding and Read/Write Splitting
Uses ShardingProxy 4.1.1 to configure data sharding and read/write splitting across multiple MySQL instances, then verifies routing through query and insert logs. It covers starting the proxy service, connecting an application, and MySQL driver and version compatibility considerations.