Class Contract

java.lang.Object
com.tnsai.coordination.Contract

public class Contract extends Object
Represents a contract awarded to a contractor in the Contract-Net protocol. A contract is created when a manager accepts a proposal.
  • Constructor Details

  • Method Details

    • markInProgress

      public void markInProgress()
      Marks the contract as in progress. Thread-safe: volatile write ensures visibility across threads.
    • complete

      public void complete(TaskResult result)
      Completes the contract with a result. Thread-safe: synchronized to ensure result, completedAt, and status are consistent.
    • markFailed

      public void markFailed()
      Marks the contract as failed. Thread-safe: synchronized to ensure completedAt and status are consistent.
    • getContractId

      public String getContractId()
    • getTaskId

      public String getTaskId()
    • getManagerId

      public String getManagerId()
    • getContractorId

      public String getContractorId()
    • getAcceptedProposal

      public Proposal getAcceptedProposal()
    • getAwardedAt

      public Instant getAwardedAt()
    • getStatus

      public Contract.ContractStatus getStatus()
    • getResult

      public TaskResult getResult()
    • getCompletedAt

      public Instant getCompletedAt()
    • isCompleted

      public boolean isCompleted()
    • toString

      public String toString()
      Overrides:
      toString in class Object