Prepare Undertow 1.3.0 compatibility
Xnio 3.4.0 will introduce a new source of ByteBuffers: ByteBufferPool.
Previously this feature was offered by Pooled/Pool/ByteBufferSlicePool;
those classes are now marked as deprecated.
As of 1.3.0.Beta9, Undertow still implements the following method in its
ClientConnection interface, using those deprecated types:
Pool<ByteBuffer> getBufferPool();
This commit prepares compatibility by suppressing warnings in order to
avoid build failures in our build. Once appropriate changes are made in
Undertow, a specific implementation with new types could be introduced.
Issue: SPR-13366
This commit is contained in:
@@ -35,14 +35,11 @@ import io.undertow.util.HeaderMap;
|
||||
import io.undertow.util.HttpString;
|
||||
import io.undertow.util.Methods;
|
||||
import io.undertow.util.StringReadChannelListener;
|
||||
import org.xnio.ByteBufferSlicePool;
|
||||
import org.xnio.ChannelListener;
|
||||
import org.xnio.ChannelListeners;
|
||||
import org.xnio.IoUtils;
|
||||
import org.xnio.OptionMap;
|
||||
import org.xnio.Options;
|
||||
import org.xnio.Pool;
|
||||
import org.xnio.Pooled;
|
||||
import org.xnio.Xnio;
|
||||
import org.xnio.XnioWorker;
|
||||
import org.xnio.channels.StreamSinkChannel;
|
||||
@@ -96,19 +93,21 @@ public class UndertowXhrTransport extends AbstractXhrTransport implements XhrTra
|
||||
|
||||
private final XnioWorker worker;
|
||||
|
||||
private final Pool<ByteBuffer> bufferPool;
|
||||
@SuppressWarnings("deprecation")
|
||||
private final org.xnio.Pool<ByteBuffer> bufferPool;
|
||||
|
||||
|
||||
public UndertowXhrTransport() throws IOException {
|
||||
this(OptionMap.builder().parse(Options.WORKER_NAME, "SockJSClient").getMap());
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public UndertowXhrTransport(OptionMap optionMap) throws IOException {
|
||||
Assert.notNull(optionMap, "OptionMap is required");
|
||||
this.optionMap = optionMap;
|
||||
this.httpClient = UndertowClient.getInstance();
|
||||
this.worker = Xnio.getInstance().createWorker(optionMap);
|
||||
this.bufferPool = new ByteBufferSlicePool(1048, 1048);
|
||||
this.bufferPool = new org.xnio.ByteBufferSlicePool(1048, 1048);
|
||||
}
|
||||
|
||||
|
||||
@@ -306,6 +305,7 @@ public class UndertowXhrTransport extends AbstractXhrTransport implements XhrTra
|
||||
public void completed(ClientExchange result) {
|
||||
result.setResponseListener(new ClientCallback<ClientExchange>() {
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public void completed(final ClientExchange result) {
|
||||
responses.add(result.getResponse());
|
||||
new StringReadChannelListener(result.getConnection().getBufferPool()) {
|
||||
@@ -389,6 +389,7 @@ public class UndertowXhrTransport extends AbstractXhrTransport implements XhrTra
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public void handleEvent(StreamSourceChannel channel) {
|
||||
if (this.session.isDisconnected()) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
@@ -398,7 +399,7 @@ public class UndertowXhrTransport extends AbstractXhrTransport implements XhrTra
|
||||
throw new SockJsException("Session closed.", this.session.getId(), null);
|
||||
}
|
||||
|
||||
Pooled<ByteBuffer> pooled = this.connection.getBufferPool().allocate();
|
||||
org.xnio.Pooled<ByteBuffer> pooled = this.connection.getBufferPool().allocate();
|
||||
try {
|
||||
int r;
|
||||
do {
|
||||
|
||||
@@ -38,7 +38,6 @@ import org.springframework.util.SocketUtils;
|
||||
import org.springframework.web.context.WebApplicationContext;
|
||||
import org.springframework.web.servlet.DispatcherServlet;
|
||||
|
||||
import org.xnio.ByteBufferSlicePool;
|
||||
import org.xnio.OptionMap;
|
||||
import org.xnio.Xnio;
|
||||
|
||||
@@ -70,6 +69,7 @@ public class UndertowTestServer implements WebSocketTestServer {
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public void deployConfig(WebApplicationContext wac, Filter... filters) {
|
||||
Assert.state(this.port != -1, "setup() was never called");
|
||||
DispatcherServletInstanceFactory servletFactory = new DispatcherServletInstanceFactory(wac);
|
||||
@@ -78,7 +78,7 @@ public class UndertowTestServer implements WebSocketTestServer {
|
||||
WebSocketDeploymentInfo info = new WebSocketDeploymentInfo();
|
||||
try {
|
||||
info.setWorker(Xnio.getInstance().createWorker(OptionMap.EMPTY));
|
||||
info.setBuffers(new ByteBufferSlicePool(1024,1024));
|
||||
info.setBuffers(new org.xnio.ByteBufferSlicePool(1024,1024));
|
||||
}
|
||||
catch (IOException ex) {
|
||||
throw new IllegalStateException(ex);
|
||||
|
||||
Reference in New Issue
Block a user