Skip to content

Rebuild repository as Java backend primitives - #1

Merged
azamir911 merged 34 commits into
mainfrom
agent/rebuild-java-concurrency-primitives
Jul 20, 2026
Merged

Rebuild repository as Java backend primitives#1
azamir911 merged 34 commits into
mainfrom
agent/rebuild-java-concurrency-primitives

Conversation

@azamir911

@azamir911 azamir911 commented Jul 19, 2026

Copy link
Copy Markdown
Owner

Purpose

Replace the repository contents with a clean-room, independent Java 21 backend primitives library. The implementation does not reuse the previous source files, package names, error identifiers, comments, framework types, or internal terminology.

Complete replacement map

Previous source Independent replacement
shared/SharedFiFoQueue.java CloseableBlockingQueue<E> plus the two concrete queue implementations
shared/SharedFiFoLockQueue.java BoundedBlockingQueue<E> with lock and condition signaling
shared/SharedFiFoSleepingQueue.java PollingBackoffQueue<E> with configurable backoff
shared/SharedFifoQueueMode.java QueueWaitStrategy and CloseableQueues factory
queue released exception QueueClosedException
custom interruption exception standard InterruptedException with normal interrupt propagation
calculator/Accumulator.java StreamingStatistics and StatisticsSnapshot
calculator/RatioCalculator.java DecimalRatioCalculator
calculator/ChunkSizeCalculator.java AdaptiveBatchSizer, RetryingSizeProbe<T>, and CheckedSizeProbe<T>

Preserved and improved capabilities

Queues

  • bounded FIFO ring buffers
  • condition-signaling and polling-backoff wait strategies
  • blocking and timed producer-consumer operations
  • peek, contains, logical indexOf, immutable snapshots, draining, and clearing
  • graceful close() with close-and-drain semantics
  • atomic closeNow() that discards buffered elements and releases callers
  • standard Java interruption behavior

Streaming statistics

  • count, sum, mean, sample variance, sample standard deviation, minimum, and maximum
  • reset and immutable snapshots
  • Welford one-pass variance
  • compensated summation
  • thread-safe concurrent updates

Decimal ratios

  • additive adjustment factor
  • explicit scale and RoundingMode
  • BigDecimal API and safe double convenience method
  • validation for zero denominators and invalid scales

Adaptive batching

  • target serialized capacity
  • fixed header or protocol overhead
  • sample record count and serialized payload measurement
  • safety factor and min/max clamps
  • retry budget for transient serialization-size failures
  • no dependency on a serializer, application type, Spring, Lombok, or company framework

Validation

The final PR head passed:

  • Java 21 compilation
  • all JUnit 5 unit tests
  • multi-producer and multi-consumer stress validation
  • concurrent statistics updates
  • both queue wait strategies and lifecycle modes
  • decimal ratio and rounding edge cases
  • adaptive sizing, fallback, clamping, and retry behavior
  • Maven verify
  • JaCoCo report generation
  • JMH executable packaging
  • a short JMH run covering both queue wait strategies

Publication plan

The repository remains private during review. After this PR is merged, the previous repository history will be replaced with a clean public history containing only the independent project. The same repository will then be renamed to java-backend-primitives and made public.

No additional repository will be created.

@azamir911 azamir911 closed this Jul 19, 2026
@azamir911 azamir911 reopened this Jul 19, 2026
@azamir911
azamir911 marked this pull request as ready for review July 19, 2026 18:31
@azamir911
azamir911 marked this pull request as draft July 19, 2026 18:44
@azamir911 azamir911 changed the title Rebuild repository as Java concurrency primitives Rebuild repository as Java backend primitives Jul 19, 2026
@azamir911
azamir911 marked this pull request as ready for review July 19, 2026 19:05
@azamir911 azamir911 closed this Jul 19, 2026
@azamir911 azamir911 reopened this Jul 19, 2026
@azamir911
azamir911 marked this pull request as draft July 19, 2026 23:24
@azamir911 azamir911 closed this Jul 19, 2026
@azamir911 azamir911 reopened this Jul 19, 2026
@azamir911
azamir911 marked this pull request as ready for review July 19, 2026 23:29
@azamir911
azamir911 marked this pull request as draft July 20, 2026 08:21
@azamir911
azamir911 marked this pull request as ready for review July 20, 2026 08:33
@azamir911
azamir911 merged commit e103b34 into main Jul 20, 2026
2 checks passed
@azamir911
azamir911 deleted the agent/rebuild-java-concurrency-primitives branch July 20, 2026 10:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant