You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ja...@apache.org on 2016/12/07 00:21:02 UTC
geode git commit: GEODE-2164: Refactored out NAMES_ARRAY from
CqNameToOpSingleEntry
Repository: geode
Updated Branches:
refs/heads/develop c8603efcd -> 9dd4205da
GEODE-2164: Refactored out NAMES_ARRAY from CqNameToOpSingleEntry
Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/9dd4205d
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/9dd4205d
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/9dd4205d
Branch: refs/heads/develop
Commit: 9dd4205daa662df7aadf9f30f6fa4ba21e7b6130
Parents: c8603ef
Author: Jason Huynh <hu...@gmail.com>
Authored: Thu Dec 1 10:27:50 2016 -0800
Committer: Jason Huynh <hu...@gmail.com>
Committed: Tue Dec 6 15:58:01 2016 -0800
----------------------------------------------------------------------
.../tier/sockets/ClientUpdateMessageImpl.java | 22 ++++++++------------
1 file changed, 9 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/geode/blob/9dd4205d/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ClientUpdateMessageImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ClientUpdateMessageImpl.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ClientUpdateMessageImpl.java
index a202ba2..6bbe7b8 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ClientUpdateMessageImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ClientUpdateMessageImpl.java
@@ -1464,12 +1464,11 @@ public class ClientUpdateMessageImpl implements ClientUpdateMessage, Sizeable, N
* much smaller memory footprint than a HashMap with one entry.
*/
public static class CqNameToOpSingleEntry implements CqNameToOp {
- private String name;
+ private String[] name;
private int op;
private static final String[] EMPTY_NAMES_ARRAY = new String[0];
- private static Map<String, String[]> NAMES_ARRAY = new ConcurrentHashMap<String, String[]>();
public CqNameToOpSingleEntry(String name, Integer op) {
initializeName(name);
@@ -1477,10 +1476,7 @@ public class ClientUpdateMessageImpl implements ClientUpdateMessage, Sizeable, N
}
private void initializeName(String name) {
- this.name = name;
- if (!NAMES_ARRAY.containsKey(name)) {
- NAMES_ARRAY.put(name, new String[] {name});
- }
+ this.name = new String[] {name};
}
@Override
@@ -1490,7 +1486,7 @@ public class ClientUpdateMessageImpl implements ClientUpdateMessage, Sizeable, N
int size = size();
InternalDataSerializer.writeArrayLength(size, out);
if (size > 0) {
- DataSerializer.writeObject(this.name, out);
+ DataSerializer.writeObject(this.name[0], out);
DataSerializer.writeObject(Integer.valueOf(this.op), out);
}
}
@@ -1503,7 +1499,7 @@ public class ClientUpdateMessageImpl implements ClientUpdateMessage, Sizeable, N
@Override
public void addToMessage(Message message) {
if (!isEmpty()) {
- message.addStringPart(this.name, true);
+ message.addStringPart(this.name[0], true);
message.addIntPart(this.op);
}
}
@@ -1515,15 +1511,15 @@ public class ClientUpdateMessageImpl implements ClientUpdateMessage, Sizeable, N
@Override
public String[] getNames() {
- return (isEmpty()) ? EMPTY_NAMES_ARRAY : NAMES_ARRAY.get(this.name);
+ return (isEmpty()) ? EMPTY_NAMES_ARRAY : this.name;
}
@Override
public void add(String name, Integer op) {
if (isEmpty()) {
- this.name = name;
+ this.name = new String[] {name};
this.op = op.intValue();
- } else if (this.name.equals(name)) {
+ } else if (this.name[0].equals(name)) {
this.op = op.intValue();
} else {
throw new IllegalStateException("tried to add to a full CqNameToOpSingleEntry");
@@ -1532,7 +1528,7 @@ public class ClientUpdateMessageImpl implements ClientUpdateMessage, Sizeable, N
@Override
public void delete(String name) {
- if (name.equals(this.name)) {
+ if (name.equals(this.name[0])) {
this.name = null;
}
}
@@ -1552,7 +1548,7 @@ public class ClientUpdateMessageImpl implements ClientUpdateMessage, Sizeable, N
public CqNameToOpHashMap(CqNameToOpSingleEntry se) {
super(2, 1.0f);
- add(se.name, se.op);
+ add(se.name[0], se.op);
}
@Override