Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2016-02-18 20:16:02 +0000
committerslewis2016-02-18 20:16:02 +0000
commitb99b3743f66e96c2b2b27376db77c2ad52368c34 (patch)
treeec00190774b72912adbe8b7d76a3b4325434b90e /framework
parent064db6258511d4665a43381ba4fbbbad414997de (diff)
downloadorg.eclipse.ecf-b99b3743f66e96c2b2b27376db77c2ad52368c34.tar.gz
org.eclipse.ecf-b99b3743f66e96c2b2b27376db77c2ad52368c34.tar.xz
org.eclipse.ecf-b99b3743f66e96c2b2b27376db77c2ad52368c34.zip
Fix for bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=488045
Diffstat (limited to 'framework')
-rw-r--r--framework/bundles/org.eclipse.ecf.provider/META-INF/MANIFEST.MF2
-rw-r--r--framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/internal/provider/ProviderPlugin.java11
-rw-r--r--framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/comm/tcp/Client.java13
-rw-r--r--framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/comm/tcp/SSLClient.java11
-rw-r--r--framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/SOContainer.java1
-rw-r--r--framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/util/BundleClassResolver.java6
-rw-r--r--framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/util/ClassResolverObjectInputStream.java41
7 files changed, 27 insertions, 58 deletions
diff --git a/framework/bundles/org.eclipse.ecf.provider/META-INF/MANIFEST.MF b/framework/bundles/org.eclipse.ecf.provider/META-INF/MANIFEST.MF
index 1fa9519f5..4b821d09d 100644
--- a/framework/bundles/org.eclipse.ecf.provider/META-INF/MANIFEST.MF
+++ b/framework/bundles/org.eclipse.ecf.provider/META-INF/MANIFEST.MF
@@ -1,6 +1,6 @@
Manifest-Version: 1.0
Bundle-SymbolicName: org.eclipse.ecf.provider;singleton:=true
-Bundle-Version: 4.7.300.qualifier
+Bundle-Version: 4.7.400.qualifier
Bundle-Name: %plugin.name
Bundle-Vendor: %plugin.provider
Bundle-Activator: org.eclipse.ecf.internal.provider.ProviderPlugin
diff --git a/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/internal/provider/ProviderPlugin.java b/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/internal/provider/ProviderPlugin.java
index 0b19a6e4f..f2a5f483e 100644
--- a/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/internal/provider/ProviderPlugin.java
+++ b/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/internal/provider/ProviderPlugin.java
@@ -32,6 +32,7 @@ public class ProviderPlugin implements BundleActivator {
public static final String PLUGIN_ID = "org.eclipse.ecf.provider"; //$NON-NLS-1$
+ private static final boolean genericClassResolverOverride = Boolean.valueOf(System.getProperty("org.eclipse.ecf.provider.classResolverOverride", "false")); //$NON-NLS-1$ //$NON-NLS-2$
//The shared instance.
private static ProviderPlugin plugin;
@@ -78,13 +79,15 @@ public class ProviderPlugin implements BundleActivator {
context1.registerService(ContainerTypeDescription.class, new ContainerTypeDescription(SSLGenericContainerInstantiator.SSLCLIENT_NAME, new SSLGenericContainerInstantiator(), "ECF SSL Generic Client", false, true), null); //$NON-NLS-1$
}
});
- Hashtable<String, Object> props = new Hashtable<String, Object>();
- props.put(IClassResolver.BUNDLE_PROP_NAME, PLUGIN_ID);
- this.context.registerService(IClassResolver.class, new BundleClassResolver(context.getBundle()), props);
+ if (genericClassResolverOverride) {
+ Hashtable<String, Object> props = new Hashtable<String, Object>();
+ props.put(IClassResolver.BUNDLE_PROP_NAME, PLUGIN_ID);
+ this.context.registerService(IClassResolver.class, new BundleClassResolver(context.getBundle()), props);
+ }
}
public ObjectInputStream createObjectInputStream(InputStream ins) throws IOException {
- return ClassResolverObjectInputStream.create(this.context, ins);
+ return (genericClassResolverOverride) ? ClassResolverObjectInputStream.create(this.context, ins) : new ObjectInputStream(ins);
}
/**
diff --git a/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/comm/tcp/Client.java b/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/comm/tcp/Client.java
index 76cc55992..cec28cd0f 100644
--- a/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/comm/tcp/Client.java
+++ b/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/comm/tcp/Client.java
@@ -51,7 +51,6 @@ public final class Client implements ISynchAsynchConnection {
protected boolean waitForPing = false;
protected PingMessage ping = new PingMessage();
protected PingResponseMessage pingResp = new PingResponseMessage();
- protected int maxMsg = DEFAULT_MAX_BUFFER_MSG;
protected long closeTimeout = DEFAULT_CLOSE_TIMEOUT;
protected Map properties;
protected ID containerID = null;
@@ -105,7 +104,6 @@ public final class Client implements ISynchAsynchConnection {
outputStream = oStream;
this.handler = handler;
containerID = handler.getEventHandlerID();
- maxMsg = maxmsgs;
properties = new Properties();
setupThreads();
}
@@ -245,7 +243,6 @@ public final class Client implements ISynchAsynchConnection {
Thread getSendThread() {
final Thread aThread = new Thread(new Runnable() {
public void run() {
- int msgCount = 0;
Thread me = Thread.currentThread();
// Loop until done sending messages (thread explicitly
// interrupted or queue.peekQueue() returns null
@@ -262,14 +259,6 @@ public final class Client implements ISynchAsynchConnection {
send(aMsg);
// Successful...remove message from queue
queue.removeHead();
- if (msgCount >= maxMsg) {
- // need to synchronize to avoid concurrent access to outputStream
- synchronized (outputStreamLock) {
- outputStream.reset();
- }
- msgCount = 0;
- } else
- msgCount++;
} catch (Exception e) {
handleException(e);
break;
@@ -311,8 +300,6 @@ public final class Client implements ISynchAsynchConnection {
}
void send(Serializable snd) throws IOException {
- // debug("send(" + snd + ")"); //$NON-NLS-1$ //$NON-NLS-2$
- // need to synchronize to avoid concurrent access to outputStream
synchronized (outputStreamLock) {
outputStream.writeObject(snd);
outputStream.flush();
diff --git a/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/comm/tcp/SSLClient.java b/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/comm/tcp/SSLClient.java
index 94710ce3d..f5262da01 100644
--- a/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/comm/tcp/SSLClient.java
+++ b/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/comm/tcp/SSLClient.java
@@ -55,7 +55,6 @@ public final class SSLClient implements ISynchAsynchConnection {
protected boolean waitForPing = false;
protected PingMessage ping = new PingMessage();
protected PingResponseMessage pingResp = new PingResponseMessage();
- protected int maxMsg = DEFAULT_MAX_BUFFER_MSG;
protected long closeTimeout = DEFAULT_CLOSE_TIMEOUT;
protected Map properties;
protected ID containerID = null;
@@ -108,7 +107,6 @@ public final class SSLClient implements ISynchAsynchConnection {
outputStream = oStream;
this.handler = handler;
containerID = handler.getEventHandlerID();
- maxMsg = maxmsgs;
properties = new Properties();
setupThreads();
}
@@ -231,7 +229,6 @@ public final class SSLClient implements ISynchAsynchConnection {
Thread getSendThread() {
final Thread aThread = new Thread(new Runnable() {
public void run() {
- int msgCount = 0;
Thread me = Thread.currentThread();
// Loop until done sending messages (thread explicitly
// interrupted or queue.peekQueue() returns null
@@ -248,14 +245,6 @@ public final class SSLClient implements ISynchAsynchConnection {
send(aMsg);
// Successful...remove message from queue
queue.removeHead();
- if (msgCount >= maxMsg) {
- // need to synchronize to avoid concurrent access to outputStream
- synchronized (outputStreamLock) {
- outputStream.reset();
- }
- msgCount = 0;
- } else
- msgCount++;
} catch (Exception e) {
handleException(e);
break;
diff --git a/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/SOContainer.java b/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/SOContainer.java
index 206c7ccfe..311125db2 100644
--- a/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/SOContainer.java
+++ b/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/SOContainer.java
@@ -700,7 +700,6 @@ public abstract class SOContainer extends AbstractContainer implements ISharedOb
final ID sharedObjectID = resp.getFromSharedObjectID();
SOWrapper sow = null;
Serializable obj = null;
- debug("handleSharedObjectMessage(from=" + fromID + ",to=" + toID + ",sharedObject=" + sharedObjectID + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
synchronized (getGroupMembershipLock()) {
// We only deliver to local copy if the toID equals null (all), or it equals ours
if (verifySharedObjectMessageTarget(toID)) {
diff --git a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/util/BundleClassResolver.java b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/util/BundleClassResolver.java
index 01db8696c..017e42a4e 100644
--- a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/util/BundleClassResolver.java
+++ b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/util/BundleClassResolver.java
@@ -10,8 +10,6 @@ package org.eclipse.ecf.core.util;
import java.io.ObjectStreamClass;
import org.eclipse.core.runtime.Assert;
-import org.eclipse.ecf.internal.core.ECFDebugOptions;
-import org.eclipse.ecf.internal.core.ECFPlugin;
import org.osgi.framework.Bundle;
/**
@@ -28,13 +26,11 @@ public class BundleClassResolver implements IClassResolver {
@SuppressWarnings("unused")
protected void verifyClass(ObjectStreamClass desc) throws ClassNotFoundException {
- // do nothing
+ // do nothing by default
}
public Class<?> resolveClass(ObjectStreamClass desc) throws ClassNotFoundException {
- Trace.trace(ECFPlugin.PLUGIN_ID, ECFDebugOptions.BUNDLECLASSRESOLVER, this.getClass(), "resolveClass", "bundle=" + this.bundle + ",class=" + desc); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
verifyClass(desc);
try {
diff --git a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/util/ClassResolverObjectInputStream.java b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/util/ClassResolverObjectInputStream.java
index 3445a3398..00d35d6be 100644
--- a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/util/ClassResolverObjectInputStream.java
+++ b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/util/ClassResolverObjectInputStream.java
@@ -48,8 +48,6 @@ public class ClassResolverObjectInputStream extends ObjectInputStream {
private final BundleContext bundleContext;
private ServiceTracker<IClassResolver, IClassResolver> classResolverST;
- private final Object trackerLock = new Object();
- private final Filter classResolverFilter;
private Filter createClassResolverFilter(String classResolverFilterString) throws InvalidSyntaxException {
String objectClassFilterString = "(" + Constants.OBJECTCLASS + "=" + IClassResolver.class.getName() + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
@@ -61,7 +59,7 @@ public class ClassResolverObjectInputStream extends ObjectInputStream {
protected ClassResolverObjectInputStream(BundleContext ctxt, String classResolverFilter) throws IOException, SecurityException, InvalidSyntaxException {
super();
this.bundleContext = ctxt;
- this.classResolverFilter = createClassResolverFilter(classResolverFilter);
+ this.classResolverST = new ServiceTracker<IClassResolver, IClassResolver>(this.bundleContext, createClassResolverFilter(classResolverFilter), null);
}
protected ClassResolverObjectInputStream(BundleContext ctxt) throws IOException, SecurityException, InvalidSyntaxException {
@@ -71,7 +69,7 @@ public class ClassResolverObjectInputStream extends ObjectInputStream {
public ClassResolverObjectInputStream(BundleContext ctxt, InputStream ins, String classResolverFilter) throws IOException, SecurityException, InvalidSyntaxException {
super(ins);
this.bundleContext = ctxt;
- this.classResolverFilter = createClassResolverFilter(classResolverFilter);
+ this.classResolverST = new ServiceTracker<IClassResolver, IClassResolver>(this.bundleContext, createClassResolverFilter(classResolverFilter), null);
}
public ClassResolverObjectInputStream(BundleContext ctxt, InputStream ins) throws IOException, SecurityException, InvalidSyntaxException {
@@ -82,19 +80,27 @@ public class ClassResolverObjectInputStream extends ObjectInputStream {
return this.bundleContext;
}
+ private IClassResolver getClassResolver() {
+ IClassResolver result = null;
+ if (this.classResolverST != null) {
+ this.classResolverST.open();
+ result = this.classResolverST.getService();
+ this.classResolverST.close();
+ }
+ return result;
+ }
+
@SuppressWarnings("unused")
@Override
protected Class<?> resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException {
- synchronized (trackerLock) {
- if (classResolverST == null) {
- classResolverST = new ServiceTracker<IClassResolver, IClassResolver>(this.bundleContext, classResolverFilter, null);
- classResolverST.open();
- }
+ IClassResolver classResolver = null;
+ if (this.classResolverST != null) {
+ this.classResolverST.open();
+ classResolver = this.classResolverST.getService();
+ this.classResolverST.close();
}
- IClassResolver classResolver = this.classResolverST.getService();
- if (classResolver != null) {
+ if (classResolver != null)
return classResolver.resolveClass(desc);
- }
throw new ClassNotFoundException("Cannot deserialize class=" + desc + " because no IClassResolver service available"); //$NON-NLS-1$ //$NON-NLS-2$
}
@@ -107,15 +113,4 @@ public class ClassResolverObjectInputStream extends ObjectInputStream {
throw new ClassNotFoundException("Could not find class=" + desc); //$NON-NLS-1$
}
- @Override
- public void close() throws IOException {
- super.close();
- synchronized (trackerLock) {
- if (classResolverST != null) {
- classResolverST.close();
- classResolverST = null;
- }
- }
- }
-
}

Back to the top