geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@apache.org
Subject [49/51] [partial] geode git commit: Software Grant Agreement (SGA) from Pivotal for Apache Geode
Date Fri, 13 Jan 2017 22:46:33 GMT
http://git-wip-us.apache.org/repos/asf/geode/blob/2d4a7ecd/examples/clicache/CacheRunner/CacheRunner.cs
----------------------------------------------------------------------
diff --git a/examples/clicache/CacheRunner/CacheRunner.cs b/examples/clicache/CacheRunner/CacheRunner.cs
new file mode 100644
index 0000000..09515aa
--- /dev/null
+++ b/examples/clicache/CacheRunner/CacheRunner.cs
@@ -0,0 +1,698 @@
+//=========================================================================
+// Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
+// This product is protected by U.S. and international copyright
+// and intellectual property laws. Pivotal products are covered by
+// more patents listed at http://www.pivotal.io/patents.
+//========================================================================
+
+using System;
+
+namespace GemStone.GemFire.Cache.Examples
+{
+  using GemStone.GemFire.Cache.Tests;
+  using GemStone.GemFire.Cache;
+
+  // Example class to perform puts/gets using one or more clients.
+  class CacheRunner
+  {
+    #region Local constants
+
+    private static string DefaultXMLPath = "tcr_cache.xml";
+
+    #endregion
+
+    #region Private static members
+
+    private static Cache m_cache = null;
+    private static Region m_region = null;
+
+    #endregion
+
+    static void Main(string[] args)
+    {
+      try
+      {
+        // Connect to distributed system and cache 
+        DSInit(args);
+
+        // Enter puts and gets manually
+        DoCommand();
+      }
+      catch (Exception ex)
+      {
+        Console.WriteLine("{0}An exception occurred: {1}",
+          Environment.NewLine, ex.Message);
+        Console.WriteLine("---[ Press <Enter> to End the Application ]---");
+        Console.ReadLine();
+      }
+      finally
+      {
+        try
+        {
+          // Close the cache and disconnect
+          DSClose();
+        }
+        catch // Ignore any exception here.
+        {
+        }
+      }
+    }
+
+    #region Local functions
+
+    // Initialize the distributed system, setup the cache, register callbacks
+    // and user-defined classes and create the region.
+    public static void DSInit(string[] args)
+    {
+      Console.WriteLine("{0}Connecting to GemFire{0}", Environment.NewLine);
+
+      // Register the ComplexNumber type
+      Serializable.RegisterType(ComplexNumber.Create);
+
+      // Register the Portfolio and Position classes for Query
+      Serializable.RegisterType(Portfolio.CreateDeserializable);
+      Serializable.RegisterType(Position.CreateDeserializable);
+
+      // Register the ExampleObject for putall and interop 
+      Serializable.RegisterType(ExampleObject.CreateDeserializable);
+
+      string xmlPath;
+      // Create a cache
+      if (args != null && args.Length > 1)
+      {
+        throw new ApplicationException(string.Format("Usage: CacheRunner " +
+          "[<XML file name>]{0}\tXML file name is optional " +
+          "and the default is {1}.", Environment.NewLine, DefaultXMLPath));
+      }
+      else if (args != null && args.Length == 1)
+      {
+        xmlPath = args[0];
+      }
+      else
+      {
+        xmlPath = DefaultXMLPath;
+      }
+      CacheFactory cacheFactory = CacheFactory.CreateCacheFactory(null);
+      m_cache = cacheFactory.Set("cache-xml-file", xmlPath).Create();
+      Region[] rootRegions = m_cache.RootRegions();
+      if (rootRegions != null && rootRegions.Length > 0)
+      {
+        SetRegion(rootRegions[rootRegions.Length - 1]);
+      }
+      else
+      {
+        throw new ApplicationException("No root regions found.");
+      }
+    }
+
+    // Close the cache and disconnect from the distributed system.
+    public static void DSClose()
+    {
+      // Close cache
+      if (m_cache != null)
+      {
+        m_cache.Close();
+        m_cache = null;
+        
+        Console.WriteLine("{0}Closed cache", Environment.NewLine);
+      }
+      Console.WriteLine("{0}Connection closed", Environment.NewLine);
+    }
+
+    private static void SetRegion(Region region)
+    {
+      m_region = region;
+      RegionAttributes attrs = m_region.Attributes;
+      if (attrs.ClientNotificationEnabled)
+      {
+        m_region.RegisterAllKeys();
+      }
+      // Add cache listener callback to region
+      if (attrs.CacheListener == null)
+      {
+        ExampleCacheListenerCallback listenerCallback =
+          new ExampleCacheListenerCallback();
+        AttributesMutator mutator = m_region.GetAttributesMutator();
+        mutator.SetCacheListener(listenerCallback);
+      }
+    }
+
+    // Puts a string key and complex number value
+    public static void PutComplex(string key, ComplexNumber value)
+    {
+      m_region.Put(key, value);
+      Console.WriteLine("Put complex -- key: " + key + " value: " + value);
+    }
+
+    // Puts a string key and string value
+    public static void PutStr(string key, string value)
+    {
+      m_region.Put(key, value);
+      Console.WriteLine("Put string  -- key: " + key + " value: " + value);
+    }
+
+    // Puts a string key and bytes value
+    public static void PutBytes(string key, string value)
+    {
+      byte[] buffer = new byte[value.Length];
+      for (int index = 0; index < value.Length; index++)
+      {
+        buffer[index] = (byte)value[index];
+      }
+      m_region.Put(key, buffer);
+      Console.WriteLine("Put string  -- key: " + key + " value: " + value);
+    }
+
+    // Puts a string key and object
+    public static void PutObject(string key, IGFSerializable cValue)
+    {
+      m_region.Put(key, cValue);
+      Console.WriteLine("Put  -- key: " + key + " value: " + cValue);
+    }
+
+    // Puts a string key and portfolio object
+    public static void PutPortfolio(string key, int id)
+    {
+      Portfolio portfolio = new Portfolio(id, 2);
+      m_region.Put(key, portfolio);
+      Console.WriteLine("Put portfolio  -- key: " + key + " id: " + id);
+    }
+
+    // Puts a string key and position object
+    public static void PutPosition(string key, int id)
+    {
+      Position position = new Position(key, id);
+      m_region.Put(key, position);
+      Console.WriteLine("Put position  -- key: " + key + " id: " + id);
+    }
+
+    // Gets the value, if the key exists
+    public static string GetStr(string key)
+    {
+      string testStr = string.Empty;
+
+      IGFSerializable cValue = m_region.Get(key);
+      // Is the key found?
+      if (cValue != null)
+      {
+        testStr = cValue.ToString();
+
+        // Type of value?
+        if (cValue is CacheableBytes)
+        {
+          System.Text.StringBuilder sb = new System.Text.StringBuilder();
+          CacheableBytes cBytes = cValue as CacheableBytes;
+          foreach (byte b in cBytes.Value)
+          {
+            sb.Append((char)b);
+          }
+          testStr = sb.ToString();
+        }
+        else if (cValue is CacheableObjectXml)
+        {
+          object val = ((CacheableObjectXml)cValue).Value;
+          System.Xml.XmlDocument xd = val as System.Xml.XmlDocument;
+          if (xd != null)
+          {
+            testStr = xd.OuterXml;
+          }
+        }
+        Console.WriteLine("Get [{0}] -- key: {1}, value: {2}",
+          cValue.GetType().Name, key, testStr);
+      }
+      else
+      {
+        testStr = "NULL";
+        Console.WriteLine("No such key in region: " + key);
+      }
+
+      return testStr;
+    }
+
+    // Run the given query
+    public static void RunQuery(string query, bool isRegionQuery)
+    {
+      try
+      {
+        ISelectResults results = null;
+
+        if (isRegionQuery)
+        {
+          results = m_region.Query(query);
+        }
+        else
+        {
+          QueryService qs = m_cache.GetQueryService("examplePool");
+          Query qry = qs.NewQuery(query);
+          results = qry.Execute();
+        }
+        if (results is ResultSet)
+        {
+          uint index = 1;
+          foreach (IGFSerializable result in results)
+          {
+            Console.WriteLine("\tResult {0}: {1}", index, result);
+            index++;
+          }
+        }
+        else
+        {
+          StructSet ss = (StructSet)results;
+          Console.Write("Columns:");
+          uint index = 0;
+          string colName;
+          while ((colName = ss.GetFieldName(index)) != null)
+          {
+            Console.Write('\t' + colName);
+            index++;
+          }
+          Console.WriteLine();
+          index = 1;
+          foreach (Struct si in results)
+          {
+            Console.Write("\tResult {0}: ");
+            while (si.HasNext())
+            {
+              Console.Write(si.Next() + " || ");
+            }
+            Console.WriteLine();
+            index++;
+          }
+        }
+      }
+      catch (Exception ex)
+      {
+        Console.WriteLine("Exception while running the query [{0}]: {1}",
+          query, ex.Message);
+      }
+    }
+
+    // Run the given query and display the single result value
+    public static void SelectValue(string query)
+    {
+      try
+      {
+        IGFSerializable result = m_region.SelectValue(query);
+
+        if (result is Struct)
+        {
+          Struct si = result as Struct;
+          Console.Write("Columns:");
+          uint index = 0;
+          string colName;
+          while ((colName = si.Set.GetFieldName(index)) != null)
+          {
+            Console.Write('\t' + colName);
+            index++;
+          }
+          Console.WriteLine();
+
+          index = 0;
+          Console.Write("\tResult {0}: ");
+          while (si.HasNext())
+          {
+            Console.Write(si.Next() + " || ");
+          }
+          Console.WriteLine();
+          index++;
+        }
+        else
+        {
+          Console.WriteLine("\tResult : {0}", result);
+        }
+      }
+      catch (Exception ex)
+      {
+        Console.WriteLine("Exception while running the query [{0}]: {1}",
+          query, ex.Message);
+      }
+    }
+
+    private static int getTS(DateTime ts)
+    {
+      int ms = (ts.Hour * 3600 + ts.Minute * 60 + ts.Second) * 1000 + ts.Millisecond;
+      return ms;
+    }
+
+    // Run the given query and display if value exists
+    public static void ExistsValue(string query)
+    {
+      try
+      {
+        bool result = m_region.ExistsValue(query);
+
+        Console.WriteLine("\tResult is {0}", result);
+      }
+      catch (Exception ex)
+      {
+        Console.WriteLine("Exception while running the query [{0}]: {1}",
+          query, ex.Message);
+      }
+    }
+
+    // Waits for input of a command (chrgn, get, put, putAll, exec, query,
+    // existsvalue, selectvalue or quit), then does just that.
+    public static void DoCommand()
+    {
+      string myCmd = string.Empty;
+      string myKey;
+      string myValue;
+
+      while (myCmd != "quit")
+      {
+        Console.Write("{0}: chrgn, lsrgn, get, put, putAll, run, exec, query, " +
+          "existsvalue, selectvalue, quit: ", m_region.FullPath);
+
+        string strIn = Console.ReadLine().Trim();
+        string[] strSplit = strIn.Split(' ');
+
+        myCmd = strSplit[0];
+        myCmd = myCmd.ToLower();
+
+        if (myCmd == "q") { myCmd = "quit"; }
+
+        switch (myCmd)
+        {
+          case "chrgn":
+            if (strSplit.Length == 2)
+            {
+              string regionPath = strSplit[1].Trim();
+              Region region = null;
+              try
+              {
+                region = m_cache.GetRegion(regionPath);
+              }
+              catch
+              {
+              }
+              if (region == null)
+              {
+                Console.WriteLine("No region {0} found.", regionPath);
+                Console.WriteLine("usage: chrgn region-path");
+              }
+              else
+              {
+                SetRegion(region);
+              }
+            }
+            else
+            {
+              Console.WriteLine("usage: chrgn region-path \t change the " +
+                "current region to the given region; the region-path can " +
+                "be absolute or relative to the current region");
+            }
+            break;
+
+          case "lsrgn":
+            Region[] rootRegions = m_cache.RootRegions();
+            Console.Write("\nNumber of regions in Cache: {0}\n", rootRegions.Length);
+            int count = 1;
+            for (int rgnCnt = 0; rgnCnt < rootRegions.Length; rgnCnt++)
+            {
+              Console.Write("Region Name {0}: {1}\n",count++,rootRegions[rgnCnt].Name);
+            }
+            break;
+
+          case "run":
+            if (strSplit.Length == 3)
+            {
+              string myNumber = strSplit[1];
+              string mySize = strSplit[2];
+              int number = int.Parse(myNumber);
+              int size = int.Parse(mySize);
+              byte[] payload = new byte[size];
+
+              CacheableHashMap map = new CacheableHashMap();
+              int ts1 = getTS(System.DateTime.Now);
+              for (int i = 0; i < number; i++)
+              {
+                if (size == 0)
+                {
+                  map.Add(new CacheableInt32(i), new ExampleObject(i));
+                }
+                else
+                {
+                  map.Add(CacheableInt32.Create(i),
+                    CacheableBytes.Create(payload));
+                }
+              }
+              m_region.PutAll(map);
+              int ts2 = getTS(System.DateTime.Now);
+              Double run_t = (ts2 - ts1) / 1000.0;
+              Console.WriteLine("Ops/sec: {0}, {1}, {2}", number / run_t, ts1, ts2);
+            } else {
+              Console.WriteLine("usage: run numOfKeys entrySize");
+            }
+            break;
+
+          case "putall":
+            if (strSplit.Length == 3)
+            {
+              myKey = strSplit[1];
+              myValue = strSplit[2];
+              int num = int.Parse(myValue);
+
+              //byte[] payload = new byte[10];
+              //for (int index = 0; index < 10; index++)
+              //{
+              //payload[index] = 1;
+              //}
+
+              Console.WriteLine("putAll: " + myKey + ":" + num);
+
+              CacheableHashMap map = new CacheableHashMap();
+              map.Clear();
+              for (int i = 0; i < num; i++)
+              {
+                string key = myKey + i;
+                // map.Add(new CacheableString(key), (CacheableBytes)(payload));
+                map.Add(new CacheableString(key), new ExampleObject(i));
+                // map.Add(new CacheableString(key), new Position(i));
+              }
+              m_region.PutAll(map);
+            } else {
+              Console.WriteLine("usage: putAll keyBase numOfKeys");
+            }
+            break;
+
+          case "put":
+            if (strSplit.Length == 3)
+            {
+              myKey = strSplit[1];
+              myValue = strSplit[2];
+
+              // Check to see if value is ComplexNumber or String
+              ComplexNumber cNum = ComplexNumber.Parse(myValue);
+
+              if (cNum != null)
+              {
+                // Put the key and value
+                PutComplex(myKey, cNum);
+              }
+              else
+              {
+                // Put the key and value
+                PutStr(myKey, myValue);
+              }
+            }
+            else if (strSplit.Length == 4)
+            {
+              myKey = strSplit[1];
+              myValue = strSplit[2];
+              string type = strSplit[3];
+              type = type.ToLower();
+
+              switch (type)
+              {
+                case "str":
+                  PutStr(myKey, myValue);
+                  break;
+
+                case "bytes":
+                  PutBytes(myKey, myValue);
+                  break;
+
+                case "complex":
+                  ComplexNumber cNum = ComplexNumber.Parse(myValue);
+                  if (cNum != null)
+                  {
+                    PutComplex(myKey, cNum);
+                  }
+                  else
+                  {
+                    Console.WriteLine("Could not parse the complex number.");
+                  }
+                  break;
+
+                case "double":
+                  double dval = 0.0;
+                  try
+                  {
+                    dval = double.Parse(myValue);
+                  }
+                  catch (Exception ex)
+                  {
+                    Console.WriteLine("Double value [{0}] not valid: {1}.", myValue, ex);
+                    break;
+                  }
+                  PutObject(myKey, new CacheableDouble(dval));
+                  break;
+
+                case "float":
+                  float fval = 0.0F;
+                  try
+                  {
+                    fval = float.Parse(myValue);
+                  }
+                  catch (Exception ex)
+                  {
+                    Console.WriteLine("Float value [{0}] not valid: {1}.", myValue, ex);
+                    break;
+                  }
+                  PutObject(myKey, new CacheableFloat(fval));
+                  break;
+
+                case "obj":
+                  string xmlStr = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
+                  xmlStr += "<IndexMessage xmlns=\"urn:example.com:FinanceManager.Messages:v1.0\">";
+                  xmlStr += "<Keys>11</Keys><Keys>22</Keys><Keys>33</Keys></IndexMessage>";
+
+                  System.Xml.XmlDocument xd = new System.Xml.XmlDocument();
+                  xd.LoadXml(xmlStr);
+                  PutObject(myKey, CacheableObjectXml.Create(xd));
+                  break;
+
+                case "port":
+                  int id = 0;
+                  try
+                  {
+                    id = int.Parse(myValue);
+                  }
+                  catch
+                  {
+                    Console.WriteLine("Portfolio value [{0}] not a valid"
+                      + " integer ID.", myValue);
+                    break;
+                  }
+                  PutPortfolio(myKey, id);
+                  break;
+
+                case "pos":
+                  int id2 = 0;
+                  try
+                  {
+                    id2 = int.Parse(myValue);
+                  }
+                  catch
+                  {
+                    Console.WriteLine("Position value [{0}] not a valid"
+                      + " integer ID.", myValue);
+                    break;
+                  }
+                  PutPosition(myKey, id2);
+                  break;
+
+                default:
+                  Console.WriteLine("usage: put key value [str|bytes|complex|double|float|obj|port|pos]");
+                  break;
+              }
+            }
+            else
+            {
+              Console.WriteLine("usage: put key value [str|bytes|complex|double|float|obj|port|pos]");
+            }
+            break;
+
+          case "get":
+            if (strSplit.Length == 2)
+            {
+              myKey = strSplit[1];
+
+              // Get the value
+              string xStr = GetStr(myKey);
+            }
+            else
+            {
+              Console.WriteLine("usage: get key");
+            }
+
+            break;
+
+          case "exec":
+            if (strSplit.Length > 1)
+            {
+              string query = string.Empty;
+              for (int index = 1; index < strSplit.Length; index++)
+              {
+                query += strSplit[index] + ' ';
+              }
+              query = query.Trim();
+              RunQuery(query, false);
+            }
+            else
+            {
+              Console.WriteLine("usage: exec <select query string>");
+            }
+
+            break;
+
+          case "query":
+            if (strSplit.Length > 1)
+            {
+              string query = string.Empty;
+              for (int index = 1; index < strSplit.Length; index++)
+              {
+                query += strSplit[index] + ' ';
+              }
+              query = query.Trim();
+              RunQuery(query, true);
+            }
+            else
+            {
+              Console.WriteLine("usage: query <query predicate>");
+            }
+
+            break;
+
+          case "existsvalue":
+            if (strSplit.Length > 1)
+            {
+              string query = string.Empty;
+              for (int index = 1; index < strSplit.Length; index++)
+              {
+                query += strSplit[index] + ' ';
+              }
+              query = query.Trim();
+              ExistsValue(query);
+            }
+            else
+            {
+              Console.WriteLine("usage: existsvalue <query predicate>");
+            }
+
+            break;
+
+          case "selectvalue":
+            if (strSplit.Length > 1)
+            {
+              string query = string.Empty;
+              for (int index = 1; index < strSplit.Length; index++)
+              {
+                query += strSplit[index] + ' ';
+              }
+              query = query.Trim();
+              SelectValue(query);
+            }
+            else
+            {
+              Console.WriteLine("usage: selectvalue <query predicate>");
+            }
+
+            break;
+        }
+      }
+    }
+
+    #endregion
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/2d4a7ecd/examples/clicache/CacheRunner/CacheRunner.csproj
----------------------------------------------------------------------
diff --git a/examples/clicache/CacheRunner/CacheRunner.csproj b/examples/clicache/CacheRunner/CacheRunner.csproj
new file mode 100644
index 0000000..0bc705f
--- /dev/null
+++ b/examples/clicache/CacheRunner/CacheRunner.csproj
@@ -0,0 +1,129 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>8.0.50727</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{D8F67104-CDDE-433F-A8EE-470A92180AB9}</ProjectGuid>
+    <OutputType>Exe</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>GemStone.GemFire.Cache.Examples</RootNamespace>
+    <AssemblyName>CacheRunner</AssemblyName>
+    <FileUpgradeFlags>
+    </FileUpgradeFlags>
+    <OldToolsVersion>2.0</OldToolsVersion>
+    <UpgradeBackupLocation>
+    </UpgradeBackupLocation>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <IntermediateOutputPath>$(OSBUILDDIR)\examples\clicache\Debug\CacheRunner\</IntermediateOutputPath>
+    <OutputPath>$(OSBUILDDIR)\examples\clicache\Debug\CacheRunner\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <PlatformTarget>x86</PlatformTarget>
+    <NoWarn>618</NoWarn>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <IntermediateOutputPath>$(OSBUILDDIR)\examples\clicache\CacheRunner\</IntermediateOutputPath>
+    <OutputPath>$(OSBUILDDIR)\examples\clicache\CacheRunner\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <PlatformTarget>x86</PlatformTarget>
+    <NoWarn>618</NoWarn>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
+    <DebugSymbols>true</DebugSymbols>
+    <IntermediateOutputPath>$(OSBUILDDIR)\examples\clicache\Debug\CacheRunner\</IntermediateOutputPath>
+    <OutputPath>$(OSBUILDDIR)\examples\clicache\Debug\CacheRunner\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <PlatformTarget>x64</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <NoWarn>618</NoWarn>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
+    <IntermediateOutputPath>$(OSBUILDDIR)\examples\clicache\CacheRunner\</IntermediateOutputPath>
+    <OutputPath>$(OSBUILDDIR)\examples\clicache\CacheRunner\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <Optimize>true</Optimize>
+    <DebugType>pdbonly</DebugType>
+    <PlatformTarget>x64</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <NoWarn>618</NoWarn>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.XML" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="..\..\..\tests\clicache\TestObject\Portfolio.cs">
+      <Link>Portfolio.cs</Link>
+    </Compile>
+    <Compile Include="..\..\..\tests\clicache\TestObject\Position.cs">
+      <Link>Position.cs</Link>
+    </Compile>
+    <Compile Include="CacheRunner.cs" />
+    <Compile Include="Callbacks.cs" />
+    <Compile Include="ComplexNumber.cs" />
+    <Compile Include="ExampleObject.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\..\..\vs_projects\gfclicache\gfclicache.vcproj">
+      <Project>{B274E3B1-6A09-4322-952B-8BDA712892CE}</Project>
+      <Name>gfclicache</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <ItemGroup>
+    <Content Include="..\..\dist\cacheRunner\cacherunner.xml">
+      <Link>cacherunner.xml</Link>
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
+    <Content Include="..\..\dist\cacheRunner\cacherunner2.xml">
+      <Link>cacherunner2.xml</Link>
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
+    <Content Include="..\..\dist\cacheRunner\csQueryPortfolios.xml">
+      <Link>csQueryPortfolios.xml</Link>
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
+    <Content Include="..\..\dist\cacheRunner\csQueryPortfolios2.xml">
+      <Link>csQueryPortfolios2.xml</Link>
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
+    <Content Include="..\..\dist\cacheRunner\tcr_cache.xml">
+      <Link>tcr_cache.xml</Link>
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
+    <Content Include="..\..\dist\cacheRunner\tcr_cacheless.xml">
+      <Link>tcr_cacheless.xml</Link>
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
+    <Content Include="..\..\dist\cacheRunner\tcr_hacache.xml">
+      <Link>tcr_hacache.xml</Link>
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
+    <Content Include="..\..\dist\cacheRunner\tcr_hacacheless.xml">
+      <Link>tcr_hacacheless.xml</Link>
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
+  </ItemGroup>
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/geode/blob/2d4a7ecd/examples/clicache/CacheRunner/CacheRunner.csproj.user
----------------------------------------------------------------------
diff --git a/examples/clicache/CacheRunner/CacheRunner.csproj.user b/examples/clicache/CacheRunner/CacheRunner.csproj.user
new file mode 100644
index 0000000..f57edd2
--- /dev/null
+++ b/examples/clicache/CacheRunner/CacheRunner.csproj.user
@@ -0,0 +1,6 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <ReferencePath>$(OSBUILDDIR)\hidden\lib\</ReferencePath>
+    <ProjectView>ProjectFiles</ProjectView>
+  </PropertyGroup>
+</Project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/geode/blob/2d4a7ecd/examples/clicache/CacheRunner/Callbacks.cs
----------------------------------------------------------------------
diff --git a/examples/clicache/CacheRunner/Callbacks.cs b/examples/clicache/CacheRunner/Callbacks.cs
new file mode 100644
index 0000000..f0f6634
--- /dev/null
+++ b/examples/clicache/CacheRunner/Callbacks.cs
@@ -0,0 +1,85 @@
+/*=========================================================================
+ * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * more patents listed at http://www.pivotal.io/patents.
+ *========================================================================
+ */
+
+using System;
+
+namespace GemStone.GemFire.Cache.Examples
+{
+  /// <summary>
+  /// Capture and display cache events.
+  /// </summary>
+  class ExampleCacheListenerCallback : ICacheListener
+  {
+    public static ICacheListener Create()
+    {
+      return new ExampleCacheListenerCallback();
+    }
+
+    #region ICacheListener Members
+
+    public void AfterCreate(EntryEvent ev)
+    {
+      Console.WriteLine("{0}--- Received afterCreate event of: {1}",
+        Environment.NewLine, ev.Key);
+    }
+
+    public void AfterDestroy(EntryEvent ev)
+    {
+      Console.WriteLine("{0}--- Received afterDestroy event of: {1}",
+        Environment.NewLine, ev.Key);
+    }
+
+    public void AfterInvalidate(EntryEvent ev)
+    {
+      Console.WriteLine("{0}--- Received afterInvalidate event of: {1}",
+        Environment.NewLine, ev.Key);
+    }
+
+    public void AfterRegionClear(RegionEvent ev)
+    {
+      Console.WriteLine("{0}--- Received afterRegionClear event of region: {1}",
+        Environment.NewLine, ev.Region.Name);
+    }
+
+    public void AfterRegionDestroy(RegionEvent ev)
+    {
+      Console.WriteLine("{0}--- Received afterRegionDestroy event of region: {1}",
+        Environment.NewLine, ev.Region.Name);
+    }
+
+    public void AfterRegionInvalidate(RegionEvent ev)
+    {
+      Console.WriteLine("{0}--- Received afterRegionInvalidate event of region: {1}",
+        Environment.NewLine, ev.Region.Name);
+    }
+
+    public void AfterRegionLive(RegionEvent ev)
+    {
+      Console.WriteLine("{0}--- Received afterRegionLive event of region: {1}",
+        Environment.NewLine, ev.Region.Name);
+    }
+
+    public void AfterUpdate(EntryEvent ev)
+    {
+      Console.WriteLine("{0}--- Received afterUpdate event of: {1}",
+        Environment.NewLine, ev.Key);
+    }
+    
+    public void Close(Region region)
+    {
+      Console.WriteLine("{0}--- Received close event of region: {1}",
+        Environment.NewLine, region.Name);
+    }
+    public void AfterRegionDisconnected(Region region)
+    {
+      Console.WriteLine("{0}--- Received disconnected event of region: {1}",
+        Environment.NewLine, region.Name);
+    }
+    #endregion
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/2d4a7ecd/examples/clicache/CacheRunner/ComplexNumber.cs
----------------------------------------------------------------------
diff --git a/examples/clicache/CacheRunner/ComplexNumber.cs b/examples/clicache/CacheRunner/ComplexNumber.cs
new file mode 100644
index 0000000..9dc3ccb
--- /dev/null
+++ b/examples/clicache/CacheRunner/ComplexNumber.cs
@@ -0,0 +1,206 @@
+/*=========================================================================
+ * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * more patents listed at http://www.pivotal.io/patents.
+ *========================================================================
+ */
+
+using System;
+using System.Text.RegularExpressions;
+
+namespace GemStone.GemFire.Cache.Examples
+{
+  /// <summary>
+  /// A complex number -- no operations defined yet.
+  /// </summary>
+  public class ComplexNumber : GemStone.GemFire.Cache.Generic.ICacheableKey
+  {
+    #region Public Accessors
+
+    /// <summary>
+    /// The real portion of the complex number.
+    /// </summary>
+    public double Real
+    {
+      get
+      {
+        return m_real;
+      }
+      set
+      {
+        m_real = value;
+      }
+    }
+
+    /// <summary>
+    /// The imaginary portion of the complex number.
+    /// </summary>
+    public double Imaginary
+    {
+      get
+      {
+        return m_imaginary;
+      }
+      set
+      {
+        m_imaginary = value;
+      }
+    }
+
+    #endregion
+
+    #region Private members
+
+    private double m_real;
+    private double m_imaginary;
+
+    #endregion
+
+    #region Constructor and factory function
+
+    /// <summary>
+    /// Constructor.
+    /// </summary>
+    /// <param name="real">Real part</param>
+    /// <param name="imaginary">Imaginary part</param>
+    public ComplexNumber(double real, double imaginary)
+    {
+      m_real = real;
+      m_imaginary = imaginary;
+    }
+
+    /// <summary>
+    /// Factory function to be registered using
+    /// <see cref="Serializable.registerType" />.
+    /// </summary>
+    public static GemStone.GemFire.Cache.Generic.IGFSerializable Create()
+    {
+      return new ComplexNumber(0.0, 0.0);
+    }
+
+    #endregion
+
+    #region Serialization -- IGFSerializable members
+
+    /// <summary>
+    /// Read the complex number from the <see cref="DataInput" /> stream.
+    /// </summary>
+    /// <param name="input">The <c>DataInput</c> stream.</param>
+    /// <returns>A reference to <c>this</c> object.</returns>
+    public GemStone.GemFire.Cache.Generic.IGFSerializable FromData(GemStone.GemFire.Cache.Generic.DataInput input)
+    {
+      m_real = input.ReadDouble();
+      m_imaginary = input.ReadDouble();
+      return this;
+    }
+
+    /// <summary>
+    /// Write the complex number to the <see cref="DataOutput" /> stream.
+    /// </summary>
+    /// <param name="output">The <c>DataOutput</c> stream.</param>
+    public void ToData(GemStone.GemFire.Cache.Generic.DataOutput output)
+    {
+      output.WriteDouble(m_real);
+      output.WriteDouble(m_imaginary);
+    }
+
+    /// <summary>
+    /// return the size of this object in bytes
+    /// </summary>
+    public UInt32 ObjectSize
+    {
+      get
+      {
+        return (UInt32) (sizeof(double) + sizeof(double));
+      }
+    }
+
+    /// <summary>
+    /// Get the <see cref="IGFSerializable.ClassId" /> of this class.
+    /// </summary>
+    /// <returns>The classId.</returns>
+    public UInt32 ClassId
+    {
+      get
+      {
+        return 0x04;
+      }
+    }
+
+    #endregion
+
+    #region ICacheableKey Members
+
+    public bool Equals(GemStone.GemFire.Cache.Generic.ICacheableKey other)
+    {
+      ComplexNumber cOther = other as ComplexNumber;
+      if (cOther != null)
+      {
+        return (m_real == cOther.m_real) && (m_imaginary == cOther.m_imaginary);
+      }
+      return false;
+    }
+
+    /// <summary>
+    /// Gets the hashcode by XORing the hashcodes of real and imaginary parts
+    /// </summary>
+    public override int GetHashCode()
+    {
+      return m_real.GetHashCode() ^ m_imaginary.GetHashCode();
+    }
+
+    #endregion
+
+    #region Overridden System.Object members
+
+    /// <summary>
+    /// Check whether this <c>ComplexNumber</c> is equal to the given object.
+    /// </summary>
+    /// <param name="obj">The object to use compare to.</param>
+    /// <returns>True if the object is equal, false otherwise.</returns>
+    public override bool Equals(object obj)
+    {
+      if (obj is ComplexNumber)
+      {
+        ComplexNumber other = obj as ComplexNumber;
+        return (m_real == other.m_real) && (m_imaginary == other.m_imaginary);
+      }
+      return false;
+    }
+
+    /// <summary>
+    /// Get a string representation of the form 'a+bi' for this complex number.
+    /// </summary>
+    /// <returns>The string representation of this object.</returns>
+    public override string ToString()
+    {
+      return m_real.ToString() + '+' + m_imaginary.ToString() + 'i';
+    }
+
+    #endregion
+
+    #region Read string representation and create new ComplexNumber
+
+    /// <summary>
+    /// A convenience Parse method to get a ComplexNumber from a given string.
+    /// The format is expected to be of the form a+bi, such as "7+3.14i".
+    /// </summary>
+    /// <param name="s">The string to parse.</param>
+    /// <returns>The ComplexNumber that this string represents; null if format not correct.</returns>
+    public static ComplexNumber Parse(string s)
+    {
+      const string dbPat = @"([0-9]+)|([0-9]*\.[0-9]+)";
+      Match mt = Regex.Match(s, @"^\s*(?<REAL>" + dbPat + @")\s*\+\s*(?<IM>" + dbPat + @")i\s*$");
+      if (mt != null && mt.Length > 0)
+      {
+        double real = double.Parse(mt.Groups["REAL"].Value);
+        double imaginary = double.Parse(mt.Groups["IM"].Value);
+        return new ComplexNumber(real, imaginary);
+      }
+      return null;
+    }
+
+    #endregion
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/2d4a7ecd/examples/clicache/CacheRunner/ExampleObject.cs
----------------------------------------------------------------------
diff --git a/examples/clicache/CacheRunner/ExampleObject.cs b/examples/clicache/CacheRunner/ExampleObject.cs
new file mode 100755
index 0000000..897133f
--- /dev/null
+++ b/examples/clicache/CacheRunner/ExampleObject.cs
@@ -0,0 +1,229 @@
+/*=========================================================================
+ * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * more patents listed at http://www.pivotal.io/patents.
+ *========================================================================
+ */
+
+/*
+ * @brief ExampleObject class for testing the put functionality for object. 
+ */
+
+using System;
+namespace GemStone.GemFire.Cache.Examples
+{
+  public class ExampleObject
+    : IGFSerializable
+  {
+    #region Private members
+    private double double_field;
+    private float  float_field;
+    private long  long_field;
+    private int  int_field;
+    private short  short_field;
+    private string  string_field;
+      private System.Collections.ArrayList string_vector = new System.Collections.ArrayList();
+    #endregion
+
+    #region Public accessors
+    public int Int_Field
+    {
+      get
+      {
+        return int_field;
+      }
+      set
+      {
+        int_field = value;
+      }
+    }
+    public short Short_Field
+    {
+      get
+      {
+        return short_field;
+      }
+      set
+      {
+        short_field = value;
+      }
+    }
+    public long Long_Field
+    {
+      get
+      {
+        return long_field;
+      }
+      set
+      {
+        long_field = value;
+      }
+    }
+    public float Float_Field
+    {
+      get
+      {
+        return float_field;
+      }
+      set
+      {
+        float_field = value;
+      }
+    }
+    public double Double_Field
+    {
+      get
+      {
+        return double_field;
+      }
+      set
+      {
+        double_field = value;
+      }
+    }
+    public string String_Field
+    {
+      get
+      {
+        return string_field;
+      }
+      set
+      {
+        string_field = value;
+      }
+    }
+    public System.Collections.ArrayList String_Vector
+    {
+      get
+      {
+        return string_vector;
+      }
+      set
+      {
+        string_vector = value;
+      }
+    }
+    public override string ToString()
+    {
+        string buffer = "ExampleObject: "+int_field+"(int),"+string_field+"(str),";
+        buffer += "[";
+        for (int idx = 0; idx < string_vector.Count; idx++)
+        {
+            buffer += string_vector[idx];
+        }
+        buffer += "(string_vector)]";
+        return buffer;
+    }
+    #endregion
+
+    #region Constructors
+    public ExampleObject()
+    {
+      double_field = (double)0.0;
+      float_field = (float)0.0;
+      long_field = 0;
+      int_field = 0;
+      short_field = 0;
+      string_field = "";
+      string_vector.Clear();
+    }
+
+    public ExampleObject(int id) {
+      int_field = id;
+      short_field = (Int16)id;
+      long_field = (Int64)id;
+      float_field = (float)id;
+      double_field = (double)id;
+      string_field = ""+id;
+      string_vector.Clear();
+      for (int i=0; i<3; i++) {
+        string_vector.Add(string_field);
+      }
+    }
+    public ExampleObject(string sValue) {
+      int_field = Int32.Parse(sValue);
+      long_field = Int64.Parse(sValue);
+      short_field = Int16.Parse(sValue);
+      double_field = (double)int_field;
+      float_field = (float)int_field;
+      string_field = sValue;
+      string_vector.Clear();
+      for (int i=0; i<3; i++) {
+        string_vector.Add(sValue);
+      }
+    }
+    #endregion
+
+    #region IGFSerializable Members
+    public IGFSerializable FromData(DataInput input)
+    {
+      double_field = input.ReadInt64();
+      float_field = input.ReadFloat();
+      long_field = input.ReadInt64();
+      int_field = input.ReadInt32();
+      short_field = input.ReadInt16();
+      string_field = input.ReadUTF();
+      int itemCount = input.ReadInt32();
+      string_vector.Clear();
+      for (int idx = 0; idx<itemCount; itemCount++) {
+          string_vector.Add(input.ReadUTF());
+      }
+      return this;
+    }
+
+    public void ToData(DataOutput output)
+    {
+      output.WriteDouble( double_field );
+      output.WriteFloat( float_field );
+      output.WriteInt64( long_field );
+      output.WriteInt32( int_field );
+      output.WriteInt16( short_field );
+      output.WriteUTF( string_field );
+      int itemCount = string_vector.Count;
+      output.WriteInt32( itemCount );
+      for( int idx = 0; idx < itemCount; idx++ ) {
+          string s = (string)string_vector[idx];
+        output.WriteUTF( s );
+      }
+    }
+
+    public UInt32 ObjectSize
+    {
+      get
+      {
+        UInt32 objectSize = 0;
+        objectSize += (UInt32)sizeof(double);
+        objectSize += (UInt32)sizeof(float);
+        objectSize += (UInt32)sizeof(Int64);
+        objectSize += (UInt32)sizeof(Int32);
+        objectSize += (UInt32)sizeof(Int16);
+        objectSize += (UInt32)(string_field == null ? 0 : sizeof(char) * string_field.Length);
+        objectSize += (UInt32)sizeof(Int32);
+        for (int idx = 0; idx<string_vector.Count; idx++) {
+            string s = (string)string_vector[idx];
+            objectSize += (UInt32)(string_vector[idx] == null ? 0 : sizeof(char) * s.Length);
+        }
+        return objectSize;
+      }
+    }
+
+    public UInt32 ClassId
+    {
+      get
+      {
+        return 0x2e;
+      }
+    }
+    #endregion
+
+    public static IGFSerializable CreateDeserializable()
+    {
+      return new ExampleObject();
+    }
+  }
+
+};
+
+
+

http://git-wip-us.apache.org/repos/asf/geode/blob/2d4a7ecd/examples/clicache/CacheRunner/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/examples/clicache/CacheRunner/Properties/AssemblyInfo.cs b/examples/clicache/CacheRunner/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..4fbf771
--- /dev/null
+++ b/examples/clicache/CacheRunner/Properties/AssemblyInfo.cs
@@ -0,0 +1,33 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("GemFireCacheRunner")]
+[assembly: AssemblyDescription("GemFire ThinClient PutGet Example")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("GemStone Systems Inc.")]
+[assembly: AssemblyProduct("GemFireCacheRunner")]
+[assembly: AssemblyCopyright("Copyright © GemStone Systems Inc. 2008")]
+[assembly: AssemblyTrademark("All Rights Reserved")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible 
+// to COM components.  If you need to access a type in this assembly from 
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("bfe795a5-161f-4bb0-9694-f225e1f465be")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+[assembly: AssemblyVersion("9.0.0.0")]
+[assembly: AssemblyFileVersion("9.0.0.0")]

http://git-wip-us.apache.org/repos/asf/geode/blob/2d4a7ecd/examples/clicache/CacheRunner/README.html
----------------------------------------------------------------------
diff --git a/examples/clicache/CacheRunner/README.html b/examples/clicache/CacheRunner/README.html
new file mode 100644
index 0000000..dff87ea
--- /dev/null
+++ b/examples/clicache/CacheRunner/README.html
@@ -0,0 +1,653 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<HTML>
+        <IMG SRC="../../../docs/PIVOTAL_GemFire_220x100.png" BORDER="0">
+	<HEAD>
+		<TITLE>CacheRunner: GemFire Native Client C# Example</TITLE>
+		<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+		<META http-equiv="Content-Style-Type" content="text/css">
+		<META content="Adobe FrameMaker 7.0/HTML Export Filter" name="GENERATOR">
+		<LINK href="DocIndex.css" type="text/css" charset="ISO-8859-1" rel="STYLESHEET">
+	</HEAD>
+	<BODY>
+        <IMG SRC="../../../docs/PIVOTAL_GemFire_190x81.png" BORDER="0">
+	<DIV>
+              <h1 align="center"><a name="Top" id="Top"></a>CacheRunner</h1>
+			  <h2 align="center"> Pivotal GemFire&#174; Native Client </h2>
+			  <h2 align="center">C# Programming Example</h2>
+    </DIV>
+            <DIV>
+              <P>The <code>CacheRunner</code> C# example is an interactive program for modifying and viewing GemFire cache contents as a C# client interacts with a Java cache server. The <code>CacheRunner</code> program joins the distributed system, creates a cache, and then accepts command-line input for inspecting, modifying, and remotely querying the cache while working with a cache server. XML files are provided to configure <code>CacheRunner</code> for different functional operations or behavior.</P>
+              <blockquote>
+                <p><em>You can review the C# source code for this example by opening the files in the <code>cli_CacheRunner</code> directory that have a <code>.cs</code> file extension. </em></p>
+              </blockquote>
+              <P>This example is divided into three parts, with each part requiring a different XML configuration file for the Java cache server. <code>CacheRunner</code> is also configured using a local <code>gfcpp.properties</code> file.</P>
+              <ul>
+                        <li><em><a href="#part1">Part 1: Inspecting and Modifying the Cache</a></em> demonstrates cache operations using two C# native clients with a GemFire Java cache server. It shows how to <code>put</code> and <code>get</code> data between clients, and how to derive a complex number as a user-defined class for use as a key or value. You start two C# client instances and see how a <code>put</code> value in one can be gotten in another as the cache server is updated with the new values. This part uses server configuration file <code><a href="./cacherunner.xml" target="_blank">cacherunner.xml</a></code>. The procedures describing non-cacheable and cacheable values use client configuration files <code><a href="./tcr_cacheless.xml" target="_blank">tcr_cacheless.xml</a></code> and <code><a href="./tcr_cache.xml" target="_blank">tcr_cache.xml</a></code>. </li>
+                        <br>                      
+ 				    <li><em><a href="#part2">Part 2: Remote Querying</a></em> demonstrates how to initiate a query from a C# client that is executed on data stored on a Java cache server. The query results are returned to the C# client. This part uses server configuration file <code><a href="./csQueryPortfolios.xml" target="_blank">csQueryPortfolios.xml</a></code>. If no XML file is specified when <code>CacheRunner</code> is started, it's configured using <a href="./tcr_cache.xml" target="_blank"><code>tcr_cache.xml</code></a> by default. </li>
+ 					<br>
+ 				    <li><em><a href="#part3">Part 3: High Availability</a> </em> shows how you can set up redundant cache servers in case the primary server fails.</li>
+  </ul>
+ 				  <P>In the procedures, the lines you type are shown in a <code> <strong>boldface fixed</strong></code> font. System output is shown in a <code>regular fixed</code> font.
+                      </P><br>
+</DIV>
+
+<DIV>
+<H2>
+<a name="configuring_environment" id="configuring_environment"></a>Configuring the Environment</H2>
+<P>
+Examples that interact with a Java cache server require specific environment configurations so the cache server will run properly. Follow the configuration steps listed below that apply to your operating system: </P>
+</DIV>
+ <DIV>
+<ol>
+  <li>From the GemFire product installation directory, configure your environment settings by following the steps in <code>examples/EnvSetup.html</code>. Refer to the system configuration information in the <em>GemFire User's Guide</em> if you need help with   this step.<br>
+      <br>
+  <li>Set the <code>JAVA_HOME</code> and <code>GF_JAVA_HOME</code>  environment variables to your installed Java JRE or JDK. See the installation information in the <em>GemFire User's Guide</em> for the   versions of Java that are compatible with GemFire. The <code>JAVA_HOME</code> setting is for your applications, and  <code>GF_JAVA_HOME</code> is for the GemFire scripts.  You must have a compatible Java JRE or JDK installed  and you must set <code>JAVA_HOME</code> and <code>GF_JAVA_HOME</code> to point to it.<br>
+      <br>
+  <li>Add <code>$JAVA_HOME/bin</code> to the start of your <code>PATH</code>. <br>
+</ol>
+<p>The following is a list of the environment configuration commands for the <code>CacheRunner</code> example. Choose the set of commands that are appropriate for your operating system. The text that you type is shown in bold.
+  These configurations only need to be performed for the sessions that invoke the Java cache server.</p>
+<p><strong>Bourne and Korn shells (sh, ksh, bash)</strong></p>
+<blockquote>
+  <p>    <code>% <strong>cd GemFireInstallDirectory</strong><br>
+    % <strong>JAVA_HOME=&lt;installed JRE PATH&gt;; export JAVA_HOME</strong><br>
+    % <strong>GF_JAVA_HOME=$JAVA_HOME; export GF_JAVA_HOME</strong><br>
+    % <strong>PATH=$JAVA_HOME/bin:$PATH; export PATH</strong></code></p>
+</blockquote>
+<p><strong>Windows</strong></p>
+<blockquote>
+  <p><code>&gt; <strong>cd GemFireInstallDirectory</strong><br>
+&gt; <strong>set JAVA_HOME=&lt;installed JRE PATH&gt;</strong><br>
+&gt; <strong>set GF_JAVA_HOME=%JAVA_HOME%</strong><br>
+&gt; <strong>set PATH=%JAVA_HOME%\bin;%PATH%</strong> </code></p>
+</blockquote>
+<a name="part1"></a><br>
+<br>
+</DIV>
+
+<DIV>
+<hr size="3" noshade>
+<h1>Part 1: Inspecting and Modifying the Cache</h1>
+<hr size="3" noshade>
+</DIV>
+
+ <DIV>
+   <h2>CacheRunner Configuration Files </h2>
+   <P>
+The <code>CacheRunner</code> C# example uses a GemFire cache server configuration file called <code><a href="./cacherunner.xml" target="_blank">cacherunner.xml</a></code>. When the Java cache server starts, <code>cacherunner.xml</code> creates two regions <code>root</code> and <code>listenerWriterLoader</code>. This is a description of each cache server region and how they are configured:</P>
+   <UL>
+  <LI CLASS="Bulleted">root &#151; The root region for the cache server. The region's scope is <code>distributed-no-ack</code>, and <code>notify-by-subscription</code> is set to <code>true</code>.</LI>
+  <LI CLASS="Bulleted"><code> listenerWriterLoader</code> &#151; A region with <code>distributed-ack</code> scope and  <code>mirror-type</code> set to <code>keys-values</code>.</LI>
+  </UL>
+<p>The <code>CacheRunner</code> application comes with XML configuration files that configure the cache server and the local client cache to demonstrate various operations with the cache server. This example does not use <code>tcr_hacacheless.xml</code>.</p>
+<UL><LI CLASS="Bulleted"><code><a href="./tcr_cache.xml" target="_blank">tcr_cache.xml</a></code> &#151; The <code>listenerWriterLoader</code> region establishes an endpoint connection with the server and performs distributed caching operations by receiving updates from the cache server. If <code>CacheRunner.exe</code> is run without specifying an XML file, it is automatically configured using <code>tcr_cache.xml</code>.</LI>
+  <LI CLASS="Bulleted"><code><a href="./tcr_hacache.xml" target="_blank">tcr_hacache.xml</a></code> &#151; Configures the client for high availability by specifying multiple servers for storing data and setting a server redundancy level.</LI>
+  <LI CLASS="Bulleted"><code><a href="./tcr_cacheless.xml" target="_blank">tcr_cacheless.xml</a></code> &#151; The <code>listenerWriterLoader</code> region establishes an endpoint connection with the server and receives data from the cache server. Entries retrieved from the cache server are not retained in the client's local cache because the <code>caching-enabled</code> region attribute is set to <code>false</code>. The <code>Portfolios</code> region is used for remote querying. </LI>
+</UL>
+<P>
+These procedures introduce a few of the <code> CacheRunner</code>
+ commands. For information on the others, enter <strong>
+ <code>help</code></strong>
+ or <strong>
+ <code>?</code></strong>
+ at the session prompt.</P>
+<P>In the procedures, the lines you type are shown in a <code> <strong>boldface fixed</strong></code> font. System output is shown in a <code>regular fixed</code> font.</P>
+<br>
+ </DIV>
+ <DIV>
+                      <H2> <a name="starting_application_processes" id="starting_application_processes"></a>Starting the Cache Server </H2>
+ 				  <P> To start the cache server, create a session from the GemFire product installation directory and complete the following steps. </P>
+    </DIV>
+ 				<DIV>
+                      <OL>
+                        <LI CLASS="Numbered-1st">
+                          <p>Configure the session environment according to the steps listed in <a href="#configuring_environment">Configuring the Environment</a><a href="..\EnvSetup.html" target="_blank"></a>.</p>
+                        </LI>
+                        <LI CLASS="Numbered">Go to the <code>cli_CacheRunner</code> directory, then start the cache server with the local <code>cacherunner.xml</code> file:
+                          <blockquote>
+                              <p><strong> <code>cd examples\cli_CacheRunner</code></strong></p>
+                              <p><strong><code>cacheserver start cache-xml-file=cacherunner.xml</code></strong></p>
+                          </blockquote>
+                          <P>The cache server is initialized using the configurations in <code>cacherunner.xml</code>. A message similar to the following appears, indicating that the cache server is running:</P>
+                        </LI>
+                        <blockquote>
+                          <p> <code>Cacheserver pid: 2120 status: running</code><br>
+                      </p>
+                        </blockquote>
+                      </OL>
+    </DIV>
+ 				<DIV>
+                      <H2> <a name="starting_application_processes" id="starting_application_processes"></a>Starting Two CacheRunner Clients Using tcr_cache.xml </H2>
+ 				  <P> Start two <code>CacheRunner</code> clients and configure their caches using <code>tcr_cache.xml</code> by following these steps:</P>
+ 	  </DIV>
+ 				<DIV>
+                      <OL>
+                        <LI CLASS="Numbered-1st">
+                          <p>Create two sessions for two <code>CacheRunner</code> clients.</p>
+                        </LI>
+                        <LI CLASS="Numbered-1st">
+                        <p><span class="Numbered">In each session, go to the <code>cli_CacheRunner</code> directory</span>:                                                </LI>
+                        <blockquote>
+                          <p><strong> <code>cd examples\cli_CacheRunner</code></strong></p>
+                        </blockquote>
+                        <LI CLASS="Numbered"> In each session, start the <code>CacheRunner</code> client with <code>tcr_cache.xml</code>:
+                          <blockquote>
+                              <p><strong><code>CacheRunner.exe tcr_cache.xml </code></strong> </p>
+                          </blockquote>
+                          <P><code>CacheRunner</code> is configured using the settings in <code><a href="./tcr_cache.xml" target="_blank">tcr_cache.xml</a></code>. The following command prompt appears for both C# clients:</P>
+                        </LI>
+                          <blockquote>
+                              <p><code>/root: chrgn, lsrgn, get, put, exec, query, existsvalue, selectvalue, quit:</code></p>
+                          </blockquote>
+                          <p>This is a brief description of the prompts and commands you can uses with <code>CacheRunner</code>. See the GemFire product documentation for more information about these commands:</p>
+                          <ul>
+                            <li><code>/root:</code> &#151; A prompt that indicates the current region.</li>
+                            <li><code> chrgn</code> &#151; Navigate to a different region.</li>
+                            <li><code>lsrgn</code> &#151; List all regions in cache.</li>
+                            <li><code>get</code> &#151; Get a value from the cache server and add it to the local cache.</li>
+                            <li><code>put</code> &#151; Put a value into the local cache and propagate the value to the cache server.</li>
+                            <li><code>exec</code> &#151; Execute a query.</li>
+                            <li><code>query</code> &#151; Run a query shortcut method.</li>
+                            <li><code>existsvalue</code> &#151;Run a query shortcut method.</li>
+                            <li><code>selectvalue</code> &#151;Run a query shortcut method.</li>
+                            <li><code>quit</code> &#151; Quit the <code>CacheRunner</code> application.</li>
+ 						<br>
+                          </ul>
+ 					 
+                      </OL>
+                      
+    </DIV>
+
+                    <DIV>
+                      <H2> Entering and Receiving Data in the Clients </H2>
+ 				  <P> In this exercise, you <code>put</code> data in one client and the client updates the cache server region with the new data. Next, the second client does a <code>get</code> to retrieve the updated values from the cache server and update its local cache. The cache listeners for the clients report the cache events that occur for each <code>put</code> and <code>get</code>. </P>
+ 	  </DIV>
+ <DIV>
+                      <P><strong> In both CacheRunner clients </strong></P>
+ 				  <p>In both clients, go to the <code> listenerWriterLoader</code> region:</p>
+ 				  <OL>
+ 				    <blockquote>
+ 				      <p><code><strong>
+ 		            chrgn listenerWriterLoader</strong></code><br>
+      </blockquote>
+   </OL>
+ 				  <p><strong> In the first CacheRunner client:</strong></p>
+ 				    <OL>
+ 				      <LI CLASS="Numbered">Add an entry:
+ 				        <blockquote>
+ 				          <p><strong> <code>put key1 first</code></strong></p>
+ 				        </blockquote>
+ 			            <P> The cache listener reports the events related to the <code>put</code> command. The entry is identified as a string, and the cache server is updated with the new entry.</P>
+ 			            <blockquote>
+ 			              <p> <code>--- Received afterCreate event of: key1<br>
+ 		                  Put string -- key: key1 value: first </code></p>
+ 				        </blockquote>
+ 			            <P> The second <code>CacheRunner</code> client also receives an <code>afterCreate</code> event message from the server for the <code>put</code>:</P>
+ 			            <blockquote>
+ 			              <p> <code>--- Received afterCreate event of: key1</code></p>
+ 				        </blockquote>
+ 				      </LI>
+ 				      <LI CLASS="Numbered"> Add another entry in the first client:
+ 				        <blockquote>
+ 				          <p><strong><code>put key2 7.2+3i</code></strong></p>
+ 			            </blockquote>
+ 				        <P> The cache listener reports the events related to the <code>put</code> command. The entry is identified as a complex number, and the cache server is updated with the new entry.</P>
+ 				        <blockquote>
+ 				          <p> <code>--- Received afterCreate event of: key2<br>
+ 			              Put complex -- key: key2 value: 7.2+3i</code></p>
+ 			            </blockquote>
+ 			          <P> The second <code>CacheRunner</code> client also receives an <code>afterCreate</code> event message from the server for the <code>put</code>:</P>
+ 			          <blockquote>
+ 			            <p> <code>--- Received afterCreate event of: key2</code></p>
+ 				      </blockquote>
+ 			          </LI>
+      </OL>
+ 				    <br>
+ 				      <P><strong>In the second CacheRunner client </strong></P>
+ 				      <OL>
+ 				        <LI CLASS="Numbered">Get the <code>key1</code> entry from the cache server that was added by the first client:
+                              <blockquote>
+                                <p><strong> <code>get key1</code></strong></p>
+                            </blockquote>
+                            <P> The key name and value are retrieved from the cache server and displayed:                              </P>
+                            <blockquote>
+                              </code></strong><code>Get [CacheableString] -- key: key1 value: first </code>
+                              </p>
+                            </blockquote>
+                            </LI>
+ 				        <LI CLASS="Numbered"> Enter a new value for <code>key1</code>:
+ 				          <blockquote>
+                                  <p><strong><code>put key1 second </code></strong></p>
+ 			              </blockquote>
+ 						  <P> The cache listener reports the events related to the <code>put</code> command, identifying the entry as a string. The cache server is updated with the new value for <code>key1</code>.</P>
+ 			              <blockquote>
+                                <p> <code>--- Received afterUpdate event of: key1<br>
+                                Put string -- key: key1 value: second </code></p>
+ 		                  </blockquote>
+ 				        </LI>
+ 			          </OL>
+ 				      
+ 				    <br>
+ 				      <P><strong>In the first CacheRunner client</strong></P>
+       Get the new <code>key1</code> entry<span class="Numbered"> from the cache server that was added by </span>the second client:
+            <blockquote>
+                <p><strong> <code>get key1</code></strong></p>
+            </blockquote>
+            <P> The key name and new value are retrieved from the cache server: </P>
+            <blockquote> </code></strong><code>Get [CacheableString] -- key: key1 value: second</code></blockquote><br><br>
+            
+    </DIV>
+
+
+    <DIV>
+ 				<H2> Stopping the Cache Server and Clients </H2>
+ 		        <P>To complete the procedures in Part 1 and prepare for Part 2, the Java cache server and the two C# clients must be stopped. However, their sessions need to remain open so the cache server and clients can be started again from those sessions using a different XML configuration file. </P>
+                    <ol>
+                      <li>Stop the cache server, but leave its session open:      
+                          <blockquote>
+                            <strong><code>cacheserver stop</code></strong>
+                          </blockquote>
+ 				  </li>
+                      <li>Stop both C# clients:
+
+                                                <blockquote>
+                                                  <p><strong><code>quit</code></strong></p>
+                                                </blockquote>
+ 				  </li>
+ 				  <li>Close one of the C# client sessions. Only one client is needed for <em>Part 2: Remote Querying</em> and <em>Part 3: High Availability</em>.
+                                                <blockquote>
+                                                  <p><strong><code>exit</code></strong></p>
+                                                </blockquote>
+ 				  </li>
+                    </ol>
+                    <p><a name="part2" id="part2"></a><br> 				  
+                    </p>
+    </DIV>
+
+<DIV>
+<hr size="3" noshade>
+<h1>Part 2: Remote Querying</h1>
+<hr size="3" noshade>
+</DIV>
+
+          <DIV>
+            <P>These procedures introduce some of the querying commands available for the native client. The <code>CacheRunner</code> C# client accepts query strings in input, runs them against the cached data stored on the cache server, then returns the query results to the C# client.</P>
+            <P><br>
+</P>
+   </DIV>
+
+ <DIV>
+                      <H2> <a name="starting_application_processes" id="starting_application_processes"></a>Starting the Cache Server and Client </H2>
+ 				  <P> To start the cache server, complete the following steps using the open cache server and client sessions: </P>
+    </DIV>
+
+ 				<DIV>
+ 				  <OL><LI CLASS="Numbered-1st">
+                        <p>In the cache server session, add the classes for <code>javaobject.jar</code> to your <code>CLASSPATH</code> by entering the following in a single line: </p>
+                        </LI>
+                        <blockquote>
+                          <p><strong> <code>set CLASSPATH=examples\cli_CacheRunner\javaobject.jar;%CLASSPATH%</code></strong></p>
+                        </blockquote>
+                        <p> The file <code>javaobject.jar</code> is required for registering the <code>Portfolio</code> and <code>Position</code> objects on the cache server for remote querying.</p>
+                        <LI CLASS="Numbered">Make sure the <code>cli_CacheRunner</code> directory is still the current working directory. If it isn't, then set it.
+                          <blockquote>
+                              <p><strong> <code>cd examples\cli_CacheRunner</code></strong></p>
+                          </blockquote>
+                        <LI CLASS="Numbered">Start the cache server with  <code>csQueryPortfolios.xml</code>: 					  
+ 					  <blockquote>
+                              <p><strong><code>cacheserver start cache-xml-file=csQueryPortfolios.xml</code></strong></p>
+                          </blockquote>
+                          <P>The cache server is initialized using the configurations in <code><a href="./csQueryPortfolios.xml" target="_blank">csQueryPortfolios.xml</a></code>. The XML file sets up a <code>root</code> region  on the server named <code>DistRegionAck</code> with scope set to <code>distributed-ack</code>. It also creates a <code>Portfolio</code> data object on the server for querying, along with five stock portfolio objects whose keys are the portfolio ID. A message similar to the following appears, indicating that the cache server is running:</P>
+                        </LI>
+                        <blockquote>
+                          <p> <code>Cacheserver pid: 2120 status: running</code></p>
+                        </blockquote>
+                        <LI CLASS="Numbered">In the client session,  start the <code>CacheRunner</code> client with <code><a href="./tcr_cacheless.xml" target="_blank">tcr_cacheless.xml</a></code> to create a <code>Portfolios</code> client region for the querying exercises.
+                          <blockquote>
+                              <p><strong><code>cacherunner.exe tcr_cacheless.xml</code></strong></p>
+                          </blockquote>
+                      </OL>
+    </DIV>
+
+<DIV>
+  <h2>Executing Queries</h2>
+  <P>
+You invoke the <code>execute</code> method on the client to submit several queries that are run on the cache server, then the results are returned to the local client cache. You only need to use one of the <code>CacheRunner</code> clients for querying; the other client can be set aside for now. </P>
+</DIV>
+
+<DIV>
+<P CLASS="Head-D"><strong>
+In the CacheRunner client</strong>:</P>
+
+<ol>
+  <li>Go to the client's <code>Portfolios</code> region:</li>
+  <blockquote>
+    <p><code><strong>chrgn Portfolios</strong></code>  </p>
+  </blockquote>
+  <li>This query returns the status of the cache entries for the <code>/Portfolios</code> region on the cache server. Enter the following command:  </li>
+  <blockquote>
+    <p><code><strong>exec select distinct ID, status from  /Portfolios</strong></code></p>
+  </blockquote>
+      <P>
+      Query output:</P>
+         <blockquote>
+      <p> <code>Columns:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ID&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;status<br>
+      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Result (0): 4 || inactive || <br>
+      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Result (0): 5 || active || <br>
+      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Result (0): 2 || inactive || <br>
+      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Result (0): 3 || active || <br>
+      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Result (0): 1 || active || 
+      </code></p>
+    </blockquote>
+      <li>Run a second query. 
+        This query returns the row IDs on the cache server:
+        <blockquote>
+      <p><strong> <code><strong>exec select distinct ID from /Portfolios</strong></code></strong></p>
+   </blockquote>
+      <P>
+      Query output:</P>
+   <blockquote>
+      <p><code>        Result 1: 1 <br>
+        Result 2: 2 <br>
+        Result 3: 3 <br>
+        Result 4: 4 <br>
+        Result 5: 5
+      </code></p>
+        </blockquote>
+    </li>
+      <li>Run a third query. This query returns the object types for the <code>root/Portfolios</code> region on the cache server:
+        <blockquote>
+          <p><strong>
+          <code><strong>exec select distinct ID, pkid, getType from /Portfolios where 1=1</strong></code></strong></p>
+     </blockquote>
+      <P>
+      Query output:</P>
+         <blockquote>
+      <p> <code>Columns:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ID&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pkid&nbsp;&nbsp;&nbsp;&nbsp;getType<br>
+      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Result (0): 2 || 2 || type2 || <br>
+      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Result (0): 1 || 1 || type1 || <br>
+      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Result (0): 3 || 3 || type3 || <br>
+      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Result (0): 5 || 5 || type2 || <br>
+      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Result (0): 4 || 4 || type1 ||</code></p>
+    </blockquote>
+    </li>
+  </ol>
+</DIV>
+<br>
+<DIV>
+  <h2>Executing Region Query Shortcuts </h2>
+  <P>
+In these exercises you use region query shortcut  methods to submit queries to the cache server, then the results are returned to the local client cache. Query shortcuts take the query &quot;predicate&quot; as a parameter (the part after the <code>WHERE</code> clause), or they can take a normal full query. The three query shortcut methods are described below: </P>
+  <UL>
+    <LI CLASS="Bulleted"><code>query</code> &#151; Executes a query and returns the results. <code></code></LI>
+    <LI CLASS="Bulleted"><code> existsValue</code> &#151;Executes a query and returns <code>TRUE</code> or <code>FALSE</code> based on whether any results (rows) are obtained. </LI>
+    <LI CLASS="Bulleted"><code>selectValue</code> &#151;Executes a query and returns only a single result (row). If no results are obtained then it returns <code>NULL</code>. If more than one result (row) is obtained then a <code>QueryException</code> occurs.</LI>
+
+  </UL>
+
+</DIV>
+
+<DIV>
+<P CLASS="Head-D"><strong>
+In the CacheRunner client</strong>:</P>
+
+<ol>
+  <li>
+    Run this <code>query</code> shortcut, which returns the <code>Portfolios</code> objects with an <code>ID</code> of <code>1</code>:  </li>
+  <blockquote>
+    <p><code><strong>
+    query ID=1</strong></code></p>
+  </blockquote>
+      <P>
+      Query result:</P>
+         <blockquote>
+      <p> <code>Result 1: Portfolio [ID=1 status=active type=type1 pkid=1]<br>
+   P1:<br>
+   P2:</code></p>
+    </blockquote>
+      <P>
+      The <code>query</code> shortcut takes the predicate string <code>ID=1</code>, constructs the full query statement, then executes the query.  </P>
+      <li>Run this <code>existsValue</code> shortcut. 
+        The query returns either <code>True</code> or <code>False</code>, depending on whether the result is obtained.
+        <blockquote>
+      <p><strong> <code><strong>existsvalue ID=1</strong></code></strong></p>
+   </blockquote>
+      <P>
+      Query result:        </P>
+         <blockquote>
+           <p><code>      Result is True 
+      </code></p>
+    </blockquote>
+    </li>
+      <li>Run this <code>selectValue</code> shortcut. The query returns the object types  on the cache server for the specified ID:
+        <blockquote>
+          <p><strong>
+          <code><strong>selectValue ID=2</strong></code></strong></p>
+        </blockquote>
+      <P>
+      Query result:</P>
+         <blockquote>
+      <p> <code>Result : Portfolio [ID=2 status=inactive type=type2 pkid=2]<br>
+      P1:<br>
+   P2:
+      </code></p>
+    </blockquote><br>
+    </li>
+  </ol>
+
+</DIV>
+
+    <DIV>
+ 				<H2> Stopping the Cache Server and Client </H2>
+ 		        <P>To complete the procedures in Part 2 and prepare for <em>Part 3: High Availability </em>, the Java cache server and the C# client must be stopped. However, their sessions need to remain open so the cache server and client can be started again using a different XML configuration file. </P>
+                    <ol>
+                      <li>Stop the cache server, but leave its session open:      
+                        <blockquote>
+                          <blockquote>
+                            <p><strong> <code>cacheserver stop</code></strong></p>
+                          </blockquote>
+                      <li>Stop the <code>CacheRunner</code> client and leave its session open:
+
+                                                <blockquote>
+                                                  <p><strong><code>quit</code></strong></p>
+                                                </blockquote>
+ 			    </ol>
+                    <a name="part3" id="part3"></a></DIV>
+
+<DIV>
+<hr size="3" noshade>
+<h1>Part 3: High Availability</h1>
+<hr size="3" noshade>
+</DIV>
+
+ <DIV>
+   <h2>Running CacheRunner for Failover and High Availability </h2>
+   <P>The CacheRunner C# example demonstrates server failover to highly available client queue backups by failing over to a secondary cache server when the primary server becomes unavailable. </P>
+   <P>In the procedures, the lines you type are shown in a <code> <strong>boldface fixed</strong></code> font. System output is shown in a <code>regular fixed</code> font.</P>
+<br>
+ </DIV>
+
+ <DIV>
+   <h2>
+     Starting the Primary and Secondary Cache Servers</h2>
+   <P>
+To start the primary and secondary cache server, complete the following steps in the open cache server session:</P>
+</DIV>
+
+<DIV>
+  <OL><LI CLASS="Numbered">Make sure the <code>cli_CacheRunner</code> directory is still the current working directory. If it isn't, then set it.
+  <blockquote>
+   <p><strong>
+     <code>cd examples\cli_CacheRunner</code></strong></p>
+     </blockquote>
+ </LI>
+<LI CLASS="Numbered">Start the first cache server by running this command:
+   <blockquote>
+     <p><strong>
+       <code>cacheserver start cache-xml-file=cacherunner.xml -dir=gfecs1</code></strong></p>
+      </blockquote>
+   <P>The <code>gfecs1</code> directory contains a copy of <code><a href="./cacherunner.xml" target="_blank">cacherunner.xml</a></code>, which specifies 50505 for the BridgeServer port for the primary cache server.</P>
+ </LI>
+ <LI CLASS="Numbered">Start the second cache server by running this command:
+   <blockquote>
+     <p><strong>
+       <code>cacheserver start cache-xml-file=cacherunner2.xml -dir=gfecs2</code></strong></p>
+      </blockquote>
+   <P>The <code>gfecs2</code> directory contains a copy of <code><a href="./cacherunner2.xml" target="_blank">cacherunner2.xml</a></code>, which specifies 50506 for the BridgeServer port for the secondary cache server.</P>
+ </LI>
+ </OL>
+</DIV>
+
+ <DIV>
+   <h2>
+     Starting the  CacheRunner Client</h2>
+   <P>
+To start the <code>CacheRunner</code> client, complete the following steps in the open client session:</P>
+</DIV>
+
+ <DIV>
+   <OL><LI CLASS="Numbered-1st">
+   <p><span class="Numbered">Make sure the <code>cli_CacheRunner</code> directory is still the current working directory. If it isn't, then set it.</span></p>
+ </LI>
+ <blockquote>
+   <p><strong>
+     <code>cd examples\cli_CacheRunner</code></strong></p>
+   </blockquote>
+
+<LI CLASS="Numbered">
+Start the <code> CacheRunner</code>
+ client, specifying <code>tcr_hacache.xml</code>:
+ <blockquote>
+       <p><strong><code>cacherunner.exe tcr_hacache.xml</code></strong></p>
+   </blockquote>
+ <P>The <code>CacheRunner</code> client is initialized using the settings in <code><a href="./tcr_hacache.xml" target="_blank">tcr_hacache.xml</a></code> in the <code>cli_CacheRunner</code> directory. The XML specifies two cache-level server endpoints that the client connects to (50505 for the primary, and 50506 for the secondary). The <code>redundancy-level=1</code> attribute specifies the number of redundant servers to use in addition to the primary server.<br>
+</P>
+  </LI>
+</OL>
+</DIV>
+
+<DIV>
+  <h2>Performing Cache Operations to Update the Server </h2>
+  <P>
+In these steps you produce data in the <code>CacheRunner</code> local client cache. The cache servers receive the updated values.</P>
+</DIV>
+<DIV>
+  <OL>
+  <LI CLASS="Numbered">In the <code>CacheRunner</code> client, change it to the <code>listenerWriterLoader</code> region:
+    <blockquote>
+        <p><strong><code> chrgn listenerWriterLoader</code></strong>    </p>
+    </blockquote>
+  <LI CLASS="Numbered">Add an entry to the region:
+    <blockquote>
+      <p><strong>
+        <code>put entry1 ball str</code></strong></p>
+      </blockquote>
+    <P>
+      This creates an entry whose key is <code> entry1</code>
+      and whose value is the string <code>ball</code>. The cache servers are updated with the new entry. <br>
+</P>
+  </LI>
+  </OL>
+
+</DIV>
+
+<DIV>
+  <h2>Stopping the Primary Cache Server to Initiate Failover </h2>
+  <P>
+In this procedure you stop the primary cache server to initiate a server failover condition.</P>
+</DIV>
+<DIV>
+  <OL><LI CLASS="Numbered">Stop the primary cache server by running this command in the server session:
+    <blockquote>
+      <p><strong>
+        <code>cacheserver stop -dir=gfecs1</code></strong></p>
+      </blockquote>
+    <P>
+      Failover sets the secondary server as the new primary server:</P>
+  </LI>
+  <LI CLASS="Numbered">
+    In the client session, add an entry to the region:
+      <blockquote>
+        <p><strong>
+        <code>put entry2 bat str </code></strong></p>
+      </blockquote>
+     <P>
+      This creates an entry whose key is <code> entry2</code> and whose value is the string <code>bat</code>. The cache server is updated with the new entry.</P>
+  </LI>
+    <br>
+</OL>
+
+</DIV>
+
+<DIV>
+  <h2>Restarting the Stopped Cache Server and Initiating Another Failover </h2>
+  <P>
+Now restart the cache server that was previously stopped so both servers are running, then stop the other server to produce another failover condition.</P>
+</DIV>
+<DIV>
+  <OL>
+    <LI CLASS="Numbered">Restart the stopped cache server by running this command in the server session:
+      <blockquote>
+      <p><strong><code>cacheserver start cache-xml-file=cacherunner.xml -dir=gfecs1</code></strong></p>
+      </blockquote>
+    <P>
+      Now both cache servers are running.</P>
+  </LI>
+  <LI CLASS="Numbered">Stop the other cache server by running this command in the server session:
+    <blockquote>
+        <p><strong><code>cacheserver stop -dir=gfecs2</code></strong></p>
+      </blockquote>
+     <P>
+      Failover occurs, and the restarted server is now the only server running.</P>
+  </LI>
+  <LI CLASS="Numbered">In the client session, get the new entry from the server:
+    <blockquote>
+        <p><strong><code>get entry2</code></strong></p>
+      </blockquote>
+                            <P> The key name and value are retrieved from the cache server and displayed:                              </P>
+                            <blockquote>
+                              </code></strong><code>Get [CacheableString] -- key: entry2 value: bat </code>
+                              </p>
+                            </blockquote>
+  </LI>
+    <br>
+</OL>
+
+</DIV>
+
+ 	  <DIV>
+ 				<H2> Closing the Client and the Cache Server </H2>
+ 				  <OL>
+ 				    <LI CLASS="Numbered">In the client session, quit the  <code>CacheRunner</code> application and then exit the session:
+                          <blockquote>
+          <p><strong> <code>quit</code></strong><br>
+ 	  <strong> <code>exit</code></strong></p>
+      </blockquote>
+      </LI>
+
+                            <LI CLASS="Numbered">In the server session, stop the remaining cache server and then exit the session:
+                              <blockquote>
+                                <p><strong><code>cacheserver stop -dir=gfecs1</code></strong><br>
+                                <strong><code>exit</code></strong></p>
+                              </blockquote>
+                        </LI>
+            </OL>
+    </DIV>
+
+<br>
+       <DIV>
+            <H2> Changing System Parameters</H2>
+         <P>This product ships configured to run with default system properties. If you need to run in a non-default configuration, GemFire also takes a system-level configuration file. Copy the <code>gfcpp.properties</code> file into your <code>cli_CacheRunner</code> directory from the native client <code>defaultSystem</code> directory and edit it as needed. For example, to change the name of the <code>cache.xml</code> file, uncomment this line and change the file name:</P>
+         <P> <code>#cache-xml-file=cache.xml</code></P>
+         <P>When you are finished with the example, delete the copied <code>gfcpp.properties</code> file from the <code>cli_CacheRunner</code> directory so it can run with the default configuration.<br>
+           <br>
+            </P>
+       </DIV>
+       <a href="#Top">Top</a>
+          <P>&nbsp;</P>
+<p><span class=GramE>Copyright &#169; 2006-2014 Pivotal Software, Inc. All rights reserved.
+This product is protected by U.S. and international copyright and intellectual
+property laws. Pivotal products are covered by one or more patents listed at http://www.pivotal.io/patents. </p>
+	</BODY>
+</HTML>


Mime
View raw message