kirklund commented on a change in pull request #6310:
URL: https://github.com/apache/geode/pull/6310#discussion_r613538126
##########
File path:
geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionClearMessage.java
##########
@@ -139,119 +136,118 @@ public int getDSFID() {
}
@Override
- public void fromData(DataInput in,
- DeserializationContext context) throws IOException,
ClassNotFoundException {
+ public void fromData(DataInput in, DeserializationContext context)
+ throws IOException, ClassNotFoundException {
super.fromData(in, context);
- this.cbArg = DataSerializer.readObject(in);
- op = PartitionedRegionClearMessage.OperationType.values()[in.readByte()];
- eventID = DataSerializer.readObject(in);
+ callbackArgument = DataSerializer.readObject(in);
+ operationType =
PartitionedRegionClearMessage.OperationType.values()[in.readByte()];
+ eventId = DataSerializer.readObject(in);
}
@Override
- public void toData(DataOutput out,
- SerializationContext context) throws IOException {
+ public void toData(DataOutput out, SerializationContext context) throws
IOException {
super.toData(out, context);
- DataSerializer.writeObject(this.cbArg, out);
- out.writeByte(op.ordinal());
- DataSerializer.writeObject(eventID, out);
+ DataSerializer.writeObject(callbackArgument, out);
+ out.writeByte(operationType.ordinal());
+ DataSerializer.writeObject(eventId, out);
+ }
+
+ @Override
+ protected void sendReply(InternalDistributedMember recipient, int
processorId,
+ DistributionManager distributionManager, ReplyException replyException,
+ PartitionedRegion partitionedRegion, long startTime) {
+ if (partitionedRegion != null && startTime > 0) {
+ partitionedRegion.getPrStats().endPartitionMessagesProcessing(startTime);
+ }
+ PartitionedRegionClearMessage.PartitionedRegionClearReplyMessage
+ .send(recipient, processorId, getReplySender(distributionManager),
operationType,
+ bucketsCleared, replyException);
}
/**
* The response on which to wait for all the replies. This response ignores
any exceptions
* received from the "far side"
*/
public static class PartitionedRegionClearResponse extends ReplyProcessor21 {
+
CopyOnWriteHashSet<Integer> bucketsCleared = new CopyOnWriteHashSet<>();
public PartitionedRegionClearResponse(InternalDistributedSystem system,
- Set<InternalDistributedMember> initMembers) {
- super(system, initMembers);
+ Set<InternalDistributedMember> recipients) {
+ super(system, recipients);
}
@Override
- public void process(DistributionMessage msg) {
- if (msg instanceof PartitionedRegionClearReplyMessage) {
- Set<Integer> buckets = ((PartitionedRegionClearReplyMessage)
msg).bucketsCleared;
+ public void process(DistributionMessage message) {
+ if (message instanceof PartitionedRegionClearReplyMessage) {
+ Set<Integer> buckets = ((PartitionedRegionClearReplyMessage)
message).bucketsCleared;
if (buckets != null) {
bucketsCleared.addAll(buckets);
}
}
- super.process(msg, true);
- }
- }
-
- @Override
- protected void sendReply(InternalDistributedMember member, int processorId,
- DistributionManager distributionManager, ReplyException ex,
- PartitionedRegion partitionedRegion, long startTime) {
- if (partitionedRegion != null) {
- if (startTime > 0) {
-
partitionedRegion.getPrStats().endPartitionMessagesProcessing(startTime);
- }
+ process(message, true);
}
- PartitionedRegionClearMessage.PartitionedRegionClearReplyMessage
- .send(member, processorId, getReplySender(distributionManager), op,
bucketsCleared,
- ex);
}
public static class PartitionedRegionClearReplyMessage extends ReplyMessage {
private Set<Integer> bucketsCleared;
- private OperationType op;
+ private OperationType operationType;
@Override
public boolean getInlineProcess() {
return true;
}
+ public static void send(InternalDistributedMember recipient, int
processorId,
+ ReplySender replySender, OperationType operationType, Set<Integer>
bucketsCleared,
+ ReplyException replyException) {
+ Objects.requireNonNull(recipient, "partitionedRegionClearReplyMessage
NULL reply message");
+
+ PartitionedRegionClearMessage.PartitionedRegionClearReplyMessage
replyMessage =
+ new
PartitionedRegionClearMessage.PartitionedRegionClearReplyMessage(processorId,
+ operationType, bucketsCleared, replyException);
+
+ replyMessage.setRecipient(recipient);
+ replySender.putOutgoing(replyMessage);
+ }
+
/**
* Empty constructor to conform to DataSerializable interface
*/
- public PartitionedRegionClearReplyMessage() {}
+ public PartitionedRegionClearReplyMessage() {
+ // Empty constructor to conform to DataSerializable interface
+ }
- private PartitionedRegionClearReplyMessage(int processorId, OperationType
op,
- Set<Integer> bucketsCleared, ReplyException ex) {
- super();
+ private PartitionedRegionClearReplyMessage(int processorId, OperationType
operationType,
+ Set<Integer> bucketsCleared, ReplyException replyException) {
this.bucketsCleared = bucketsCleared;
- this.op = op;
+ this.operationType = operationType;
setProcessorId(processorId);
- setException(ex);
- }
-
- /** Send an ack */
- public static void send(InternalDistributedMember recipient, int
processorId, ReplySender dm,
- OperationType op, Set<Integer> bucketsCleared, ReplyException ex) {
-
- Assert.assertTrue(recipient != null, "partitionedRegionClearReplyMessage
NULL reply message");
-
- PartitionedRegionClearMessage.PartitionedRegionClearReplyMessage m =
- new
PartitionedRegionClearMessage.PartitionedRegionClearReplyMessage(processorId,
op,
- bucketsCleared, ex);
-
- m.setRecipient(recipient);
- dm.putOutgoing(m);
+ setException(replyException);
}
/**
* Processes this message. This method is invoked by the receiver of the
message.
*
- * @param dm the distribution manager that is processing the message.
+ * @param distributionManager the distribution manager that is processing
the message.
*/
@Override
- public void process(final DistributionManager dm, final ReplyProcessor21
rp) {
- final long startTime = getTimestamp();
+ public void process(DistributionManager distributionManager,
+ ReplyProcessor21 replyProcessor21) {
Review comment:
We've discussed this before Bill, and I disagree. Unless the Geode
community discusses and agrees to change EVERY potentially final variable and
parameter to be final, then there's no point. Also, final only really has an
important effect on fields. If I write a method with a parameter and I never
reassign that parameter to a new value, then I flat out disagree that it needs
to be labeled final. I'm sorry, but if you disagree and if you feel strongly
(as it seems), please bring this up in geode-dev.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]