Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2020-03-29 07:09:59 +0000
committerEike Stepper2020-03-29 07:09:59 +0000
commit60308125e4705cddea6010f4a58165dfe4ed0491 (patch)
treeee2dc954c3a1ae8e26c802d2b87fd07ea0885430 /plugins/org.eclipse.net4j.tcp
parent404b9fe302af90d913641268f01482bd44e29a39 (diff)
downloadcdo-60308125e4705cddea6010f4a58165dfe4ed0491.tar.gz
cdo-60308125e4705cddea6010f4a58165dfe4ed0491.tar.xz
cdo-60308125e4705cddea6010f4a58165dfe4ed0491.zip
[561532] java.nio.BufferUnderFlowException (Take Four)
https://bugs.eclipse.org/bugs/show_bug.cgi?id=561532
Diffstat (limited to 'plugins/org.eclipse.net4j.tcp')
-rw-r--r--plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPConnector.java16
1 files changed, 11 insertions, 5 deletions
diff --git a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPConnector.java b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPConnector.java
index 8d44405277..473422710a 100644
--- a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPConnector.java
+++ b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPConnector.java
@@ -215,7 +215,7 @@ public abstract class TCPConnector extends Connector implements ITCPConnector, I
{
if (inputBuffer == null)
{
- inputBuffer = getConfig().getBufferProvider().provideBuffer();
+ inputBuffer = provideBuffer();
}
ByteBuffer byteBuffer = inputBuffer.startGetting(socketChannel);
@@ -416,7 +416,7 @@ public abstract class TCPConnector extends Connector implements ITCPConnector, I
@Override
protected void doDeactivate() throws Exception
{
- cancelSelectionKey();
+ cleanUp();
LifecycleUtil.deactivate(controlChannel);
controlChannel = null;
@@ -429,7 +429,7 @@ public abstract class TCPConnector extends Connector implements ITCPConnector, I
protected void deactivateAsync()
{
// Cancel the selection immediately
- cancelSelectionKey();
+ cleanUp();
// Do the rest of the deactivation asynchronously
getConfig().getReceiveExecutor().execute(new Runnable()
@@ -442,8 +442,14 @@ public abstract class TCPConnector extends Connector implements ITCPConnector, I
});
}
- private void cancelSelectionKey()
+ private void cleanUp()
{
+ if (inputBuffer != null)
+ {
+ inputBuffer.release();
+ inputBuffer = null;
+ }
+
if (selectionKey != null)
{
selectionKey.cancel();
@@ -479,7 +485,7 @@ public abstract class TCPConnector extends Connector implements ITCPConnector, I
@Override
public ByteBuffer getBuffer()
{
- buffer = getConfig().getBufferProvider().provideBuffer();
+ buffer = provideBuffer();
ByteBuffer byteBuffer = buffer.startPutting(ControlChannel.CONTROL_CHANNEL_INDEX);
byteBuffer.put(ControlChannel.OPCODE_NEGOTIATION);
return byteBuffer;

Back to the top