Merge remote-tracking branch 'origin/jetty-10.0.x' into jetty-11.0.x

Signed-off-by: Ludovic Orban <lorban@bitronix.be>
This commit is contained in:
Ludovic Orban 2021-09-06 15:51:53 +02:00
commit 5a209b9049
3 changed files with 33 additions and 19 deletions

View File

@ -1286,6 +1286,10 @@ public class HttpChannelState
return woken;
}
/**
* Called to indicate that some content was produced and is
* ready for consumption.
*/
public void onContentAdded()
{
try (AutoLock l = lock())
@ -1307,6 +1311,9 @@ public class HttpChannelState
}
}
/**
* Called to indicate that the content is being consumed.
*/
public void onReadIdle()
{
try (AutoLock l = lock())
@ -1329,9 +1336,9 @@ public class HttpChannelState
}
/**
* 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()
{

View File

@ -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
@ -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
@ -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]
@ -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

View File

@ -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