static MapKeyLoader . Role assignRole ( boolean isPartitionOwner , boolean isMapNamePartition , boolean isMapNamePartitionFirstReplica ) { if ( isMapNamePartition ) { if ( isPartitionOwner ) { // map-name partition owner is the SENDER return MapKeyLoader . Role . SENDER ; } else { if ( isMapNamePartitionFirstReplica ) { // first replica of the map-name partition is the SENDER_BACKUP return MapKeyLoader . Role . SENDER_BACKUP ; } else { // other replicas of the map-name partition do not have a role return MapKeyLoader . Role . NONE ; } } } else { // ordinary partition owners are RECEIVERs, otherwise no role return isPartitionOwner ? MapKeyLoader . Role . RECEIVER : MapKeyLoader . Role . NONE ; } }
Returns the role for the map key loader based on the passed parameters . The partition owner of the map name partition is the sender . The first replica of the map name partition is the sender backup . Other partition owners are receivers and other partition replicas do not have a role .