Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2015-06-24 10:37:32 -0400
committerUwe Stieber2015-06-24 10:37:54 -0400
commit4c5d3ab5fa55ddec1c5584ef56171f9e849b9e80 (patch)
tree3b5146c9e44591c1fd2ad8a8c968f03c0e0f7dc5 /target_explorer/plugins
parentef294e08edad1a450011218f509a950a9ea51d68 (diff)
downloadorg.eclipse.tcf-4c5d3ab5fa55ddec1c5584ef56171f9e849b9e80.tar.gz
org.eclipse.tcf-4c5d3ab5fa55ddec1c5584ef56171f9e849b9e80.tar.xz
org.eclipse.tcf-4c5d3ab5fa55ddec1c5584ef56171f9e849b9e80.zip
Target Explorer: Remove unnecessary thread checks getting the peer model from a runtime model
Diffstat (limited to 'target_explorer/plugins')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/model/RuntimeModel.java49
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/runtime/RuntimeModel.java13
2 files changed, 40 insertions, 22 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/model/RuntimeModel.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/model/RuntimeModel.java
index f22accefa..37ffe6972 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/model/RuntimeModel.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/model/RuntimeModel.java
@@ -14,7 +14,6 @@ import static org.eclipse.tcf.te.tcf.locator.model.ModelManager.getPeerModel;
import java.beans.PropertyChangeEvent;
import java.io.File;
import java.util.List;
-import java.util.concurrent.atomic.AtomicReference;
import org.eclipse.core.runtime.Assert;
import org.eclipse.tcf.protocol.IChannel;
@@ -80,24 +79,39 @@ public final class RuntimeModel extends ContainerModelNode implements IRuntimeMo
return new Delegate();
}
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.properties.PropertiesContainer#checkThreadAccess()
+ */
@Override
protected boolean checkThreadAccess() {
return Protocol.isDispatchThread();
}
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.protocol.IChannel.IChannelListener#onChannelOpened()
+ */
@Override
public void onChannelOpened() {
}
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.protocol.IChannel.IChannelListener#congestionLevel(int)
+ */
@Override
public void congestionLevel(int level) {
}
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.protocol.IChannel.IChannelListener#onChannelClosed(java.lang.Throwable)
+ */
@Override
public void onChannelClosed(Throwable error) {
ModelManager.disposeRuntimeModel(fPeerNode);
}
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.core.model.interfaces.IModel#dispose()
+ */
@Override
public void dispose() {
Assert.isTrue(checkThreadAccess(), "Illegal Thread Access"); //$NON-NLS-1$
@@ -105,13 +119,18 @@ public final class RuntimeModel extends ContainerModelNode implements IRuntimeMo
fRoot.setContent(new FSTreeNode[0], false);
}
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.core.model.interfaces.IModel#isDisposed()
+ */
@Override
public boolean isDisposed() {
Assert.isTrue(checkThreadAccess(), "Illegal Thread Access"); //$NON-NLS-1$
return fFileSystem == null;
}
-
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.core.model.interfaces.IModel#getService(java.lang.Class)
+ */
@Override
@SuppressWarnings("unchecked")
public <V extends IModelService> V getService(Class<V> serviceInterface) {
@@ -119,38 +138,46 @@ public final class RuntimeModel extends ContainerModelNode implements IRuntimeMo
return (V)getAdapter(serviceInterface);
}
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.core.interfaces.runtime.IRuntimeModel#getDelegate()
+ */
@Override
public Delegate getDelegate() {
return fDelegate;
}
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.properties.PropertiesContainer#getAdapter(java.lang.Class)
+ */
@Override
public Object getAdapter(Class adapter) {
if (IPeerNode.class.isAssignableFrom(adapter) || IConnectable.class.isAssignableFrom(adapter)) {
- final AtomicReference<IPeerNode> peerNode = new AtomicReference<IPeerNode>();
- Protocol.invokeAndWait(new Runnable() {
- @Override
- public void run() {
- peerNode.set(getPeerNode());
- }
- });
- return peerNode.get();
+ return getPeerNode();
}
return super.getAdapter(adapter);
}
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.core.model.interfaces.IModel#setFactory(org.eclipse.tcf.te.runtime.model.interfaces.factory.IFactory)
+ */
@Override
public void setFactory(IFactory factory) {
}
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.core.model.interfaces.IModel#getFactory()
+ */
@Override
public IFactory getFactory() {
return Factory.getInstance();
}
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNodeProvider#getPeerNode()
+ */
@Override
- public IPeerNode getPeerNode() {
+ public final IPeerNode getPeerNode() {
return fPeerNode;
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/runtime/RuntimeModel.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/runtime/RuntimeModel.java
index 8ef38550f..e875d3d9a 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/runtime/RuntimeModel.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/runtime/RuntimeModel.java
@@ -11,7 +11,6 @@ package org.eclipse.tcf.te.tcf.processes.core.model.runtime;
import java.util.Timer;
import java.util.TimerTask;
-import java.util.concurrent.atomic.AtomicReference;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IStatus;
@@ -168,14 +167,7 @@ public final class RuntimeModel extends ContainerModelNode implements IRuntimeMo
return refreshableCtxAdapter;
}
if (IPeerNode.class.isAssignableFrom(adapter) || IConnectable.class.isAssignableFrom(adapter)) {
- final AtomicReference<IPeerNode> peerNode = new AtomicReference<IPeerNode>();
- Protocol.invokeAndWait(new Runnable() {
- @Override
- public void run() {
- peerNode.set(getPeerNode());
- }
- });
- return peerNode.get();
+ return getPeerNode();
}
return super.getAdapter(adapter);
@@ -203,8 +195,7 @@ public final class RuntimeModel extends ContainerModelNode implements IRuntimeMo
* @see org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNodeProvider#getPeerModel()
*/
@Override
- public IPeerNode getPeerNode() {
- Assert.isTrue(checkThreadAccess(), "Illegal Thread Access"); //$NON-NLS-1$
+ public final IPeerNode getPeerNode() {
return peerNode;
}

Back to the top