Fixing end user callback failure if runtime exception occurs, renaming enque to enqueue
This commit is contained in:
parent
2237053819
commit
0ef9b23724
|
@ -432,7 +432,7 @@ public abstract class AbstractWebSocketConnection extends AbstractConnection imp
|
||||||
|
|
||||||
synchronized (writeBytes)
|
synchronized (writeBytes)
|
||||||
{
|
{
|
||||||
writeBytes.enque(frame,WriteCallbackWrapper.wrap(callback));
|
writeBytes.enqueue(frame,WriteCallbackWrapper.wrap(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
flush();
|
flush();
|
||||||
|
|
|
@ -97,10 +97,10 @@ public class WriteBytesProvider implements Callback
|
||||||
this.closed = new AtomicBoolean(false);
|
this.closed = new AtomicBoolean(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void enque(Frame frame, Callback callback)
|
public void enqueue(Frame frame, Callback callback)
|
||||||
{
|
{
|
||||||
Objects.requireNonNull(frame);
|
Objects.requireNonNull(frame);
|
||||||
LOG.debug("enque({}, {})",frame,callback);
|
LOG.debug("enqueue({}, {})",frame,callback);
|
||||||
synchronized (this)
|
synchronized (this)
|
||||||
{
|
{
|
||||||
if (closed.get())
|
if (closed.get())
|
||||||
|
@ -283,9 +283,17 @@ public class WriteBytesProvider implements Callback
|
||||||
// All done with active FrameEntry
|
// All done with active FrameEntry
|
||||||
if (active.callback != null)
|
if (active.callback != null)
|
||||||
{
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// TODO: should probably have callback invoked in new thread as part of scheduler
|
||||||
// notify of success
|
// notify of success
|
||||||
active.callback.succeeded();
|
active.callback.succeeded();
|
||||||
}
|
}
|
||||||
|
catch (Throwable t)
|
||||||
|
{
|
||||||
|
LOG.warn("Callback failure",t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// null it out
|
// null it out
|
||||||
active = null;
|
active = null;
|
||||||
|
|
Loading…
Reference in New Issue