better align client and server impls
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
This commit is contained in:
parent
2fcaad0cd8
commit
c8d7bf01e1
|
@ -61,7 +61,7 @@ public class ClientDatagramEndPoint extends AbstractEndPoint implements ManagedS
|
||||||
@Override
|
@Override
|
||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
return String.format("%s:%s:%s", this, _operation, getInvocationType());
|
return String.format("%s:%s:%s", ClientDatagramEndPoint.this, _operation, getInvocationType());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,11 +77,11 @@ public class ClientDatagramEndPoint extends AbstractEndPoint implements ManagedS
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
this.close();
|
ClientDatagramEndPoint.this.close();
|
||||||
}
|
}
|
||||||
catch (Throwable x)
|
catch (Throwable x)
|
||||||
{
|
{
|
||||||
LOG.warn("Unable to close {}", this, x);
|
LOG.warn("Unable to close {}", ClientDatagramEndPoint.this, x);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,7 @@ public class ClientDatagramEndPoint extends AbstractEndPoint implements ManagedS
|
||||||
private final Runnable _runFillable = new RunnableCloseable("runFillable")
|
private final Runnable _runFillable = new RunnableCloseable("runFillable")
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public Invocable.InvocationType getInvocationType()
|
public InvocationType getInvocationType()
|
||||||
{
|
{
|
||||||
return getFillInterest().getCallbackInvocationType();
|
return getFillInterest().getCallbackInvocationType();
|
||||||
}
|
}
|
||||||
|
@ -106,7 +106,7 @@ public class ClientDatagramEndPoint extends AbstractEndPoint implements ManagedS
|
||||||
private final Runnable _runCompleteWrite = new RunnableCloseable("runCompleteWrite")
|
private final Runnable _runCompleteWrite = new RunnableCloseable("runCompleteWrite")
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public Invocable.InvocationType getInvocationType()
|
public InvocationType getInvocationType()
|
||||||
{
|
{
|
||||||
return getWriteFlusher().getCallbackInvocationType();
|
return getWriteFlusher().getCallbackInvocationType();
|
||||||
}
|
}
|
||||||
|
@ -120,27 +120,27 @@ public class ClientDatagramEndPoint extends AbstractEndPoint implements ManagedS
|
||||||
@Override
|
@Override
|
||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
return String.format("%s:%s:%s->%s", this, _operation, getInvocationType(), getWriteFlusher());
|
return String.format("%s:%s:%s->%s", ClientDatagramEndPoint.this, _operation, getInvocationType(), getWriteFlusher());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private final Runnable _runCompleteWriteFillable = new RunnableCloseable("runCompleteWriteFillable")
|
private final Runnable _runCompleteWriteFillable = new RunnableCloseable("runCompleteWriteFillable")
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public Invocable.InvocationType getInvocationType()
|
public InvocationType getInvocationType()
|
||||||
{
|
{
|
||||||
Invocable.InvocationType fillT = getFillInterest().getCallbackInvocationType();
|
InvocationType fillT = getFillInterest().getCallbackInvocationType();
|
||||||
Invocable.InvocationType flushT = getWriteFlusher().getCallbackInvocationType();
|
InvocationType flushT = getWriteFlusher().getCallbackInvocationType();
|
||||||
if (fillT == flushT)
|
if (fillT == flushT)
|
||||||
return fillT;
|
return fillT;
|
||||||
|
|
||||||
if (fillT == Invocable.InvocationType.EITHER && flushT == Invocable.InvocationType.NON_BLOCKING)
|
if (fillT == InvocationType.EITHER && flushT == InvocationType.NON_BLOCKING)
|
||||||
return Invocable.InvocationType.EITHER;
|
return InvocationType.EITHER;
|
||||||
|
|
||||||
if (fillT == Invocable.InvocationType.NON_BLOCKING && flushT == Invocable.InvocationType.EITHER)
|
if (fillT == InvocationType.NON_BLOCKING && flushT == InvocationType.EITHER)
|
||||||
return Invocable.InvocationType.EITHER;
|
return InvocationType.EITHER;
|
||||||
|
|
||||||
return Invocable.InvocationType.BLOCKING;
|
return InvocationType.BLOCKING;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -65,7 +65,7 @@ public class ServerDatagramEndPoint extends AbstractEndPoint implements ManagedS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private abstract class RunnableCloseable extends ServerDatagramEndPoint.RunnableTask implements Closeable
|
private abstract class RunnableCloseable extends RunnableTask implements Closeable
|
||||||
{
|
{
|
||||||
protected RunnableCloseable(String op)
|
protected RunnableCloseable(String op)
|
||||||
{
|
{
|
||||||
|
@ -88,7 +88,7 @@ public class ServerDatagramEndPoint extends AbstractEndPoint implements ManagedS
|
||||||
|
|
||||||
private final ManagedSelector.SelectorUpdate _updateKeyAction = this::updateKeyAction;
|
private final ManagedSelector.SelectorUpdate _updateKeyAction = this::updateKeyAction;
|
||||||
|
|
||||||
private final Runnable _runFillable = new ServerDatagramEndPoint.RunnableCloseable("runFillable")
|
private final Runnable _runFillable = new RunnableCloseable("runFillable")
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public InvocationType getInvocationType()
|
public InvocationType getInvocationType()
|
||||||
|
@ -103,7 +103,7 @@ public class ServerDatagramEndPoint extends AbstractEndPoint implements ManagedS
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private final Runnable _runCompleteWrite = new ServerDatagramEndPoint.RunnableCloseable("runCompleteWrite")
|
private final Runnable _runCompleteWrite = new RunnableCloseable("runCompleteWrite")
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public InvocationType getInvocationType()
|
public InvocationType getInvocationType()
|
||||||
|
@ -124,7 +124,7 @@ public class ServerDatagramEndPoint extends AbstractEndPoint implements ManagedS
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private final Runnable _runCompleteWriteFillable = new ServerDatagramEndPoint.RunnableCloseable("runCompleteWriteFillable")
|
private final Runnable _runCompleteWriteFillable = new RunnableCloseable("runCompleteWriteFillable")
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public InvocationType getInvocationType()
|
public InvocationType getInvocationType()
|
||||||
|
|
Loading…
Reference in New Issue