Record Class TwoPhaseCommit
java.lang.Object
java.lang.Record
org.jgroups.admin.TwoPhaseCommit
public record TwoPhaseCommit(String key, String name, AdminHandler admin, Address dest, List<Address> targets, String prepare, String rollback, String commit, long timeout, ResponseCollector<String> rsps)
extends Record
Component which is used on the sender side. Sends a PREPARE command (string) to all members, waits for the results.
If a timeout occurred, or some of the results are "FAIL", then a ROLLBACK command is sent, else (if set) a
COMMIT command.
Returns true or false accordingly.
Returns true or false accordingly.
- Since:
- 5.6.0
- Author:
- Bela Ban
-
Constructor Summary
ConstructorsConstructorDescriptionTwoPhaseCommit(String key, String name, AdminHandler admin, Address dest, List<Address> targets, String prepare, String rollback, String commit, long timeout) TwoPhaseCommit(String key, String name, AdminHandler admin, Address dest, List<Address> targets, String prepare, String rollback, String commit, long timeout, ResponseCollector<String> rsps) Creates an instance of aTwoPhaseCommitrecord class. -
Method Summary
Modifier and TypeMethodDescriptionadmin()Returns the value of theadminrecord component.commit()Returns the value of thecommitrecord component.dest()Returns the value of thedestrecord component.final booleanIndicates whether some other object is "equal to" this one.booleanexecute()voidhandleResponse(Address sender, String rsp) final inthashCode()Returns a hash code value for this object.key()Returns the value of thekeyrecord component.name()Returns the value of thenamerecord component.voidprepare()Returns the value of thepreparerecord component.rollback()Returns the value of therollbackrecord component.rsps()Returns the value of therspsrecord component.targets()Returns the value of thetargetsrecord component.longtimeout()Returns the value of thetimeoutrecord component.toString()Returns a string representation of this record class.
-
Constructor Details
-
TwoPhaseCommit
-
TwoPhaseCommit
public TwoPhaseCommit(String key, String name, AdminHandler admin, Address dest, List<Address> targets, String prepare, String rollback, String commit, long timeout, ResponseCollector<String> rsps) Creates an instance of aTwoPhaseCommitrecord class.- Parameters:
key- the value for thekeyrecord componentname- the value for thenamerecord componentadmin- the value for theadminrecord componentdest- the value for thedestrecord componenttargets- the value for thetargetsrecord componentprepare- the value for thepreparerecord componentrollback- the value for therollbackrecord componentcommit- the value for thecommitrecord componenttimeout- the value for thetimeoutrecord componentrsps- the value for therspsrecord component
-
-
Method Details
-
execute
public boolean execute() -
performRollback
public void performRollback() -
handleResponse
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
key
Returns the value of thekeyrecord component.- Returns:
- the value of the
keyrecord component
-
name
Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
admin
Returns the value of theadminrecord component.- Returns:
- the value of the
adminrecord component
-
dest
Returns the value of thedestrecord component.- Returns:
- the value of the
destrecord component
-
targets
-
prepare
Returns the value of thepreparerecord component.- Returns:
- the value of the
preparerecord component
-
rollback
Returns the value of therollbackrecord component.- Returns:
- the value of the
rollbackrecord component
-
commit
Returns the value of thecommitrecord component.- Returns:
- the value of the
commitrecord component
-
timeout
public long timeout()Returns the value of thetimeoutrecord component.- Returns:
- the value of the
timeoutrecord component
-
rsps
Returns the value of therspsrecord component.- Returns:
- the value of the
rspsrecord component
-