Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2018-03-14 13:32:30 -0400
committerslewis2018-03-14 13:32:30 -0400
commiteca50a8929df30b12b3dfc826e59a73fbe5f07a2 (patch)
treee9e13cfd7cdb4ae7e5ba07490f41c9f3bc19cd41 /framework
parent753d3e198879042afa1be6547dee5f557c22b36c (diff)
downloadorg.eclipse.ecf-eca50a8929df30b12b3dfc826e59a73fbe5f07a2.tar.gz
org.eclipse.ecf-eca50a8929df30b12b3dfc826e59a73fbe5f07a2.tar.xz
org.eclipse.ecf-eca50a8929df30b12b3dfc826e59a73fbe5f07a2.zip
Additional fixes for bug
https://bugs.eclipse.org/bugs/show_bug.cgi?id=532205 Change-Id: I0000000000000000000000000000000000000000
Diffstat (limited to 'framework')
-rw-r--r--framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/AbstractRemoteService.java17
-rw-r--r--framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/client/AbstractRSAClientService.java15
-rw-r--r--framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/provider/RemoteServiceContainerInstantiator.java3
3 files changed, 32 insertions, 3 deletions
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 4c87e71cc..01437f489 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
@@ -12,6 +12,7 @@ package org.eclipse.ecf.remoteservice;
import java.lang.reflect.*;
import java.util.*;
import java.util.concurrent.*;
+import java.util.concurrent.TimeoutException;
import org.eclipse.core.runtime.*;
import org.eclipse.ecf.core.jobs.JobsExecutor;
import org.eclipse.ecf.core.util.ECFException;
@@ -700,6 +701,22 @@ public abstract class AbstractRemoteService extends AbstractAsyncProxyRemoteServ
}
/**
+ * @since 8.13
+ */
+ public Object submitCallable(Callable<Object> callable, long timeout) throws ECFException {
+ Future<Object> f = getFutureExecutorService(null).submit(callable);
+ try {
+ return f.get(timeout, TimeUnit.MILLISECONDS);
+ } catch (InterruptedException e) {
+ throw new ECFException("submitCallable interrupted", e); //$NON-NLS-1$
+ } catch (ExecutionException e) {
+ throw new ECFException("submitCallable interrupted", e.getCause()); //$NON-NLS-1$
+ } catch (TimeoutException e) {
+ throw new ECFException("submitCallable timed out", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
* @since 8.2
*/
public void dispose() {
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/client/AbstractRSAClientService.java b/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/client/AbstractRSAClientService.java
index 39ded4c48..a7bd70f82 100644
--- a/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/client/AbstractRSAClientService.java
+++ b/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/client/AbstractRSAClientService.java
@@ -89,8 +89,19 @@ public abstract class AbstractRSAClientService extends AbstractClientService {
Object resultObject = invokeObject(proxy, method, args);
if (resultObject != null)
return resultObject;
- if (isAsync(proxy, method, args))
- return invokeAsync(createRemoteCall(proxy, method, getAsyncInvokeMethodName(method), args, getDefaultTimeout()));
+ try {
+ // If return is async type (Future, IFuture, CompletableFuture, CompletionStage)
+ if (isReturnAsync(proxy, method, args)) {
+ if (isInterfaceAsync(method.getDeclaringClass()) && isMethodAsync(method.getName()))
+ return invokeAsync(createRemoteCall(proxy, method, getAsyncInvokeMethodName(method), args, getDefaultTimeout()));
+ // If OSGI Async then invoke method directly
+ if (isOSGIAsync())
+ return invokeReturnAsync(proxy, method, args);
+ }
+ } catch (Throwable t) {
+ handleProxyException("Exception invoking async method on remote service proxy=" + getRemoteServiceID(), t); //$NON-NLS-1$
+ }
+
final String callMethod = getCallMethodNameForProxyInvoke(method, args);
final Object[] callParameters = getCallParametersForProxyInvoke(callMethod, method, args);
final long callTimeout = getCallTimeoutForProxyInvoke(callMethod, method, args);
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/provider/RemoteServiceContainerInstantiator.java b/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/provider/RemoteServiceContainerInstantiator.java
index 46377b378..608b73355 100644
--- a/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/provider/RemoteServiceContainerInstantiator.java
+++ b/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/provider/RemoteServiceContainerInstantiator.java
@@ -12,6 +12,7 @@ import java.util.*;
import org.eclipse.ecf.core.*;
import org.eclipse.ecf.core.provider.BaseContainerInstantiator;
import org.eclipse.ecf.core.provider.IRemoteServiceContainerInstantiator;
+import org.eclipse.ecf.remoteservice.Constants;
import org.eclipse.ecf.remoteservice.IRemoteServiceContainerAdapter;
/**
@@ -22,7 +23,7 @@ public abstract class RemoteServiceContainerInstantiator extends BaseContainerIn
protected static final String[] defaultSupportedAdapterTypes = new String[] {IContainer.class.getName(), IRemoteServiceContainerAdapter.class.getName()};
protected static final Class[][] defaultSupportedParameterTypes = new Class[][] {{Map.class}};
- protected static final String[] defaultSupportedIntents = new String[] {"passByValue", "exactlyOnce", "ordered"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ protected static final String[] defaultSupportedIntents = new String[] {Constants.OSGI_BASIC_INTENT, "passByValue", "exactlyOnce", "ordered"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
public String[] getSupportedAdapterTypes(ContainerTypeDescription description) {
return defaultSupportedAdapterTypes;

Back to the top