pivotal-jbarrett commented on a change in pull request #6684:
URL: https://github.com/apache/geode/pull/6684#discussion_r675209510
##########
File path:
geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ClientProxyMembershipID.java
##########
@@ -176,149 +177,114 @@ public static ClientProxyMembershipID
getClientId(DistributedMember member) {
return new ClientProxyMembershipID(member);
}
- public static byte[] initializeAndGetDSIdentity(DistributedSystem sys) {
- byte[] client_side_identity = null;
+ public static byte[] initializeAndGetDSIdentity(final DistributedSystem sys)
{
+ final byte[] client_side_identity;
if (sys == null) {
- // DistributedSystem is required now before handshaking -Kirk
+ // DistributedSystem is required now before handshaking
throw new IllegalStateException(
"Attempting to handshake with CacheServer before creating
DistributedSystem and Cache.");
}
- {
- systemMemberId = sys.getDistributedMember();
- try (HeapDataOutputStream hdos = new HeapDataOutputStream(256,
KnownVersion.CURRENT)) {
- if (systemMemberId != null) {
- // update the durable id of the member identifier before serializing
in case
- // a pool name has been established
- DurableClientAttributes attributes =
systemMemberId.getDurableClientAttributes();
- if (attributes != null && attributes.getId().length() > 0) {
- ((InternalDistributedMember)
systemMemberId).setDurableId(attributes.getId());
- }
+ systemMemberId = sys.getDistributedMember();
+ try (HeapDataOutputStream hdos = new HeapDataOutputStream(256,
KnownVersion.CURRENT)) {
+ if (systemMemberId != null) {
+ // update the durable id of the member identifier before serializing
in case
+ // a pool name has been established
+ DurableClientAttributes attributes =
systemMemberId.getDurableClientAttributes();
+ if (attributes != null && attributes.getId().length() > 0) {
+ ((InternalDistributedMember)
systemMemberId).setDurableId(attributes.getId());
}
- DataSerializer.writeObject(systemMemberId, hdos);
- client_side_identity = hdos.toByteArray();
- } catch (IOException ioe) {
- throw new InternalGemFireException(
- "Unable to serialize identity",
- ioe);
}
-
- system = sys;
+ DataSerializer.writeObject(systemMemberId, hdos);
+ client_side_identity = hdos.toByteArray();
+ } catch (IOException ioe) {
+ throw new InternalGemFireException("Unable to serialize identity", ioe);
}
+ system = sys;
return client_side_identity;
-
}
private ClientProxyMembershipID(int id, byte[] clientSideIdentity) {
- boolean specialCase = Boolean.getBoolean(GeodeGlossary.GEMFIRE_PREFIX +
"SPECIAL_DURABLE");
- String durableID =
this.system.getProperties().getProperty(DURABLE_CLIENT_ID);
+ this(clientSideIdentity, getUniqueId(id), systemMemberId);
+ }
+
+ private static int getUniqueId(final int id) {
+ final boolean specialCase =
+ Boolean.getBoolean(GeodeGlossary.GEMFIRE_PREFIX + "SPECIAL_DURABLE");
+ final String durableID =
system.getProperties().getProperty(DURABLE_CLIENT_ID);
if (specialCase && durableID != null && (!durableID.equals(""))) {
- this.uniqueId = durable_synch_counter;
+ return durable_synch_counter;
} else {
- this.uniqueId = id;
+ return id;
}
- this.identity = clientSideIdentity;
- this.memberId = systemMemberId;
}
public ClientProxyMembershipID() {}
- public ClientProxyMembershipID(DistributedMember member) {
- this.uniqueId = 1;
- this.memberId = member;
+ public ClientProxyMembershipID(final DistributedMember member) {
+ this(null, 1, member);
updateID(member);
Review comment:
Yeah, I agree. I saw all that and said nope!
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]