Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -357,31 +357,42 @@ public void failed(IOException e) {
});

if (httpMarshaller != null) {
//marshalling is blocking, we need to delegate, otherwise we may need to buffer arbitrarily large requests
connection.getConnection().getWorker().execute(() -> {
try (OutputStream outputStream = new WildflyClientOutputStream(result.getRequestChannel(), result.getConnection().getBufferPool())) {

// marshall the locator and method params
// start the marshaller
boolean compress = false;
String encoding = getRequestHeader(request, CONTENT_ENCODING);
if (encoding != null) {
String lowerEncoding = encoding.toLowerCase(Locale.ENGLISH);
if (GZIP.toString().equals(lowerEncoding)) {
compress = true;
var runnable = new Runnable() {
@Override
public void run() {
try (OutputStream outputStream = new WildflyClientOutputStream(result.getRequestChannel(), result.getConnection().getBufferPool())) {

// marshall the locator and method params
// start the marshaller
boolean compress = false;
String encoding = getRequestHeader(request, CONTENT_ENCODING);
if (encoding != null) {
String lowerEncoding = encoding.toLowerCase(Locale.ENGLISH);
if (GZIP.toString().equals(lowerEncoding)) {
compress = true;
}
}
}

httpMarshaller.marshall(compress ? new GZIPOutputStream(outputStream) : outputStream);
httpMarshaller.marshall(compress ? new GZIPOutputStream(outputStream) : outputStream);

} catch (Exception e) {
try {
failureHandler.handleFailure(e);
} finally {
connection.done(true);
} catch (Exception e) {
try {
failureHandler.handleFailure(e);
} finally {
connection.done(true);
}
}
}
});
};

if (connection.getConnection().getIoThread() == Thread.currentThread()) {
System.err.println("On IO thread");
runnable.run();
} else {
System.err.println("Not on IO thread");
//marshalling is blocking, we need to delegate, otherwise we may need to buffer arbitrarily large requests
connection.getConnection().getWorker().execute(runnable::run);
}
}
}

Expand Down
Loading