Brian Hanafee

Projects

Open-source Java libraries and demos I maintain on GitHub.

Useful Libraries

ASCIISafeCharsets
A CharsetProvider SPI that transliterates Unicode text into ASCII-safe subsets instead of rejecting or replacing non-ASCII characters. Four charset variants, including fixed-width record formats like ACH that require 1:1 character mapping.
RetryHTTP
HTTP-aware retry predicates and Retry-After header support for Resilience4j. Distinguishes responses that should be retried (e.g. 503) from those that shouldn’t (e.g. 200) while respecting server-requested delays.
Masking
Java wrapper types that protect sensitive data from accidental exposure in logs and toString() output. A Sensitive<T> base class with customizable Renderer implementations controls how much is revealed via format strings — useful for PII like SSNs and credit-card numbers.

Labs and Examples

KafkaGuaranteesLab
A Spring Boot application demonstrating the limitations of Kafka guarantees. It layers producer/consumer configuration with Resilience4j circuit breakers and retries to show how the guarantee is maintained end-to-end under failure. Kafka itself is configured for its strongest guarantee, an idempotent producer with acks=all, that deduplicates broker-level retries within a producer session. The demo shows how this can greatly reduce the number of duplicate messages but cannot eliminate them entirely without risking data loss.
RotatingSecrets
Zero-downtime database credential rotation for Spring applications in Kubernetes. HikariCP and Oracle UCP components watch mounted secret files and refresh pool credentials via a publisher-subscriber pattern, without disrupting existing connections.