Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/jetty-10.0.x' into jetty-11.0.x
Browse files Browse the repository at this point in the history
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
  • Loading branch information
lorban committed Sep 6, 2021
2 parents 91e2de1 + 2231e64 commit 5a209b9
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1286,6 +1286,10 @@ public boolean onReadEof()
return woken;
}

/**
* Called to indicate that some content was produced and is
* ready for consumption.
*/
public void onContentAdded()
{
try (AutoLock l = lock())
Expand All @@ -1307,6 +1311,9 @@ public void onContentAdded()
}
}

/**
* Called to indicate that the content is being consumed.
*/
public void onReadIdle()
{
try (AutoLock l = lock())
Expand All @@ -1329,9 +1336,9 @@ public void onReadIdle()
}

/**
* Called to indicate that more content may be available,
* but that a handling thread may need to produce (fill/parse)
* it. Typically called by the async read success callback.
* Called to indicate that no content is currently available,
* more content has been demanded and may be available, but
* that a handling thread may need to produce (fill/parse) it.
*/
public void onReadUnready()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,12 @@ activate Application
if content
is null
end note
HttpInput->AsyncContentProducer: reclaim
HttpInput->HttpInput: copy content\ninto byte[]
return
alt content is empty
HttpInput->AsyncContentProducer: reclaim
return
end
return
deactivate Application

Expand All @@ -52,12 +56,9 @@ activate Application
return transformed content
end
return
alt if transformed content is not null
AsyncContentProducer->HttpChannelState: onContentAdded
return
else transformed content is null
AsyncContentProducer->HttpChannelState: onReadUnready
return
loop
AsyncContentProducer->HttpChannel: needContent
return
alt if needContent returns true
Expand All @@ -66,7 +67,14 @@ activate Application
alt if transformed content is not null
AsyncContentProducer->HttpChannelState: onContentAdded
return
note over AsyncContentProducer
break loop
end note
end
else
note over AsyncContentProducer
break loop
end note
end
end
return boolean\n[transformed\ncontent is not null]
Expand All @@ -76,17 +84,12 @@ deactivate Application
alt if content arrives
AsyncContentDelivery->HttpInput: onContentProducible
HttpInput->AsyncContentProducer: onContentProducible
alt if not at EOF
AsyncContentProducer->HttpChannelState: onReadReady
return true if woken
else if at EOF
AsyncContentProducer->HttpChannelState: onReadEof
return true if woken
end
return true if woken
return true if woken
alt onContentProducible returns true
AsyncContentDelivery->HttpChannel: execute(HttpChannel)
AsyncContentDelivery->HttpChannel: handle()
return
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,20 @@ activate Application
end
end
' return from BlockingContentProducer: nextContent
HttpInput->BlockingContentProducer: reclaim
BlockingContentProducer->AsyncContentProducer: reclaim
return
HttpInput->HttpInput: copy content\ninto byte[]
return
alt content is empty
HttpInput->BlockingContentProducer: reclaim
BlockingContentProducer->AsyncContentProducer: reclaim
return
return
end
return
deactivate Application

alt if content arrives
AsyncContentDelivery->HttpInput: wakeup
HttpInput->BlockingContentProducer: wakeup
AsyncContentDelivery->HttpInput: onContentProducible
HttpInput->BlockingContentProducer: onContentProducible
BlockingContentProducer->Semaphore: release
return
return false
Expand Down

0 comments on commit 5a209b9

Please sign in to comment.