[jira] [Comment Edited] (GEODE-1887) Client PROXY region should delegate all operations to server

2017-05-05 Thread Darrel Schneider (JIRA)

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

Darrel Schneider edited comment on GEODE-1887 at 5/5/17 6:52 PM:
-

The problem with changing the existing behavior of PROXY on a client is that it 
could break existing applications.
When Region methods are done on a client region then it must always decide what 
it will do with two possible spaces:
# the region state in the client space
# the region state in the server space

The following region methods limit themselves to the client space:
*  public RegionAttributes getAttributes();
*  public AttributesMutator getAttributesMutator();
*  public CacheStatistics getStatistics();
*  public Entry getEntry(Object key);
*  public  Region getSubregion(String path);
*  public Set subregions(boolean recursive);
*  public Set keySet();
*  public Collection values();
*  public Set entrySet(boolean recursive);
*  public Set> entrySet();
*  public Object getUserAttribute();
*  public void setUserAttribute(Object value);
*  public boolean isDestroyed();
*  public boolean containsValueForKey(Object key);
*  public boolean containsKey(Object key);
*  public boolean containsValue(Object value);
*  public boolean isEmpty();
*  public int size();
*  default void forEach(BiConsumer action)
*  default void replaceAll(BiFunction 
function)


Some of these (keySet and containsKey) already have corresponding methods that 
perform the same operation in the server space (keySetOnServer and 
containsKeyOnServer).
For at least some of the other client space methods I think we should also add 
"OnServer" methods. For example "sizeOnServer" and "isEmptyOnServer". I think 
it is easier for a develop to discover the "OnServer" method and it also tells 
them that a client has two different ways of answering the size question. These 
"OnServer" methods will fail with an UnsupportedOperationException if called on 
a non-client region. They will also completely ignore any client state. For 
example sizeOnServer will not consider any entries cached in the client but 
will simply report the size from the server's point of view.



was (Author: dschneider):
The problem with changing the existing behavior of PROXY on a client is that it 
could break existing applications.
When Region methods are done on a client region then it must always decide what 
it will do with two possible spaces:
  1. the region state in the client space
  2. the region state in the server space
The following region methods limit themselves to the client space:
*  public RegionAttributes getAttributes();
*  public AttributesMutator getAttributesMutator();
*  public CacheStatistics getStatistics();
*  public Entry getEntry(Object key);
*  public  Region getSubregion(String path);
*  public Set subregions(boolean recursive);
*  public Set keySet();
*  public Collection values();
*  public Set entrySet(boolean recursive);
*  public Set> entrySet();
*  public Object getUserAttribute();
*  public void setUserAttribute(Object value);
*  public boolean isDestroyed();
*  public boolean containsValueForKey(Object key);
*  public boolean containsKey(Object key);
*  public boolean containsValue(Object value);
*  public boolean isEmpty();
*  public int size();
*  default void forEach(BiConsumer action)
*  default void replaceAll(BiFunction 
function)


Some of these (keySet and containsKey) already have corresponding methods that 
perform the same operation in the server space (keySetOnServer and 
containsKeyOnServer).
For at least some of the other client space methods I think we should also add 
"OnServer" methods. For example "sizeOnServer" and "isEmptyOnServer". I think 
it is easier for a develop to discover the "OnServer" method and it also tells 
them that a client has two different ways of answering the size question. These 
"OnServer" methods will fail with an UnsupportedOperationException if called on 
a non-client region. They will also completely ignore any client state. For 
example sizeOnServer will not consider any entries cached in the client but 
will simply report the size from the server's point of view.


> 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  

[jira] [Comment Edited] (GEODE-1887) Client PROXY region should delegate all operations to server

2017-05-05 Thread Darrel Schneider (JIRA)

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

Darrel Schneider edited comment on GEODE-1887 at 5/5/17 6:52 PM:
-

The problem with changing the existing behavior of PROXY on a client is that it 
could break existing applications.
When Region methods are done on a client region then it must always decide what 
it will do with two possible spaces:
  1. the region state in the client space
  2. the region state in the server space
The following region methods limit themselves to the client space:
*  public RegionAttributes getAttributes();
*  public AttributesMutator getAttributesMutator();
*  public CacheStatistics getStatistics();
*  public Entry getEntry(Object key);
*  public  Region getSubregion(String path);
*  public Set subregions(boolean recursive);
*  public Set keySet();
*  public Collection values();
*  public Set entrySet(boolean recursive);
*  public Set> entrySet();
*  public Object getUserAttribute();
*  public void setUserAttribute(Object value);
*  public boolean isDestroyed();
*  public boolean containsValueForKey(Object key);
*  public boolean containsKey(Object key);
*  public boolean containsValue(Object value);
*  public boolean isEmpty();
*  public int size();
*  default void forEach(BiConsumer action)
*  default void replaceAll(BiFunction 
function)


Some of these (keySet and containsKey) already have corresponding methods that 
perform the same operation in the server space (keySetOnServer and 
containsKeyOnServer).
For at least some of the other client space methods I think we should also add 
"OnServer" methods. For example "sizeOnServer" and "isEmptyOnServer". I think 
it is easier for a develop to discover the "OnServer" method and it also tells 
them that a client has two different ways of answering the size question. These 
"OnServer" methods will fail with an UnsupportedOperationException if called on 
a non-client region. They will also completely ignore any client state. For 
example sizeOnServer will not consider any entries cached in the client but 
will simply report the size from the server's point of view.



was (Author: dschneider):
The problem with changing the existing behavior of PROXY on a client is that it 
could break existing applications.
When Region methods are done on a client region then it must always decide what 
it will do with two possible spaces:
  1. the region state in the client space
  2. the region state in the server space
The following region methods limit themselves to the client space:
  public RegionAttributes getAttributes();
  public AttributesMutator getAttributesMutator();
  public CacheStatistics getStatistics();
  public Entry getEntry(Object key);
  public  Region getSubregion(String path);
  public Set subregions(boolean recursive);
  public Set keySet();
  public Collection values();
  public Set entrySet(boolean recursive);
  public Set> entrySet();
  public Object getUserAttribute();
  public void setUserAttribute(Object value);
  public boolean isDestroyed();
  public boolean containsValueForKey(Object key);
  public boolean containsKey(Object key);
  public boolean containsValue(Object value);
  public boolean isEmpty();
  public int size();
  default void forEach(BiConsumer action)
  default void replaceAll(BiFunction 
function)

Some of these (keySet and containsKey) already have corresponding methods that 
perform the same operation in the server space (keySetOnServer and 
containsKeyOnServer).
For at least some of the other client space methods I think we should also add 
"OnServer" methods. For example "sizeOnServer" and "isEmptyOnServer". I think 
it is easier for a develop to discover the "OnServer" method and it also tells 
them that a client has two different ways of answering the size question. These 
"OnServer" methods will fail with an UnsupportedOperationException if called on 
a non-client region. They will also completely ignore any client state. For 
example sizeOnServer will not consider any entries cached in the client but 
will simply report the size from the server's point of view.


> 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