Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2018-03-09 14:05:50 -0500
committerslewis2018-03-09 14:05:50 -0500
commitdc9ea56b7e71e9001c8748c7dfdc0c29b96b6270 (patch)
tree2c638b3872df15d34ab33f6e8ff45b05b42ce420 /framework/bundles
parent79c46b125fcfe725bb0001347cef84f63cd42bbe (diff)
downloadorg.eclipse.ecf-dc9ea56b7e71e9001c8748c7dfdc0c29b96b6270.tar.gz
org.eclipse.ecf-dc9ea56b7e71e9001c8748c7dfdc0c29b96b6270.tar.xz
org.eclipse.ecf-dc9ea56b7e71e9001c8748c7dfdc0c29b96b6270.zip
Moved target platform to oxygen for tycho-based build. Also added
access to org.osgi.util.promise package (in oxygen only) to support osgi.async intent (R7) Change-Id: Iee0e76cd137f684aade4ee52d5c286eb1159ea7e
Diffstat (limited to 'framework/bundles')
-rw-r--r--framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/GenericContainerInstantiator.java2
-rw-r--r--framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/AbstractRemoteService.java35
2 files changed, 34 insertions, 3 deletions
diff --git a/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/GenericContainerInstantiator.java b/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/GenericContainerInstantiator.java
index 32650c77b..1f1e7a8f5 100644
--- a/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/GenericContainerInstantiator.java
+++ b/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/GenericContainerInstantiator.java
@@ -27,7 +27,7 @@ public class GenericContainerInstantiator implements IContainerInstantiator, IRe
/**
* @since 2.0
*/
- protected static final String[] genericProviderIntents = {"passByValue", "exactlyOnce", "ordered",}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ protected static final String[] genericProviderIntents = {"osgi.basic", "osgi.async", "passByValue", "exactlyOnce", "ordered"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
public static final String TCPCLIENT_NAME = "ecf.generic.client"; //$NON-NLS-1$
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/AbstractRemoteService.java b/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/AbstractRemoteService.java
index b48f78a0e..412a2c7db 100644
--- a/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/AbstractRemoteService.java
+++ b/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/AbstractRemoteService.java
@@ -458,6 +458,30 @@ public abstract class AbstractRemoteService extends AbstractAsyncProxyRemoteServ
throw new ServiceException("Unexpected exception for method=" + methodName + " on remote service proxy=" + getRemoteServiceID(), ServiceException.REMOTE, e); //$NON-NLS-1$ //$NON-NLS-2$
}
+ /**
+ * @since 8.13
+ */
+ protected Object invokeReturnAsync(Object proxy, Method method, Object[] args) throws Throwable {
+ final String invokeMethodName = method.getName();
+ final AsyncArgs asyncArgs = new AsyncArgs(args, method.getReturnType());
+ RemoteCall remoteCall = getAsyncRemoteCall(invokeMethodName, asyncArgs.getArgs());
+ return callFuture(remoteCall, asyncArgs.getReturnType());
+ }
+
+ /**
+ * @since 8.13
+ */
+ protected boolean isOSGIAsync() {
+ return getRemoteServiceReference().getProperty(Constants.OSGI_ASYNC_INTENT) != null;
+ }
+
+ /**
+ * @since 8.13
+ */
+ protected boolean isInterfaceAsync(Class interfaceClass) {
+ return interfaceClass.getName().endsWith(IAsyncRemoteServiceProxy.ASYNC_INTERFACE_SUFFIX);
+ }
+
public Object invoke(Object proxy, final Method method, final Object[] args) throws Throwable {
Object resultObject = null;
try {
@@ -471,11 +495,18 @@ public abstract class AbstractRemoteService extends AbstractAsyncProxyRemoteServ
return resultObject;
try {
- if (isAsync(proxy, method, args))
- return invokeAsync(method, args);
+ // If return is async type (Future, IFuture, CompletableFuture, CompletionStage)
+ if (isReturnAsync(proxy, method, args)) {
+ if (isInterfaceAsync(method.getDeclaringClass()))
+ return invokeAsync(method, args);
+ // If OSGI Async
+ if (isOSGIAsync())
+ return invokeReturnAsync(proxy, method, args);
+ }
} catch (Throwable t) {
handleProxyException("Exception invoking async method on remote service proxy=" + getRemoteServiceID(), t); //$NON-NLS-1$
}
+
// Get the callMethod, callParameters, and callTimeout
final String callMethod = getCallMethodNameForProxyInvoke(method, args);
final Object[] callParameters = getCallParametersForProxyInvoke(callMethod, method, args);

Back to the top