Klasse InactivityReleaseRepository

java.lang.Object
de.delinkedde.areashopreborn.persistence.InactivityReleaseRepository

public final class InactivityReleaseRepository extends Object
Persists idempotent inactivity ownership returns and their recovery state.
  • Konstruktordetails

    • InactivityReleaseRepository

      public InactivityReleaseRepository(Database database)
      Creates the repository.
      Parameter:
      database - database owner
  • Methodendetails

    • findDirectlyOwned

      public List<EstateRegion> findDirectlyOwned(UUID ownerId) throws SQLException
      Finds regions directly owned by a player.
      Parameter:
      ownerId - owner identifier
      Gibt zurück:
      directly owned regions
      Löst aus:
      SQLException - when persistence fails
    • findReleaseCandidates

      public List<EstateRegion> findReleaseCandidates(UUID ownerId, int limit) throws SQLException
      Finds a bounded batch of parcels that still satisfy the database-only release rules.

      Filtering before materializing domain snapshots prevents one unusually large owner from monopolizing the SQLite worker or allocating an unbounded list. The transactional update repeats the decisive predicates before changing ownership.

      Parameter:
      ownerId - owner identifier
      limit - maximum candidate count
      Gibt zurück:
      stable oldest-first candidate batch
      Löst aus:
      SQLException - when the query fails
    • prepare

      public InactivityReleaseAction prepare(EstateRegion region, UUID recipientId, Instant now) throws SQLException
      Creates an intent unless this owner-region pair was already processed.
      Parameter:
      region - target region
      recipientId - return recipient
      now - creation timestamp
      Gibt zurück:
      newly created or existing action
      Löst aus:
      SQLException - when persistence fails
    • applyDatabase

      public boolean applyDatabase(InactivityReleaseAction action, Instant now) throws SQLException
      Atomically transfers eligible SQLite ownership and advances the journal.
      Parameter:
      action - prepared action
      now - transition timestamp
      Gibt zurück:
      whether this call applied the transition
      Löst aus:
      SQLException - when persistence fails or eligibility changed
    • complete

      public void complete(UUID actionId, Instant now) throws SQLException
      Marks WorldGuard work complete.
      Parameter:
      actionId - action identifier
      now - completion timestamp
      Löst aus:
      SQLException - when persistence fails
    • manualReview

      public void manualReview(UUID actionId, String detail, Instant now) throws SQLException
      Quarantines a failed WorldGuard transition.
      Parameter:
      actionId - action identifier
      detail - bounded diagnostic detail
      now - transition timestamp
      Löst aus:
      SQLException - when persistence fails
    • findById

      public Optional<InactivityReleaseAction> findById(UUID actionId) throws SQLException
      Finds an action by identifier for administration and recovery.
      Parameter:
      actionId - action identifier
      Gibt zurück:
      matching action when present
      Löst aus:
      SQLException - when persistence fails
    • findDatabaseApplied

      public List<InactivityReleaseAction> findDatabaseApplied() throws SQLException
      Lists actions whose SQLite transition committed but whose WorldGuard stage did not finish.
      Gibt zurück:
      oldest recoverable actions first
      Löst aus:
      SQLException - when persistence fails
    • findDatabaseApplied

      public List<InactivityReleaseAction> findDatabaseApplied(int limit) throws SQLException
      Lists a bounded oldest-first batch whose WorldGuard stage still needs recovery.
      Parameter:
      limit - maximum actions returned
      Gibt zurück:
      oldest recoverable actions first
      Löst aus:
      SQLException - when persistence fails
    • completeRecovery

      public void completeRecovery(InactivityReleaseAction action, Instant now) throws SQLException
      Atomically restores the region lifecycle and completes a manually retried action.
      Parameter:
      action - action whose WorldGuard stage was successfully retried
      now - completion timestamp
      Löst aus:
      SQLException - when state changed concurrently or persistence fails