Skip to content

Commit

Permalink
Issue eclipse-ee4j#2016 Fixed TrailersTest - missing lock
Browse files Browse the repository at this point in the history
- partial cleanup, but requires much more than this
- DefaultOutputSink
  - combination of "fixes by refactoring" mixed with the changes in the flow
    of the logic
  - sendTrailers now locks the deflater
- added some javadocs and much more logs

Signed-off-by: David Matějček <dmatej@seznam.cz>
  • Loading branch information
dmatej committed Nov 20, 2020
1 parent 57c951f commit a90d6e9
Show file tree
Hide file tree
Showing 12 changed files with 250 additions and 200 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,6 @@ public final class DefaultFilterChain extends ListFacadeFilterChain {

private final FiltersStateFactory filtersStateFactory = new FiltersStateFactory();

/**
* Logger
*/
private static final Logger LOGGER = Grizzly.logger(DefaultFilterChain.class);

public DefaultFilterChain() {
Expand Down Expand Up @@ -101,7 +98,7 @@ public ProcessorResult process(final Context context) {

/**
* Execute this FilterChain.
*
*
* @param ctx {@link FilterChainContext} processing context
*/
@Override
Expand Down Expand Up @@ -242,13 +239,15 @@ protected NextAction executeFilter(final FilterExecutor executor, final Filter c
NextAction nextNextAction;
do {
if (LOGGER.isLoggable(Level.FINEST)) {
LOGGER.log(Level.FINE, "Execute filter. filter={0} context={1}", new Object[] { currentFilter, ctx });
LOGGER.log(Level.FINE, "before filter execution. filter={0} context={1}",
new Object[]{currentFilter, ctx});
}
// execute the task
nextNextAction = executor.execute(currentFilter, ctx);

if (LOGGER.isLoggable(Level.FINEST)) {
LOGGER.log(Level.FINE, "after execute filter. filter={0} context={1} nextAction={2}", new Object[] { currentFilter, ctx, nextNextAction });
LOGGER.log(Level.FINE, "after execute filter. filter={0} context={1} nextAction={2}",
new Object[] { currentFilter, ctx, nextNextAction });
}
} while (nextNextAction.type() == RerunFilterAction.TYPE);

Expand Down Expand Up @@ -402,7 +401,7 @@ public void fail(FilterChainContext context, Throwable failure) {

/**
* Notify the filters about error.
*
*
* @param ctx {@link FilterChainContext}
* @return position of the last executed {@link Filter}
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -794,9 +794,7 @@ private static Certificate[] getPeerCertificates(final SSLConnectionContext sslC
try {
return sslCtx.getSslEngine().getSession().getPeerCertificates();
} catch (Throwable t) {
if (LOGGER.isLoggable(Level.FINE)) {
LOGGER.log(Level.FINE, "Error getting client certs", t);
}
LOGGER.log(Level.FINE, "Error getting client certs", t);
return null;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ public static HttpContent create(final HttpHeader httpHeader, final boolean isLa

public static HttpContent create(final HttpHeader httpHeader, final boolean isLast, Buffer content) {
content = content != null ? content : Buffers.EMPTY_BUFFER;

final HttpContent httpContent = ThreadCache.takeFromCache(CACHE_IDX);
if (httpContent != null) {
httpContent.httpHeader = httpHeader;
Expand Down Expand Up @@ -137,10 +136,8 @@ public final HttpHeader getHttpHeader() {
}

/**
* Return <tt>true</tt>, if the current content chunk is last, or <tt>false</tt>, if there are content chunks to follow.
*
* @return <tt>true</tt>, if the current content chunk is last, or <tt>false</tt>, if there are content chunks to
* follow.
* @return <tt>true</tt>, if the current content chunk is last,
* or <tt>false</tt>, if there are content chunks to follow.
*/
public boolean isLast() {
return isLast;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class HttpTrailer extends HttpContent implements MimeHeadersPacket {
* @return <tt>true</tt> if passed {@link HttpContent} is a <tt>HttpTrailder</tt>.
*/
public static boolean isTrailer(HttpContent httpContent) {
return HttpTrailer.class.isAssignableFrom(httpContent.getClass());
return httpContent != null && HttpTrailer.class.isAssignableFrom(httpContent.getClass());
}

public static HttpTrailer create() {
Expand Down
Loading

0 comments on commit a90d6e9

Please sign in to comment.