summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-10-10 03:14:38 (EDT)
committerEike Stepper2007-10-10 03:14:38 (EDT)
commit36f12139e30265c4aaebc91cf691ae3debb368b2 (patch)
treec29327b7e2c92f784226de3c318c4e645e097331
parent8150f3813f51d94dcddfb4df901f6116f460308f (diff)
downloadcdo-36f12139e30265c4aaebc91cf691ae3debb368b2.zip
cdo-36f12139e30265c4aaebc91cf691ae3debb368b2.tar.gz
cdo-36f12139e30265c4aaebc91cf691ae3debb368b2.tar.bz2
[205877] NoConnectionPendingException in ConnectorTest
https://bugs.eclipse.org/bugs/show_bug.cgi?id=205877
-rw-r--r--plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPSelector.java21
-rw-r--r--plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/tcp/ITCPSelector.java10
2 files changed, 13 insertions, 18 deletions
diff --git a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPSelector.java b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPSelector.java
index 0837784..4c042ee 100644
--- a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPSelector.java
+++ b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPSelector.java
@@ -59,7 +59,7 @@ public class TCPSelector extends Lifecycle implements ITCPSelector, Runnable
{
public void run()
{
- registerAcceptor(channel, listener);
+ executeRegistration(channel, listener);
}
@Override
@@ -77,7 +77,7 @@ public class TCPSelector extends Lifecycle implements ITCPSelector, Runnable
{
public void run()
{
- registerConnector(channel, listener, client);
+ executeRegistration(channel, listener, client);
}
@Override
@@ -146,8 +146,8 @@ public class TCPSelector extends Lifecycle implements ITCPSelector, Runnable
{
try
{
- execute(true);
- execute(false);
+ processOperations(true);
+ processOperations(false);
if (selector != null && selector.select() > 0)
{
Iterator<SelectionKey> it = selector.selectedKeys().iterator();
@@ -345,7 +345,7 @@ public class TCPSelector extends Lifecycle implements ITCPSelector, Runnable
}
}
- private void execute(boolean client)
+ private void processOperations(boolean client)
{
Runnable operation;
Queue<Runnable> operations = client ? clientOperations : serverOperations;
@@ -360,7 +360,7 @@ public class TCPSelector extends Lifecycle implements ITCPSelector, Runnable
}
}
- private void registerAcceptor(final ServerSocketChannel channel, final ITCPSelectorListener.Passive listener)
+ private void executeRegistration(final ServerSocketChannel channel, final ITCPSelectorListener.Passive listener)
{
if (TRACER.isEnabled())
{
@@ -378,7 +378,8 @@ public class TCPSelector extends Lifecycle implements ITCPSelector, Runnable
}
}
- private void registerConnector(final SocketChannel channel, final ITCPSelectorListener.Active listener, boolean client)
+ private void executeRegistration(final SocketChannel channel, final ITCPSelectorListener.Active listener,
+ boolean client)
{
if (TRACER.isEnabled())
{
@@ -387,12 +388,6 @@ public class TCPSelector extends Lifecycle implements ITCPSelector, Runnable
try
{
- // int interest = SelectionKey.OP_READ;
- // if (connect)
- // {
- // interest |= SelectionKey.OP_CONNECT;
- // }
-
int interest = client ? SelectionKey.OP_CONNECT : SelectionKey.OP_READ;
SelectionKey selectionKey = channel.register(selector, interest, listener);
listener.handleRegistration(selectionKey);
diff --git a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/tcp/ITCPSelector.java b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/tcp/ITCPSelector.java
index 7aa0a3e..a9b9cc7 100644
--- a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/tcp/ITCPSelector.java
+++ b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/tcp/ITCPSelector.java
@@ -22,13 +22,13 @@ import java.nio.channels.SocketChannel;
*/
public interface ITCPSelector
{
- public void register(ServerSocketChannel channel, Passive listener);
+ public void orderRegistration(ServerSocketChannel channel, Passive listener);
- public void register(SocketChannel channel, boolean client, Active listener);
+ public void orderRegistration(SocketChannel channel, boolean client, Active listener);
- public void setConnectInterest(SelectionKey selectionKey, boolean client, boolean on);
+ public void orderConnectInterest(SelectionKey selectionKey, boolean client, boolean on);
- public void setReadInterest(SelectionKey selectionKey, boolean client, boolean on);
+ public void orderReadInterest(SelectionKey selectionKey, boolean client, boolean on);
- public void setWriteInterest(SelectionKey selectionKey, boolean client, boolean on);
+ public void orderWriteInterest(SelectionKey selectionKey, boolean client, boolean on);
}