[ 
https://issues.apache.org/jira/browse/GEODE-1887?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15876938#comment-15876938
 ] 

ASF GitHub Bot commented on GEODE-1887:
---------------------------------------

Github user kirklund commented on a diff in the pull request:

    https://github.com/apache/geode/pull/390#discussion_r102338898
  
    --- Diff: 
geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/ClientServerMiscDUnitTest.java
 ---
    @@ -773,6 +755,73 @@ public void 
clientIsPreventedFromConnectingToLocatorAsServer() throws Exception
       }
     
     
    +  private void proxyRegionClientServerOp(RegionShortcut shortcut) throws 
Exception {
    +    // start server first
    +    final String REGION_NAME = "proxyRegionClientServerOp";
    +    PORT1 = initServerCache(false);
    +    // Create regions on servers.
    +    server1.invoke(new SerializableCallable() {
    +      @Override
    +      public Object call() throws Exception {
    +        Cache c = CacheFactory.getAnyInstance();
    +        assertNotNull(c);
    +        Region<Object, Object> r = 
c.createRegionFactory(shortcut).create(REGION_NAME);
    +        assertNotNull(r);
    +        return null;
    +      }
    +    });
    +
    +    String host = NetworkUtils.getServerHostName(server1.getHost());
    +
    +    Properties props = new Properties();
    +    props.setProperty(MCAST_PORT, "0");
    +    props.setProperty(LOCATORS, "");
    +    ClientCacheFactory ccf = new ClientCacheFactory(props);
    +    ccf.addPoolServer(host, PORT1);
    +
    +    ClientCache clientCache = ccf.create();
    +    Region<Object, Object> clientRegion =
    +        
clientCache.createClientRegionFactory(ClientRegionShortcut.PROXY).create(REGION_NAME);
    +    assertNotNull(clientRegion);
    +
    +    // let us populate this region from client.
    +    for (int i = 0; i < 10; i++) {
    +      clientRegion.put(i, i * 10);
    +    }
    +    // Verify using gets
    +    for (int i = 0; i < 10; i++) {
    +      assertEquals(i * 10, clientRegion.get(i));
    +    }
    +    assertEquals(10, clientRegion.size());
    +    assertFalse(clientRegion.isEmpty());
    +    // delete all the entries from the server
    +    server1.invoke(new SerializableCallable() {
    +      @Override
    +      public Object call() throws Exception {
    +        Cache c = CacheFactory.getAnyInstance();
    --- End diff --
    
    I recommend naming variables with full words like "cache" and "region" -- 
we're trying to get away from the use of single-characters or abbreviations.


> Client PROXY region should delegate all operations to server
> ------------------------------------------------------------
>
>                 Key: GEODE-1887
>                 URL: https://issues.apache.org/jira/browse/GEODE-1887
>             Project: Geode
>          Issue Type: Bug
>          Components: regions
>            Reporter: Swapnil Bawaskar
>            Assignee: Avinash Dongre
>
> Currently a ClientRegionShortcut.PROXY region sends operations like put() and 
> get() over to the server, but for operations like size() and isEmpty() it 
> just consults the local state on the client  and returns 0 and true 
> respectively, even though there may be data in the servers for that region.
> A PROXY region should not attempt to consult its local state for any 
> operation. 



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to