Skip to content

Commit

Permalink
found an issue where async task execution was always happening inline
Browse files Browse the repository at this point in the history
  • Loading branch information
jon-valliere committed Feb 22, 2024
1 parent 1a4fbda commit 05028e8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
Expand Up @@ -252,7 +252,7 @@ protected void receive_loop(NextFilter next, IoBuffer message) throws SSLExcepti
LOGGER.debug("{} receive_loop() - handshake needs task, scheduling", toString());
}

execute_task(next);
schedule_task(next);

break;
case NEED_WRAP:
Expand Down
Expand Up @@ -273,7 +273,7 @@ protected void receive_loop(NextFilter next, IoBuffer message) throws SSLExcepti
LOGGER.debug("{} receive_loop() - handshake needs task, scheduling", toString());
}

execute_task(next);
schedule_task(next);

break;
case NEED_WRAP:
Expand Down Expand Up @@ -774,8 +774,20 @@ protected void forward_writes(NextFilter next) {
*/
protected void schedule_task(NextFilter next) {
if (ENABLE_ASYNC_TASKS && (mExecutor != null)) {
mExecutor.execute(() -> SSLHandlerG1.this.execute_task(next));
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("{} schedule_task() - scheduling task", this);
}
mExecutor.execute(() -> {
try {
execute_task(next);
} finally {
forward_writes(next);
}
});
} else {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("{} schedule_task() - scheduling disabled, executing inline", this);
}
execute_task(next);
}
}
Expand All @@ -787,7 +799,7 @@ protected void schedule_task(NextFilter next) {
*
* @param next The next filer in the chain
*/
synchronized protected void execute_task(NextFilter next) {
protected void execute_task(NextFilter next) {
Runnable task;
while ((task = mEngine.getDelegatedTask()) != null) {
try {
Expand Down

0 comments on commit 05028e8

Please sign in to comment.