summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-08-04 05:02:03 (EDT)
committerEike Stepper2007-08-04 05:02:03 (EDT)
commit06a02453973969420d70cf304f0144a659e530dd (patch)
tree58f03b1e08fd723df0369a55da8a6170dde445c3
parent7397ec3148801fa6c91c57f5d45eb39715ffb6e9 (diff)
downloadcdo-06a02453973969420d70cf304f0144a659e530dd.zip
cdo-06a02453973969420d70cf304f0144a659e530dd.tar.gz
cdo-06a02453973969420d70cf304f0144a659e530dd.tar.bz2
*** empty log message ***
-rw-r--r--plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/ControlChannel.java12
-rw-r--r--plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/views/ContainerView.java3
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/Channel.java2
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/Connector.java51
4 files changed, 50 insertions, 18 deletions
diff --git a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/ControlChannel.java b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/ControlChannel.java
index b948ab3..d8060c5 100644
--- a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/ControlChannel.java
+++ b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/ControlChannel.java
@@ -148,11 +148,13 @@ public final class ControlChannel extends Channel
{
try
{
- Channel channel = ((TCPConnector)getConnector()).getChannel(channelIndex);
- if (channel != null)
- {
- channel.deactivate();
- }
+ getConnector().inverseRemoveChannel(channelIndex);
+ // Channel channel =
+ // ((TCPConnector)getConnector()).getChannel(channelIndex);
+ // if (channel != null)
+ // {
+ // channel.deactivate();
+ // }
}
catch (Exception ex)
{
diff --git a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/views/ContainerView.java b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/views/ContainerView.java
index f785db6..1f56168 100644
--- a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/views/ContainerView.java
+++ b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/views/ContainerView.java
@@ -50,6 +50,7 @@ public abstract class ContainerView extends ViewPart implements ISetSelectionTar
{
}
+ @Override
public void setFocus()
{
viewer.getControl().setFocus();
@@ -60,6 +61,7 @@ public abstract class ContainerView extends ViewPart implements ISetSelectionTar
viewer.setSelection(selection, true);
}
+ @Override
public void createPartControl(Composite parent)
{
itemProvider = createContainerItemProvider();
@@ -262,7 +264,6 @@ public abstract class ContainerView extends ViewPart implements ISetSelectionTar
@Override
protected void doRun() throws Exception
{
- System.out.println("Refreshing");
viewer.refresh(false);
}
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/Channel.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/Channel.java
index a614acb..43421b0 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/Channel.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/Channel.java
@@ -132,7 +132,6 @@ public class Channel extends Lifecycle implements IChannel, IBufferProvider
public void close()
{
- connector.removeChannel(this, true);
deactivate();
}
@@ -227,6 +226,7 @@ public class Channel extends Lifecycle implements IChannel, IBufferProvider
@Override
protected void doDeactivate() throws Exception
{
+ connector.removeChannel(this);
receiveSerializer = null;
if (sendQueue != null)
{
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/Connector.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/Connector.java
index d88d6cc..8b3067c 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/Connector.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/Connector.java
@@ -30,7 +30,6 @@ import org.eclipse.net4j.internal.util.om.trace.ContextTracer;
import org.eclipse.net4j.util.StringUtil;
import org.eclipse.net4j.util.concurrent.RWLock;
import org.eclipse.net4j.util.container.IContainer;
-import org.eclipse.net4j.util.container.IContainerDelta;
import org.eclipse.net4j.util.container.IContainerEvent;
import org.eclipse.net4j.util.container.IContainerDelta.Kind;
import org.eclipse.net4j.util.event.IListener;
@@ -88,10 +87,10 @@ public abstract class Connector extends Lifecycle implements IConnector
@Override
protected IContainerEvent createContainerEvent(IContainer container, Object element, Kind kind)
{
- if (kind == IContainerDelta.Kind.REMOVED)
- {
- removeChannel((Channel)element, false);
- }
+ // if (kind == IContainerDelta.Kind.REMOVED)
+ // {
+ // removeChannel((Channel)element);
+ // }
return new ConnectorChannelsEvent((IConnector)container, (IChannel)element, kind);
}
@@ -468,9 +467,18 @@ public abstract class Connector extends Lifecycle implements IConnector
});
}
- protected boolean removeChannel(final Channel channel, boolean actively)
+ /**
+ * @return <code>true</code> if the channel was removed, <code>false</code>
+ * otherwise.
+ */
+ protected boolean removeChannel(final Channel channel)
{
- return channelsLock.write(new Callable<Boolean>()
+ if (channel == null)
+ {
+ throw new IllegalArgumentException("channel == null");
+ }
+
+ boolean removed = channelsLock.write(new Callable<Boolean>()
{
public Boolean call() throws Exception
{
@@ -486,12 +494,33 @@ public abstract class Connector extends Lifecycle implements IConnector
channels.set(channelIndex, null);
return true;
}
- else
- {
- return false;
- }
+
+ return false;
}
});
+
+ if (removed)
+ {
+ channel.close();
+ }
+
+ return removed;
+ }
+
+ public void inverseRemoveChannel(short channelIndex)
+ {
+ try
+ {
+ Channel channel = getChannel(channelIndex);
+ if (channel != null)
+ {
+ removeChannel(channel);
+ }
+ }
+ catch (RuntimeException ex)
+ {
+ OM.LOG.warn(ex);
+ }
}
protected IProtocol createProtocol(String type)