You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by il...@apache.org on 2014/07/23 15:04:58 UTC

[2/2] git commit: [OLINGO-368] Async features via proxy for all but operation invocation

[OLINGO-368] Async features via proxy for all but operation invocation


Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/b8918211
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/b8918211
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/b8918211

Branch: refs/heads/master
Commit: b8918211533fcf79162bf222caf18f8176c0b1e2
Parents: 50ae17f
Author: Francesco Chicchiriccò <--global>
Authored: Wed Jul 23 15:04:44 2014 +0200
Committer: Francesco Chicchiriccò <--global>
Committed: Wed Jul 23 15:04:44 2014 +0200

----------------------------------------------------------------------
 .../olingo/ext/proxy/api/AbstractEntitySet.java |  2 +-
 .../apache/olingo/ext/proxy/api/AsyncCall.java  | 71 --------------------
 .../olingo/ext/proxy/api/CollectionQuery.java   | 10 ++-
 .../olingo/ext/proxy/api/EntitySetQuery.java    | 12 ++++
 .../ext/proxy/api/PersistenceManager.java       |  9 +++
 .../ext/proxy/api/PrimitiveCollection.java      | 10 ++-
 .../olingo/ext/proxy/api/SingleQuery.java       | 10 ++-
 .../AbstractCollectionInvocationHandler.java    | 12 ++++
 .../commons/AbstractPersistenceManager.java     | 50 ++++++++------
 .../AbstractStructuredInvocationHandler.java    | 67 ++++++++++--------
 .../ComplexCollectionInvocationHandler.java     | 26 +++----
 .../EntityCollectionInvocationHandler.java      |  8 +--
 .../EntityContainerInvocationHandler.java       | 12 ++--
 .../proxy/commons/EntityInvocationHandler.java  |  3 +-
 .../commons/EntitySetInvocationHandler.java     | 34 +++++++---
 .../PrimitiveCollectionInvocationHandler.java   | 13 ++--
 .../olingo/fit/proxy/v3/AsyncTestITCase.java    | 70 ++++++-------------
 .../fit/proxy/v3/MediaEntityTestITCase.java     | 14 ++--
 .../fit/proxy/v4/APIBasicDesignTestITCase.java  |  4 +-
 .../olingo/fit/proxy/v4/AsyncTestITCase.java    | 36 +++-------
 .../commons/api/domain/CommonODataProperty.java | 26 +++----
 .../commons/api/domain/v3/ODataProperty.java    | 18 ++---
 .../commons/api/domain/v4/ODataProperty.java    | 17 ++---
 23 files changed, 251 insertions(+), 283 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b8918211/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/AbstractEntitySet.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/AbstractEntitySet.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/AbstractEntitySet.java
index b472d24..8bf3aa2 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/AbstractEntitySet.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/AbstractEntitySet.java
@@ -77,7 +77,7 @@ public interface AbstractEntitySet<
    * Deletes the given entity in a batch.
    *
    * @param <S>
-   * @param entity to be deleted
+   * @param entities to be deleted
    */
   <S extends T> void delete(S entities);
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b8918211/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/AsyncCall.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/AsyncCall.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/AsyncCall.java
deleted file mode 100644
index 11c08e7..0000000
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/AsyncCall.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.ext.proxy.api;
-
-import org.apache.olingo.client.api.Configuration;
-
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-
-public abstract class AsyncCall<V> implements Future<V> {
-
-  private final Future<V> future;
-
-  public AsyncCall(final Configuration configuration) {
-    this.future = configuration.getExecutor().submit(new Callable<V>() {
-
-      @Override
-      public V call() throws Exception {
-        return AsyncCall.this.call();
-      }
-    });
-  }
-
-  public abstract V call();
-
-  @Override
-  public boolean cancel(final boolean mayInterruptIfRunning) {
-    return this.future.cancel(mayInterruptIfRunning);
-  }
-
-  @Override
-  public boolean isCancelled() {
-    return this.future.isCancelled();
-  }
-
-  @Override
-  public boolean isDone() {
-    return this.future.isDone();
-  }
-
-  @Override
-  public V get() throws InterruptedException, ExecutionException {
-    return this.future.get();
-  }
-
-  @Override
-  public V get(final long timeout, final TimeUnit unit)
-          throws InterruptedException, ExecutionException, TimeoutException {
-
-    return this.future.get(timeout, unit);
-  }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b8918211/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/CollectionQuery.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/CollectionQuery.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/CollectionQuery.java
index 3f532ea..d66cbbd 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/CollectionQuery.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/CollectionQuery.java
@@ -19,6 +19,7 @@
 package org.apache.olingo.ext.proxy.api;
 
 import java.util.Collection;
+import java.util.concurrent.Future;
 import org.apache.olingo.client.api.uri.URIFilter;
 
 public interface CollectionQuery<
@@ -28,11 +29,18 @@ public interface CollectionQuery<
   /**
    * Returns all instances.
    *
-   * @return all entities
+   * @return all instances
    */
   EC execute();
 
   /**
+   * Asynchronously returns all instances.
+   *
+   * @return future handle on all instances
+   */
+  Future<EC> executeAsync();
+
+  /**
    * Sets the <tt>$filter</tt> expression.
    * <br/>
    * Any of available operators and functions can be embodied here.

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b8918211/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/EntitySetQuery.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/EntitySetQuery.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/EntitySetQuery.java
index e726803..31a72ee 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/EntitySetQuery.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/EntitySetQuery.java
@@ -18,6 +18,8 @@
  */
 package org.apache.olingo.ext.proxy.api;
 
+import java.util.concurrent.Future;
+
 public interface EntitySetQuery<
         T extends EntityType, EC extends EntityCollection<T>, CT extends EntitySetQuery<T, EC, ?>>
         extends CollectionQuery<T, EC, CT> {
@@ -31,4 +33,14 @@ public interface EntitySetQuery<
    * @return all entities of the given subtype
    */
   <S extends T, SEC extends EntityCollection<S>> SEC execute(Class<SEC> reference);
+
+  /**
+   * Asynchronously returns all instances of the given subtype.
+   *
+   * @param <S>
+   * @param <SEC>
+   * @param reference entity collection class to be returned
+   * @return future handle on all entities of the given subtype
+   */
+  <S extends T, SEC extends EntityCollection<S>> Future<SEC> executeAsync(Class<SEC> reference);
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b8918211/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/PersistenceManager.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/PersistenceManager.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/PersistenceManager.java
index 41efb31..c37a299 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/PersistenceManager.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/PersistenceManager.java
@@ -20,6 +20,7 @@ package org.apache.olingo.ext.proxy.api;
 
 import java.io.Serializable;
 import java.util.List;
+import java.util.concurrent.Future;
 import org.apache.olingo.commons.api.ODataRuntimeException;
 
 /**
@@ -34,4 +35,12 @@ public interface PersistenceManager extends Serializable {
    * bearing the error returned from the service.
    */
   List<ODataRuntimeException> flush();
+
+  /**
+   * Asynchronously flushes all pending changes to the OData service.
+   *
+   * @return a future handle for a list where n-th item is either null (if corresponding request went out successfully)
+   * or the exception bearing the error returned from the service.
+   */
+  Future<List<ODataRuntimeException>> flushAsync();
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b8918211/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/PrimitiveCollection.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/PrimitiveCollection.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/PrimitiveCollection.java
index 0cb2062..93d479e 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/PrimitiveCollection.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/PrimitiveCollection.java
@@ -20,17 +20,25 @@ package org.apache.olingo.ext.proxy.api;
 
 import java.io.Serializable;
 import java.util.Collection;
+import java.util.concurrent.Future;
 
 public interface PrimitiveCollection<T extends Serializable> extends Collection<T>, Serializable {
 
   /**
    * Returns all instances.
    *
-   * @return all entities
+   * @return all instances
    */
   PrimitiveCollection<T> execute();
 
   /**
+   * Asynchronously returns all instances.
+   *
+   * @return future handle on all instances
+   */
+  Future<PrimitiveCollection<T>> executeAsync();
+
+  /**
    * Sets the maximum number of results to retrieve (<tt>$top</tt>).
    *
    * @param top maximum number of results to retrieve

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b8918211/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/SingleQuery.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/SingleQuery.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/SingleQuery.java
index 9a43d8b..40c2a4c 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/SingleQuery.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/SingleQuery.java
@@ -18,11 +18,17 @@
  */
 package org.apache.olingo.ext.proxy.api;
 
+import java.util.concurrent.Future;
+
 public interface SingleQuery<T extends StructuredType> extends CommonQuery<T> {
 
   /**
-   *
-   * @return structured type.
+   * @return structured type instance
    */
   T load();
+
+  /**
+   * @return future handle on structured type instance
+   */
+  Future<T> loadAsync();
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b8918211/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractCollectionInvocationHandler.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractCollectionInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractCollectionInvocationHandler.java
index 27c9c51..73369f8 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractCollectionInvocationHandler.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractCollectionInvocationHandler.java
@@ -29,6 +29,8 @@ import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.concurrent.Callable;
+import java.util.concurrent.Future;
 import org.apache.commons.lang3.tuple.Triple;
 import org.apache.olingo.client.api.uri.URIFilter;
 import org.apache.olingo.commons.api.domain.v4.ODataAnnotation;
@@ -73,6 +75,16 @@ public abstract class AbstractCollectionInvocationHandler<T extends Serializable
     this.baseURI = this.uri == null ? null : this.uri.build();
   }
 
+  public Future<Collection<T>> executeAsync() {
+    return service.getClient().getConfiguration().getExecutor().submit(new Callable<Collection<T>>() {
+
+      @Override
+      public Collection<T> call() throws Exception {
+        return execute();
+      }
+    });
+  }
+
   @SuppressWarnings("unchecked")
   public Collection<T> execute() {
     if (this.uri != null) {

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b8918211/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractPersistenceManager.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractPersistenceManager.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractPersistenceManager.java
index 38d08da..c01af76 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractPersistenceManager.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractPersistenceManager.java
@@ -18,6 +18,17 @@
  */
 package org.apache.olingo.ext.proxy.commons;
 
+import java.lang.reflect.Proxy;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.Callable;
+import java.util.concurrent.Future;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.olingo.client.api.communication.header.ODataPreferences;
 import org.apache.olingo.client.api.communication.request.cud.ODataDeleteRequest;
@@ -42,16 +53,6 @@ import org.apache.olingo.ext.proxy.utils.CoreUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.lang.reflect.Proxy;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
 abstract class AbstractPersistenceManager implements PersistenceManager {
 
   /**
@@ -67,6 +68,17 @@ abstract class AbstractPersistenceManager implements PersistenceManager {
     this.service = factory;
   }
 
+  @Override
+  public Future<List<ODataRuntimeException>> flushAsync() {
+    return service.getClient().getConfiguration().getExecutor().submit(new Callable<List<ODataRuntimeException>>() {
+
+      @Override
+      public List<ODataRuntimeException> call() throws Exception {
+        return flush();
+      }
+    });
+  }
+
   protected abstract List<ODataRuntimeException> doFlush(PersistenceChanges changes, TransactionItems items);
 
   @Override
@@ -241,7 +253,7 @@ abstract class AbstractPersistenceManager implements PersistenceManager {
           final URI targetURI = currentStatus == AttachedEntityStatus.NEW
                   ? URI.create("$" + startingPos)
                   : URIUtils.getURI(
-                  service.getClient().getServiceRoot(), handler.getEntity().getEditLink().toASCIIString());
+                          service.getClient().getServiceRoot(), handler.getEntity().getEditLink().toASCIIString());
           queueUpdate(handler, targetURI, entity, changeset);
           pos++;
           items.put(handler, pos);
@@ -253,8 +265,8 @@ abstract class AbstractPersistenceManager implements PersistenceManager {
           final URI targetURI = currentStatus == AttachedEntityStatus.NEW
                   ? URI.create("$" + startingPos + "/$value")
                   : URIUtils.getURI(
-                  service.getClient().getServiceRoot(),
-                  handler.getEntity().getEditLink().toASCIIString() + "/$value");
+                          service.getClient().getServiceRoot(),
+                          handler.getEntity().getEditLink().toASCIIString() + "/$value");
 
           queueUpdateMediaEntity(handler, targetURI, handler.getStreamChanges(), changeset);
 
@@ -268,8 +280,8 @@ abstract class AbstractPersistenceManager implements PersistenceManager {
       for (Map.Entry<String, EdmStreamValue> streamedChanges : handler.getStreamedPropertyChanges().entrySet()) {
         final URI targetURI = currentStatus == AttachedEntityStatus.NEW
                 ? URI.create("$" + startingPos) : URIUtils.getURI(
-                service.getClient().getServiceRoot(),
-                CoreUtils.getMediaEditLink(streamedChanges.getKey(), entity).toASCIIString());
+                        service.getClient().getServiceRoot(),
+                        CoreUtils.getMediaEditLink(streamedChanges.getKey(), entity).toASCIIString());
 
         queueUpdateMediaResource(handler, targetURI, streamedChanges.getValue(), changeset);
 
@@ -423,10 +435,10 @@ abstract class AbstractPersistenceManager implements PersistenceManager {
             service.getClient().getServiceVersion().compareTo(ODataServiceVersion.V30) <= 0
             ? ((org.apache.olingo.client.api.v3.EdmEnabledODataClient) service.getClient()).getCUDRequestFactory().
             getEntityUpdateRequest(handler.getEntityURI(),
-            org.apache.olingo.client.api.communication.request.cud.v3.UpdateType.PATCH, changes)
+                    org.apache.olingo.client.api.communication.request.cud.v3.UpdateType.PATCH, changes)
             : ((org.apache.olingo.client.api.v4.EdmEnabledODataClient) service.getClient()).getCUDRequestFactory().
             getEntityUpdateRequest(handler.getEntityURI(),
-            org.apache.olingo.client.api.communication.request.cud.v4.UpdateType.PATCH, changes);
+                    org.apache.olingo.client.api.communication.request.cud.v4.UpdateType.PATCH, changes);
 
     req.setPrefer(new ODataPreferences(service.getClient().getServiceVersion()).returnContent());
 
@@ -449,10 +461,10 @@ abstract class AbstractPersistenceManager implements PersistenceManager {
             service.getClient().getServiceVersion().compareTo(ODataServiceVersion.V30) <= 0
             ? ((org.apache.olingo.client.api.v3.EdmEnabledODataClient) service.getClient()).getCUDRequestFactory().
             getEntityUpdateRequest(uri,
-            org.apache.olingo.client.api.communication.request.cud.v3.UpdateType.PATCH, changes)
+                    org.apache.olingo.client.api.communication.request.cud.v3.UpdateType.PATCH, changes)
             : ((org.apache.olingo.client.api.v4.EdmEnabledODataClient) service.getClient()).getCUDRequestFactory().
             getEntityUpdateRequest(uri,
-            org.apache.olingo.client.api.communication.request.cud.v4.UpdateType.PATCH, changes);
+                    org.apache.olingo.client.api.communication.request.cud.v4.UpdateType.PATCH, changes);
 
     req.setPrefer(new ODataPreferences(service.getClient().getServiceVersion()).returnContent());
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b8918211/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractStructuredInvocationHandler.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractStructuredInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractStructuredInvocationHandler.java
index 1e0c2b5..0d68965 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractStructuredInvocationHandler.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractStructuredInvocationHandler.java
@@ -21,32 +21,6 @@ package org.apache.olingo.ext.proxy.commons;
 import java.io.InputStream;
 import java.lang.annotation.Annotation;
 import java.lang.reflect.InvocationHandler;
-import org.apache.commons.lang3.ArrayUtils;
-import org.apache.olingo.client.core.uri.URIUtils;
-import org.apache.olingo.commons.api.domain.CommonODataEntity;
-import org.apache.olingo.commons.api.domain.ODataInlineEntity;
-import org.apache.olingo.commons.api.domain.ODataInlineEntitySet;
-import org.apache.olingo.commons.api.domain.ODataLink;
-import org.apache.olingo.commons.api.domain.ODataLinked;
-import org.apache.olingo.ext.proxy.AbstractService;
-import org.apache.olingo.ext.proxy.api.EntityCollection;
-import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
-import org.apache.olingo.ext.proxy.api.annotations.NavigationProperty;
-import org.apache.olingo.ext.proxy.api.annotations.Property;
-import org.apache.olingo.ext.proxy.context.AttachedEntityStatus;
-import org.apache.olingo.ext.proxy.utils.ClassUtils;
-import org.apache.olingo.client.api.uri.CommonURIBuilder;
-import org.apache.olingo.commons.api.domain.CommonODataProperty;
-import org.apache.olingo.commons.api.domain.ODataValue;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.ext.proxy.api.ComplexCollection;
-import org.apache.olingo.ext.proxy.api.EdmStreamValue;
-import org.apache.olingo.ext.proxy.api.PrimitiveCollection;
-import org.apache.olingo.ext.proxy.api.annotations.Namespace;
-import org.apache.olingo.ext.proxy.context.EntityUUID;
-import org.apache.olingo.ext.proxy.utils.CoreUtils;
-
-
 import java.lang.reflect.Method;
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Proxy;
@@ -60,10 +34,35 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.concurrent.Callable;
 import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.ArrayUtils;
+import org.apache.olingo.client.api.uri.CommonURIBuilder;
+import org.apache.olingo.client.core.uri.URIUtils;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
+import org.apache.olingo.commons.api.domain.ODataInlineEntity;
+import org.apache.olingo.commons.api.domain.ODataInlineEntitySet;
+import org.apache.olingo.commons.api.domain.ODataLink;
+import org.apache.olingo.commons.api.domain.ODataLinked;
+import org.apache.olingo.commons.api.domain.ODataValue;
 import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.ext.proxy.AbstractService;
+import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
+import org.apache.olingo.ext.proxy.api.ComplexCollection;
+import org.apache.olingo.ext.proxy.api.EdmStreamValue;
+import org.apache.olingo.ext.proxy.api.EntityCollection;
+import org.apache.olingo.ext.proxy.api.PrimitiveCollection;
 import org.apache.olingo.ext.proxy.api.annotations.ComplexType;
+import org.apache.olingo.ext.proxy.api.annotations.Namespace;
+import org.apache.olingo.ext.proxy.api.annotations.NavigationProperty;
+import org.apache.olingo.ext.proxy.api.annotations.Property;
+import org.apache.olingo.ext.proxy.context.AttachedEntityStatus;
 import org.apache.olingo.ext.proxy.context.EntityContext;
+import org.apache.olingo.ext.proxy.context.EntityUUID;
+import org.apache.olingo.ext.proxy.utils.ClassUtils;
+import org.apache.olingo.ext.proxy.utils.CoreUtils;
 
 public abstract class AbstractStructuredInvocationHandler extends AbstractInvocationHandler {
 
@@ -165,6 +164,15 @@ public abstract class AbstractStructuredInvocationHandler extends AbstractInvoca
     } else if ("load".equals(method.getName()) && ArrayUtils.isEmpty(args)) {
       load();
       return proxy;
+    } else if ("loadAsync".equals(method.getName()) && ArrayUtils.isEmpty(args)) {
+      return service.getClient().getConfiguration().getExecutor().submit(new Callable<Object>() {
+
+        @Override
+        public Object call() throws Exception {
+          load();
+          return proxy;
+        }
+      });
     } else if ("operations".equals(method.getName()) && ArrayUtils.isEmpty(args)) {
       final Class<?> returnType = method.getReturnType();
 
@@ -284,9 +292,10 @@ public abstract class AbstractStructuredInvocationHandler extends AbstractInvoca
           res = Proxy.newProxyInstance(
                   Thread.currentThread().getContextClassLoader(),
                   new Class<?>[] {EdmStreamValue.class}, new EdmStreamValueHandler(
-                  baseURI == null
-                  ? null : getClient().newURIBuilder(baseURI.toASCIIString()).appendPropertySegment(name).build(),
-                  service));
+                          baseURI == null
+                          ? null
+                          : getClient().newURIBuilder(baseURI.toASCIIString()).appendPropertySegment(name).build(),
+                          service));
 
           streamedPropertyCache.put(name, EdmStreamValue.class.cast(res));
         }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b8918211/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/ComplexCollectionInvocationHandler.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/ComplexCollectionInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/ComplexCollectionInvocationHandler.java
index df629b1..84514ac 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/ComplexCollectionInvocationHandler.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/ComplexCollectionInvocationHandler.java
@@ -18,11 +18,6 @@
  */
 package org.apache.olingo.ext.proxy.commons;
 
-import org.apache.commons.lang3.ArrayUtils;
-import org.apache.commons.lang3.tuple.Triple;
-import org.apache.olingo.client.api.uri.CommonURIBuilder;
-import org.apache.olingo.commons.api.domain.v4.ODataAnnotation;
-
 import java.lang.reflect.Method;
 import java.lang.reflect.Proxy;
 import java.net.URI;
@@ -30,11 +25,16 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
+import org.apache.commons.lang3.ArrayUtils;
 import org.apache.commons.lang3.tuple.ImmutableTriple;
+import org.apache.commons.lang3.tuple.Triple;
 import org.apache.olingo.client.api.communication.request.retrieve.ODataPropertyRequest;
 import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
+import org.apache.olingo.client.api.uri.CommonURIBuilder;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
+import org.apache.olingo.commons.api.domain.ODataCollectionValue;
 import org.apache.olingo.commons.api.domain.ODataValue;
-import org.apache.olingo.commons.api.domain.v3.ODataProperty;
+import org.apache.olingo.commons.api.domain.v4.ODataAnnotation;
 import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
 import org.apache.olingo.ext.proxy.AbstractService;
 import org.apache.olingo.ext.proxy.api.ComplexCollection;
@@ -78,6 +78,7 @@ public class ComplexCollectionInvocationHandler<T extends ComplexType>
             || "select".equals(method.getName())
             || "nextPage".equals(method.getName())
             || "execute".equals(method.getName())) {
+
       invokeSelfMethod(method, args);
       return proxy;
     } else if (isSelfMethod(method, args)) {
@@ -97,18 +98,19 @@ public class ComplexCollectionInvocationHandler<T extends ComplexType>
   @SuppressWarnings("unchecked")
   @Override
   public Triple<List<T>, URI, List<ODataAnnotation>> fetchPartial(final URI uri, final Class<T> typeRef) {
-    final ODataPropertyRequest<ODataProperty> req = getClient().getRetrieveRequestFactory().getPropertyRequest(uri);
+    final ODataPropertyRequest<CommonODataProperty> req =
+            getClient().getRetrieveRequestFactory().getPropertyRequest(uri);
     if (getClient().getServiceVersion().compareTo(ODataServiceVersion.V30) > 0) {
       req.setPrefer(getClient().newPreferences().includeAnnotations("*"));
     }
 
-    final ODataRetrieveResponse<ODataProperty> res = req.execute();
+    final ODataRetrieveResponse<CommonODataProperty> res = req.execute();
 
-    List<T> resItems = new ArrayList<T>();
+    final List<T> resItems = new ArrayList<T>();
 
-    final ODataProperty property = res.getBody();
-    if (property != null && !property.hasNullValue()) {
-      for (ODataValue item : property.getCollectionValue()) {
+    final CommonODataProperty property = res.getBody();
+    if (property != null && property.hasCollectionValue()) {
+      for (ODataValue item : (ODataCollectionValue<ODataValue>) property.getValue()) {
         resItems.add((T) getComplex(property.getName(), item, typeRef, null, null, true));
       }
     }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b8918211/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityCollectionInvocationHandler.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityCollectionInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityCollectionInvocationHandler.java
index 8d85987..02864f6 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityCollectionInvocationHandler.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityCollectionInvocationHandler.java
@@ -18,16 +18,15 @@
  */
 package org.apache.olingo.ext.proxy.commons;
 
-import org.apache.commons.lang3.ArrayUtils;
-import org.apache.olingo.client.api.uri.CommonURIBuilder;
-import org.apache.olingo.ext.proxy.api.EntityCollection;
-
 import java.lang.reflect.Method;
 import java.lang.reflect.Proxy;
 import java.net.URI;
 import java.util.ArrayList;
 import java.util.Collection;
+import org.apache.commons.lang3.ArrayUtils;
+import org.apache.olingo.client.api.uri.CommonURIBuilder;
 import org.apache.olingo.ext.proxy.AbstractService;
+import org.apache.olingo.ext.proxy.api.EntityCollection;
 import org.apache.olingo.ext.proxy.api.EntityType;
 
 public class EntityCollectionInvocationHandler<T extends EntityType>
@@ -62,6 +61,7 @@ public class EntityCollectionInvocationHandler<T extends EntityType>
             || "select".equals(method.getName())
             || "nextPage".equals(method.getName())
             || "execute".equals(method.getName())) {
+
       invokeSelfMethod(method, args);
       return proxy;
     } else if (isSelfMethod(method, args)) {

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b8918211/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityContainerInvocationHandler.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityContainerInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityContainerInvocationHandler.java
index 32cff3d..f428a60 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityContainerInvocationHandler.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityContainerInvocationHandler.java
@@ -20,24 +20,24 @@ package org.apache.olingo.ext.proxy.commons;
 
 import java.io.InputStream;
 import java.io.Serializable;
-import org.apache.commons.lang3.ArrayUtils;
-import org.apache.olingo.ext.proxy.AbstractService;
-import org.apache.olingo.ext.proxy.api.annotations.EntityContainer;
-import org.apache.olingo.ext.proxy.api.annotations.EntitySet;
-import org.apache.olingo.ext.proxy.api.annotations.Singleton;
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Method;
 import java.lang.reflect.Proxy;
 import java.net.URI;
+import org.apache.commons.lang3.ArrayUtils;
 import org.apache.olingo.commons.api.domain.CommonODataEntity;
 import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.ext.proxy.AbstractService;
 import org.apache.olingo.ext.proxy.api.ComplexCollection;
 import org.apache.olingo.ext.proxy.api.ComplexType;
 import org.apache.olingo.ext.proxy.api.EdmStreamValue;
 import org.apache.olingo.ext.proxy.api.EntityCollection;
 import org.apache.olingo.ext.proxy.api.EntityType;
 import org.apache.olingo.ext.proxy.api.PrimitiveCollection;
+import org.apache.olingo.ext.proxy.api.annotations.EntityContainer;
+import org.apache.olingo.ext.proxy.api.annotations.EntitySet;
 import org.apache.olingo.ext.proxy.api.annotations.Namespace;
+import org.apache.olingo.ext.proxy.api.annotations.Singleton;
 import org.apache.olingo.ext.proxy.context.EntityUUID;
 import org.apache.olingo.ext.proxy.utils.ClassUtils;
 
@@ -93,6 +93,8 @@ public final class EntityContainerInvocationHandler extends AbstractInvocationHa
       return invokeSelfMethod(method, args);
     } else if ("flush".equals(method.getName()) && ArrayUtils.isEmpty(args)) {
       return service.getPersistenceManager().flush();
+    } else if ("flushAsync".equals(method.getName()) && ArrayUtils.isEmpty(args)) {
+      return service.getPersistenceManager().flushAsync();
     } else if ("operations".equals(method.getName()) && ArrayUtils.isEmpty(args)) {
       final Class<?> returnType = method.getReturnType();
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b8918211/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityInvocationHandler.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityInvocationHandler.java
index 5a08418..d996328 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityInvocationHandler.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityInvocationHandler.java
@@ -424,14 +424,13 @@ public class EntityInvocationHandler extends AbstractStructuredInvocationHandler
 
       final ODataRetrieveResponse<CommonODataEntity> res = req.execute();
 
-      final String etag = res.getETag();
       final CommonODataEntity entity = res.getBody();
       if (entity == null) {
         throw new IllegalArgumentException("Invalid " + typeRef.getSimpleName() + "(" + key + ")");
       }
 
       setEntity(entity);
-      setETag(etag);
+      setETag(res.getETag());
 
       if (key != null && !key.equals(CoreUtils.getKey(getClient(), this, typeRef, entity))) {
         throw new IllegalArgumentException("Invalid " + typeRef.getSimpleName() + "(" + key + ")");

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b8918211/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntitySetInvocationHandler.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntitySetInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntitySetInvocationHandler.java
index b96b830..0199d1b 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntitySetInvocationHandler.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntitySetInvocationHandler.java
@@ -18,6 +18,14 @@
  */
 package org.apache.olingo.ext.proxy.commons;
 
+import java.io.Serializable;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.Callable;
+import java.util.concurrent.Future;
 import org.apache.commons.lang3.tuple.Triple;
 import org.apache.olingo.client.api.communication.request.retrieve.ODataValueRequest;
 import org.apache.olingo.client.api.uri.CommonURIBuilder;
@@ -28,26 +36,19 @@ import org.apache.olingo.commons.api.domain.v4.ODataAnnotation;
 import org.apache.olingo.commons.api.edm.FullQualifiedName;
 import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
 import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.ext.proxy.api.EntityCollection;
+import org.apache.olingo.ext.proxy.AbstractService;
 import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
 import org.apache.olingo.ext.proxy.api.AbstractSingleton;
+import org.apache.olingo.ext.proxy.api.EntityCollection;
+import org.apache.olingo.ext.proxy.api.EntityType;
 import org.apache.olingo.ext.proxy.api.Search;
 import org.apache.olingo.ext.proxy.api.SingleQuery;
+import org.apache.olingo.ext.proxy.api.annotations.Namespace;
 import org.apache.olingo.ext.proxy.context.AttachedEntityStatus;
 import org.apache.olingo.ext.proxy.context.EntityContext;
 import org.apache.olingo.ext.proxy.context.EntityUUID;
 import org.apache.olingo.ext.proxy.utils.ClassUtils;
 
-import java.io.Serializable;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.olingo.ext.proxy.AbstractService;
-import org.apache.olingo.ext.proxy.api.EntityType;
-import org.apache.olingo.ext.proxy.api.annotations.Namespace;
-
 class EntitySetInvocationHandler<
         T extends EntityType, KEY extends Serializable, EC extends EntityCollection<T>>
         extends AbstractEntityCollectionInvocationHandler<T, EC>
@@ -82,6 +83,7 @@ class EntitySetInvocationHandler<
             || "skip".equals(method.getName())
             || "expand".equals(method.getName())
             || "select".equals(method.getName())) {
+
       invokeSelfMethod(method, args);
       return proxy;
     } else if (isSelfMethod(method, args)) {
@@ -149,6 +151,16 @@ class EntitySetInvocationHandler<
     return execute(collItemRef);
   }
 
+  public <S extends T, SEC extends EntityCollection<S>> Future<SEC> executeAsync(final Class<SEC> collTypeRef) {
+    return service.getClient().getConfiguration().getExecutor().submit(new Callable<SEC>() {
+
+      @Override
+      public SEC call() throws Exception {
+        return execute(collTypeRef);
+      }
+    });
+  }
+
   @SuppressWarnings("unchecked")
   public <S extends T, SEC extends EntityCollection<S>> SEC execute(final Class<SEC> collTypeRef) {
     final Class<S> ref = (Class<S>) ClassUtils.extractTypeArg(collTypeRef,

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b8918211/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/PrimitiveCollectionInvocationHandler.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/PrimitiveCollectionInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/PrimitiveCollectionInvocationHandler.java
index 725a178..4da4b1a 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/PrimitiveCollectionInvocationHandler.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/PrimitiveCollectionInvocationHandler.java
@@ -20,11 +20,6 @@ package org.apache.olingo.ext.proxy.commons;
 
 import java.io.Serializable;
 import java.lang.reflect.InvocationHandler;
-import org.apache.commons.lang3.ArrayUtils;
-import org.apache.commons.lang3.tuple.Triple;
-import org.apache.olingo.client.api.uri.CommonURIBuilder;
-import org.apache.olingo.commons.api.domain.v4.ODataAnnotation;
-
 import java.lang.reflect.Method;
 import java.lang.reflect.Proxy;
 import java.net.URI;
@@ -32,10 +27,14 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
+import org.apache.commons.lang3.ArrayUtils;
 import org.apache.commons.lang3.tuple.ImmutableTriple;
+import org.apache.commons.lang3.tuple.Triple;
 import org.apache.olingo.client.api.communication.request.retrieve.ODataPropertyRequest;
 import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
+import org.apache.olingo.client.api.uri.CommonURIBuilder;
 import org.apache.olingo.commons.api.domain.ODataValue;
+import org.apache.olingo.commons.api.domain.v4.ODataAnnotation;
 import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
 import org.apache.olingo.ext.proxy.AbstractService;
 import org.apache.olingo.ext.proxy.api.PrimitiveCollection;
@@ -72,7 +71,9 @@ public class PrimitiveCollectionInvocationHandler<T extends Serializable>
     if ("filter".equals(method.getName())
             || "top".equals(method.getName())
             || "skip".equals(method.getName())
-            || "execute".equals(method.getName())) {
+            || "execute".equals(method.getName())
+            || "executeAsync".equals(method.getName())) {
+
       invokeSelfMethod(method, args);
       return proxy;
     } else if (isSelfMethod(method, args)) {

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b8918211/fit/src/test/java/org/apache/olingo/fit/proxy/v3/AsyncTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/AsyncTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/AsyncTestITCase.java
index a622be0..62c2a73 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/AsyncTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/AsyncTestITCase.java
@@ -18,40 +18,30 @@
  */
 package org.apache.olingo.fit.proxy.v3;
 
-import org.apache.olingo.ext.proxy.api.AsyncCall;
-import org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.Person;
-import org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types
-    .EmployeeCollection;
-import org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.Product;
-import org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types
-    .ProductCollection;
-import org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types
-    .SpecialEmployeeCollection;
-import org.junit.Test;
-
-import java.util.UUID;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
-
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
+import java.util.List;
+import java.util.UUID;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import org.apache.olingo.commons.api.ODataRuntimeException;
+import org.junit.Test;
+
 //CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.EmployeeCollection;
+import org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.Product;
+import org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.ProductCollection;
+import org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.SpecialEmployeeCollection;
 //CHECKSTYLE:ON (Maven checkstyle)
 
 public class AsyncTestITCase extends AbstractTestITCase {
 
   @Test
   public void retrieveEntitySet() throws InterruptedException, ExecutionException {
-    final Future<ProductCollection> futureProds =
-            new AsyncCall<ProductCollection>(service.getClient().getConfiguration()) {
-      @Override
-      public ProductCollection call() {
-        return container.getProduct().execute();
-      }
-    };
+    final Future<ProductCollection> futureProds = container.getProduct().executeAsync();
     assertNotNull(futureProds);
 
     while (!futureProds.isDone()) {
@@ -73,46 +63,26 @@ public class AsyncTestITCase extends AbstractTestITCase {
     final Product product = container.getProduct().getByKey(-10);
     product.setDescription("AsyncTest#updateEntity " + random);
 
-    final Future<Void> futureFlush = new AsyncCall<Void>(service.getClient().getConfiguration()) {
-      @Override
-      public Void call() {
-        container.flush();
-        return null;
-      }
-    };
+    final Future<List<ODataRuntimeException>> futureFlush = container.flushAsync();
     assertNotNull(futureFlush);
 
     while (!futureFlush.isDone()) {
       Thread.sleep(1000L);
     }
 
-    final Future<Product> futureProd = new AsyncCall<Product>(service.getClient().getConfiguration()) {
-      @Override
-      public Product call() {
-        return container.getProduct().getByKey(-10);
-      }
-    };
-
+    final Future<Product> futureProd = container.getProduct().getByKey(-10).loadAsync();
     assertEquals("AsyncTest#updateEntity " + random, futureProd.get().load().getDescription());
   }
 
   @Test
   public void polymorphQuery() throws Exception {
-    final Future<Person> queryEmployee = new AsyncCall<Person>(service.getClient().getConfiguration()) {
-      @Override
-      public Person call() {
-        return container.getPerson();
-      }
-    };
-    assertFalse(queryEmployee.get().execute(EmployeeCollection.class).isEmpty());
+    final Future<EmployeeCollection> queryEmployee =
+            container.getPerson().executeAsync(EmployeeCollection.class);
+    assertFalse(queryEmployee.get().isEmpty());
 
-    final Future<Person> querySpecialEmployee = new AsyncCall<Person>(service.getClient().getConfiguration()) {
-      @Override
-      public Person call() {
-        return container.getPerson();
-      }
-    };
-    assertFalse(querySpecialEmployee.get().execute(SpecialEmployeeCollection.class).isEmpty());
+    final Future<SpecialEmployeeCollection> querySpecialEmployee =
+            container.getPerson().executeAsync(SpecialEmployeeCollection.class);
+    assertFalse(querySpecialEmployee.get().isEmpty());
 
     assertTrue(container.getPerson().execute().size()
             > container.getPerson().execute(EmployeeCollection.class).size()

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b8918211/fit/src/test/java/org/apache/olingo/fit/proxy/v3/MediaEntityTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/MediaEntityTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/MediaEntityTestITCase.java
index 3a61082..d4ded24 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/MediaEntityTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/MediaEntityTestITCase.java
@@ -16,24 +16,20 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
 package org.apache.olingo.fit.proxy.v3;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
 import org.apache.commons.io.IOUtils;
 import org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.Car;
 import org.junit.Test;
-
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import org.apache.olingo.ext.proxy.api.EdmStreamValue;
-import static org.apache.olingo.fit.proxy.v3.AbstractTestITCase.container;
-import static org.apache.olingo.fit.proxy.v3.AbstractTestITCase.service;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
 
 /**
  * This is the unit test class to check media entity retrieve operations.

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b8918211/fit/src/test/java/org/apache/olingo/fit/proxy/v4/APIBasicDesignTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/APIBasicDesignTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/APIBasicDesignTestITCase.java
index 1997287..3846ee2 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/APIBasicDesignTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/APIBasicDesignTestITCase.java
@@ -16,7 +16,6 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
 package org.apache.olingo.fit.proxy.v4;
 
 import static org.junit.Assert.assertEquals;
@@ -26,7 +25,6 @@ import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.fail;
 
-//CHECKSTYLE:OFF (Maven checkstyle)
 import java.io.IOException;
 import java.math.BigDecimal;
 import java.sql.Timestamp;
@@ -39,6 +37,8 @@ import org.apache.olingo.commons.api.format.ContentType;
 import org.apache.olingo.ext.proxy.AbstractService;
 import org.apache.olingo.ext.proxy.api.EdmStreamValue;
 import org.apache.olingo.ext.proxy.api.PrimitiveCollection;
+
+//CHECKSTYLE:OFF (Maven checkstyle)
 import org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.DefaultContainer;
 import org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.ContactDetailsCollection;
 import org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.PhoneCollection;

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b8918211/fit/src/test/java/org/apache/olingo/fit/proxy/v4/AsyncTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/AsyncTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/AsyncTestITCase.java
index 8681050..8676ec0 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/AsyncTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/AsyncTestITCase.java
@@ -22,11 +22,12 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 
+import java.util.List;
 import org.apache.commons.lang3.RandomStringUtils;
-import org.apache.olingo.ext.proxy.api.AsyncCall;
 import org.junit.Test;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Future;
+import org.apache.olingo.commons.api.ODataRuntimeException;
 
 //CHECKSTYLE:OFF (Maven checkstyle)
 import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Customer;
@@ -38,14 +39,7 @@ public class AsyncTestITCase extends AbstractTestITCase {
 
   @Test
   public void retrieveEntitySet() throws InterruptedException, ExecutionException {
-    final Future<CustomerCollection> futureCustomers =
-            new AsyncCall<CustomerCollection>(service.getClient().getConfiguration()) {
-
-              @Override
-              public CustomerCollection call() {
-                return container.getCustomers().execute();
-              }
-            };
+    final Future<CustomerCollection> futureCustomers = container.getCustomers().executeAsync();
     assertNotNull(futureCustomers);
 
     while (!futureCustomers.isDone()) {
@@ -61,34 +55,20 @@ public class AsyncTestITCase extends AbstractTestITCase {
   }
 
   @Test
-  public void updateEntity() throws InterruptedException {
+  public void updateEntity() throws Exception {
     final String randomFirstName = RandomStringUtils.random(10, "abcedfghijklmnopqrstuvwxyz");
 
-    Person person = container.getPeople().getByKey(1);
+    final Person person = container.getPeople().getByKey(1);
     person.setFirstName(randomFirstName);
 
-    final Future<Void> futureFlush = new AsyncCall<Void>(service.getClient().getConfiguration()) {
-
-      @Override
-      public Void call() {
-        container.flush();
-        return null;
-      }
-    };
+    final Future<List<ODataRuntimeException>> futureFlush = container.flushAsync();
     assertNotNull(futureFlush);
 
     while (!futureFlush.isDone()) {
       Thread.sleep(1000L);
     }
 
-    new AsyncCall<Person>(service.getClient().getConfiguration()) {
-
-      @Override
-      public Person call() {
-        return container.getPeople().getByKey(1);
-      }
-    };
-
-    assertEquals(randomFirstName, person.getFirstName());
+    final Future<Person> futurePerson = container.getPeople().getByKey(1).loadAsync();
+    assertEquals(randomFirstName, futurePerson.get().getFirstName());
   }
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b8918211/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataProperty.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataProperty.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataProperty.java
index c8911eb..e357e8a 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataProperty.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataProperty.java
@@ -25,49 +25,49 @@ public interface CommonODataProperty extends ODataInvokeResult {
 
   /**
    * Returns property name.
-   * 
+   *
    * @return property name.
    */
   String getName();
 
   /**
+   * Returns property value.
+   *
+   * @return property value.
+   */
+  ODataValue getValue();
+
+  /**
    * Checks if has null value.
-   * 
+   *
    * @return 'TRUE' if has null value; 'FALSE' otherwise.
    */
   boolean hasNullValue();
 
   /**
    * Checks if has primitive value.
-   * 
+   *
    * @return 'TRUE' if has primitive value; 'FALSE' otherwise.
    */
   boolean hasPrimitiveValue();
 
   /**
    * Gets primitive value.
-   * 
+   *
    * @return primitive value if exists; null otherwise.
    */
   ODataPrimitiveValue getPrimitiveValue();
 
   /**
-   * Returns property value.
-   * 
-   * @return property value.
-   */
-  ODataValue getValue();
-
-  /**
    * Checks if has collection value.
-   * 
+   *
    * @return 'TRUE' if has collection value; 'FALSE' otherwise.
    */
   boolean hasCollectionValue();
 
   /**
    * Checks if has complex value.
-   * 
+   *
    * @return 'TRUE' if has complex value; 'FALSE' otherwise.
    */
   boolean hasComplexValue();

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b8918211/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v3/ODataProperty.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v3/ODataProperty.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v3/ODataProperty.java
index 36091ec..46f1c39 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v3/ODataProperty.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v3/ODataProperty.java
@@ -1,18 +1,18 @@
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
+ * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
+ * regarding copyright ownership.  The ASF licenses this file
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * KIND, either express or implied.  See the License for the
  * specific language governing permissions and limitations
  * under the License.
  */
@@ -27,14 +27,14 @@ public interface ODataProperty extends CommonODataProperty {
 
   /**
    * Gets collection value.
-   * 
+   *
    * @return collection value if exists; null otherwise.
    */
   ODataCollectionValue<ODataValue> getCollectionValue();
 
   /**
    * Gets complex value.
-   * 
+   *
    * @return complex value if exists; null otherwise.
    */
   ODataComplexValue<ODataProperty> getComplexValue();

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b8918211/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataProperty.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataProperty.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataProperty.java
index ae9278f..f809681 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataProperty.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataProperty.java
@@ -1,18 +1,18 @@
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
+ * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
+ * regarding copyright ownership.  The ASF licenses this file
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * KIND, either express or implied.  See the License for the
  * specific language governing permissions and limitations
  * under the License.
  */
@@ -20,4 +20,5 @@ package org.apache.olingo.commons.api.domain.v4;
 
 import org.apache.olingo.commons.api.domain.CommonODataProperty;
 
-public interface ODataProperty extends CommonODataProperty, ODataAnnotatable, ODataValuable {}
+public interface ODataProperty extends CommonODataProperty, ODataAnnotatable, ODataValuable {
+}