You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ab...@apache.org on 2017/05/10 00:39:11 UTC

[4/5] geode-examples git commit: GEODE-2831 Update examples to clarify steps to follow

GEODE-2831 Update examples to clarify steps to follow


Project: http://git-wip-us.apache.org/repos/asf/geode-examples/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode-examples/commit/69973da7
Tree: http://git-wip-us.apache.org/repos/asf/geode-examples/tree/69973da7
Diff: http://git-wip-us.apache.org/repos/asf/geode-examples/diff/69973da7

Branch: refs/heads/develop
Commit: 69973da734c95e2d3ed96fb6c2edcf5106632695
Parents: 4a678e4
Author: Anthony Baker <ab...@apache.org>
Authored: Tue May 9 14:15:47 2017 -0700
Committer: Anthony Baker <ab...@apache.org>
Committed: Tue May 9 14:15:47 2017 -0700

----------------------------------------------------------------------
 loader/README.md                                | 10 +----
 .../geode/examples/loader/QuoteLoader.java      | 40 ++++++++++----------
 partitioned/README.md                           | 13 +++----
 .../geode/examples/partitioned/EmployeeKey.java |  6 +--
 replicated/README.md                            |  4 +-
 5 files changed, 30 insertions(+), 43 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode-examples/blob/69973da7/loader/README.md
----------------------------------------------------------------------
diff --git a/loader/README.md b/loader/README.md
index db61cfb..e69d9c9 100644
--- a/loader/README.md
+++ b/loader/README.md
@@ -45,14 +45,6 @@ This example assumes you have installed Java and Geode.
     server logs.  You can find those at `build/server1/server1.log` or
     `build/server2/server2.log`.
 
-4. Kill one of the servers
-
-        $ gfsh -e "connect --locator=127.0.0.1[10334]" -e "stop server --name=server1"
-
-5. Run the example a second time, and notice that all the entries are still available due to replication
-
-        $ ../gradlew run 
-
-6. Shut down the system:
+4. Shut down the system:
 
         $ gfsh run --file=scripts/stop.gfsh

http://git-wip-us.apache.org/repos/asf/geode-examples/blob/69973da7/loader/src/main/java/org/apache/geode/examples/loader/QuoteLoader.java
----------------------------------------------------------------------
diff --git a/loader/src/main/java/org/apache/geode/examples/loader/QuoteLoader.java b/loader/src/main/java/org/apache/geode/examples/loader/QuoteLoader.java
index bc28bca..522365d 100644
--- a/loader/src/main/java/org/apache/geode/examples/loader/QuoteLoader.java
+++ b/loader/src/main/java/org/apache/geode/examples/loader/QuoteLoader.java
@@ -62,40 +62,40 @@ public class QuoteLoader implements CacheLoader<String, String>, Declarable {
 
     // sourced from http://www.writersdigest.com/writing-quotes
     quotes.put("Anton Chekhov",
-        "My own experience is that once a story has been written, one has to cross out the beginning and the end. It is there that we authors do most of our lying");
+        "My own experience is that once a story has been written, one has to cross out the beginning and the end. It is there that we authors do most of our lying.");
     quotes.put("C. J. Cherryh",
-        "It is perfectly okay to write garbage—as long as you edit brilliantly");
-    quotes.put("Dorothy Parker", "I can’t write five words but that I change seven");
+        "It is perfectly okay to write garbage—as long as you edit brilliantly.");
+    quotes.put("Dorothy Parker", "I can’t write five words but that I change seven.");
     quotes.put("Douglas Adams",
-        "I love deadlines. I like the whooshing sound they make as they fly by");
-    quotes.put("Emily Dickinson", "A wounded deer leaps the highest");
-    quotes.put("Ernest Hemingway", "Prose is architecture, not interior decoration");
+        "I love deadlines. I like the whooshing sound they make as they fly by.");
+    quotes.put("Emily Dickinson", "A wounded deer leaps the highest.");
+    quotes.put("Ernest Hemingway", "Prose is architecture, not interior decoration.");
     quotes.put("F. Scott Fitzgerald",
-        "Begin with an individual, and before you know it you have created a type; begin with a type, and you find you have created – nothing");
+        "Begin with an individual, and before you know it you have created a type; begin with a type, and you find you have created – nothing.");
     quotes.put("Henry David Thoreau",
-        "Not that the story need be long, but it will take a long while to make it short");
+        "Not that the story need be long, but it will take a long while to make it short.");
     quotes.put("Henry Wadsworth Longfellow",
-        "Great is the art of beginning, but greater is the art of ending");
-    quotes.put("Herman Melville", "To produce a mighty book, you must choose a mighty theme");
-    quotes.put("Jean-Paul Sartre", "Poetry creates the myth, the prose writer draws its portrait");
+        "Great is the art of beginning, but greater is the art of ending.");
+    quotes.put("Herman Melville", "To produce a mighty book, you must choose a mighty theme.");
+    quotes.put("Jean-Paul Sartre", "Poetry creates the myth, the prose writer draws its portrait.");
     quotes.put("Mark Twain",
-        "Most writers regard the truth as their most valuable possession, and therefore are most economical in its use");
+        "Most writers regard the truth as their most valuable possession, and therefore are most economical in its use.");
     quotes.put("Orson Scott Card",
-        "Everybody walks past a thousand story ideas every day. The good writers are the ones who see five or six of them. Most people don’t see any");
+        "Everybody walks past a thousand story ideas every day. The good writers are the ones who see five or six of them. Most people don’t see any.");
     quotes.put("Ray Bradbury",
-        "Any man who keeps working is not a failure. He may not be a great writer, but if he applies the old-fashioned virtues of hard, constant labor, he’ll eventually make some kind of career for himself as writer");
+        "Any man who keeps working is not a failure. He may not be a great writer, but if he applies the old-fashioned virtues of hard, constant labor, he’ll eventually make some kind of career for himself as writer.");
     quotes.put("Robert Benchley",
-        "It took me fifteen years to discover I had no talent for writing, but I couldn’t give it up because by that time I was too famous");
+        "It took me fifteen years to discover I had no talent for writing, but I couldn’t give it up because by that time I was too famous.");
     quotes.put("Somerset Maugham",
-        "If you can tell stories, create characters, devise incidents, and have sincerity and passion, it doesn’t matter a damn how you write");
+        "If you can tell stories, create characters, devise incidents, and have sincerity and passion, it doesn’t matter a damn how you write.");
     quotes.put("Stephen King",
-        "I try to create sympathy for my characters, then turn the monsters loose");
+        "I try to create sympathy for my characters, then turn the monsters loose.");
     quotes.put("Terry Pratchett",
-        "There’s no such thing as writer’s block. That was invented by people in California who couldn’t write");
+        "There’s no such thing as writer’s block. That was invented by people in California who couldn’t write.");
     quotes.put("Ursula K. Le Guin",
-        "The unread story is not a story; it is little black marks on wood pulp. The reader, reading it, makes it live: a live thing, a story");
+        "The unread story is not a story; it is little black marks on wood pulp. The reader, reading it, makes it live: a live thing, a story.");
     quotes.put("William Faulkner",
-        "Get it down. Take chances. It may be bad, but it’s the only way you can do anything really good");
+        "Get it down. Take chances. It may be bad, but it’s the only way you can do anything really good.");
 
     return quotes;
   }

http://git-wip-us.apache.org/repos/asf/geode-examples/blob/69973da7/partitioned/README.md
----------------------------------------------------------------------
diff --git a/partitioned/README.md b/partitioned/README.md
index db960bf..6334ce1 100644
--- a/partitioned/README.md
+++ b/partitioned/README.md
@@ -87,21 +87,18 @@ will also be retrieved from the region and printed to the console.
     the entries will be on each server.  And, the quantity on each server may
     vary if the example is started over and run again.
 
-5. The region entries are distributed across both servers.
-Stop one of the servers
+5. The region entries are distributed across both servers.  Stop one of the servers
 
         $ gfsh
         ...
         gfsh>connect --locators=127.0.0.1[10334]
         gfsh>stop server --name=server1
-        gfsh>quit
 
-6. Run the consumer a second time, and notice that approximately half of
-the entries of the ```EmployeeRegion``` are still available on the
-remaining server.
-Those hosted by the server that was stopped were lost.
+6. Run the query a second time, and notice that all the entries hosted on
+   `server1` are missing as expected.  Those hosted by the server that was stopped
+    were lost.
 
-        $ ../gradlew run
+        gfsh>query --query="select e.key from /example-region.entries e"
 
 7. Shut down the cluster
 

http://git-wip-us.apache.org/repos/asf/geode-examples/blob/69973da7/partitioned/src/main/java/org/apache/geode/examples/partitioned/EmployeeKey.java
----------------------------------------------------------------------
diff --git a/partitioned/src/main/java/org/apache/geode/examples/partitioned/EmployeeKey.java b/partitioned/src/main/java/org/apache/geode/examples/partitioned/EmployeeKey.java
index dd9d6ec..e6b475d 100644
--- a/partitioned/src/main/java/org/apache/geode/examples/partitioned/EmployeeKey.java
+++ b/partitioned/src/main/java/org/apache/geode/examples/partitioned/EmployeeKey.java
@@ -38,10 +38,8 @@ public class EmployeeKey implements Serializable {
 
   @Override
   public int hashCode() {
-    final int prime = 31;
-    int result = 1;
-    result = prime * result + emplNumber;
-    result = prime * result + ((name == null) ? 0 : name.hashCode());
+    int result = name.hashCode();
+    result = 31 * result + emplNumber;
     return result;
   }
 

http://git-wip-us.apache.org/repos/asf/geode-examples/blob/69973da7/replicated/README.md
----------------------------------------------------------------------
diff --git a/replicated/README.md b/replicated/README.md
index 4d0d32e..7a5a0f8 100644
--- a/replicated/README.md
+++ b/replicated/README.md
@@ -41,9 +41,9 @@ This example assumes you have installed Java and Geode.
 
         $ gfsh -e "connect --locator=127.0.0.1[10334]" -e "stop server --name=server1"
 
-5. Run the example a second time, and notice that all the entries are still available due to replication
+5. Run a gfsh query, and notice that all the entries are still available due to replication
 
-        $ ../gradlew run 
+        $ gfsh -e "connect --locator=127.0.0.1[10334]" -e "query --query='select e.key from /example-region.entries e'"
 
 6. Shut down the system: