Package com.tnsai.coordination
Class Contract
java.lang.Object
com.tnsai.coordination.Contract
Represents a contract awarded to a contractor in the Contract-Net protocol.
A contract is created when a manager accepts a proposal.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcomplete(TaskResult result) Completes the contract with a result.booleanvoidMarks the contract as failed.voidMarks the contract as in progress.toString()
-
Constructor Details
-
Contract
-
-
Method Details
-
markInProgress
public void markInProgress()Marks the contract as in progress. Thread-safe: volatile write ensures visibility across threads. -
complete
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
-
getTaskId
-
getManagerId
-
getContractorId
-
getAcceptedProposal
-
getAwardedAt
-
getStatus
-
getResult
-
getCompletedAt
-
isCompleted
public boolean isCompleted() -
toString
-