Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Step 2 for #980, drop provider modules
- Loading branch information
Showing
250 changed files
with
103 additions
and
8,263 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
82 changes: 76 additions & 6 deletions
82
client/src/main/java/org/asynchttpclient/netty/NettyAsyncHttpProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,24 +1,94 @@ | |||
/* | |||
* Copyright (c) 2014 AsyncHttpClient Project. All rights reserved. | |||
* | |||
* This program is licensed to you under the Apache License Version 2.0, | |||
* and you may not use this file except in compliance with the Apache License Version 2.0. | |||
* You may obtain a copy of the Apache License Version 2.0 at | |||
* http://www.apache.org/licenses/LICENSE-2.0. | |||
* | |||
* Unless required by applicable law or agreed to in writing, | |||
* software distributed under the Apache License Version 2.0 is distributed on an | |||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
* See the Apache License Version 2.0 for the specific language governing permissions and limitations there under. | |||
*/ | |||
package org.asynchttpclient.netty; | package org.asynchttpclient.netty; | ||
|
|
||
import io.netty.util.HashedWheelTimer; | |||
import io.netty.util.Timer; | |||
|
|||
import java.util.concurrent.atomic.AtomicBoolean; | |||
|
|||
import org.asynchttpclient.AsyncHandler; | import org.asynchttpclient.AsyncHandler; | ||
import org.asynchttpclient.AsyncHttpClientConfig; | import org.asynchttpclient.AsyncHttpClientConfig; | ||
import org.asynchttpclient.AsyncHttpProvider; | import org.asynchttpclient.AsyncHttpProvider; | ||
import org.asynchttpclient.ListenableFuture; | import org.asynchttpclient.ListenableFuture; | ||
import org.asynchttpclient.Request; | import org.asynchttpclient.Request; | ||
import org.asynchttpclient.netty.channel.ChannelManager; | |||
import org.asynchttpclient.netty.channel.pool.ChannelPoolPartitionSelector; | |||
import org.asynchttpclient.netty.request.NettyRequestSender; | |||
import org.slf4j.Logger; | |||
import org.slf4j.LoggerFactory; | |||
|
|
||
public class NettyAsyncHttpProvider implements AsyncHttpProvider { | public class NettyAsyncHttpProvider implements AsyncHttpProvider { | ||
|
|
||
private static final Logger LOGGER = LoggerFactory.getLogger(NettyAsyncHttpProvider.class); | |||
|
|||
private final AtomicBoolean closed = new AtomicBoolean(false); | |||
private final ChannelManager channelManager; | |||
private final NettyRequestSender requestSender; | |||
private final boolean allowStopNettyTimer; | |||
private final Timer nettyTimer; | |||
|
|||
public NettyAsyncHttpProvider(AsyncHttpClientConfig config) { | public NettyAsyncHttpProvider(AsyncHttpClientConfig config) { | ||
throw new UnsupportedOperationException("This implementation is just a stub"); |
|
||
NettyAsyncHttpProviderConfig nettyConfig = config.getAsyncHttpProviderConfig() instanceof NettyAsyncHttpProviderConfig ? // | |||
(NettyAsyncHttpProviderConfig) config.getAsyncHttpProviderConfig() | |||
: new NettyAsyncHttpProviderConfig(); | |||
|
|||
allowStopNettyTimer = nettyConfig.getNettyTimer() == null; | |||
nettyTimer = allowStopNettyTimer ? newNettyTimer() : nettyConfig.getNettyTimer(); | |||
|
|||
channelManager = new ChannelManager(config, nettyConfig, nettyTimer); | |||
requestSender = new NettyRequestSender(config, channelManager, nettyTimer, closed); | |||
channelManager.configureBootstraps(requestSender); | |||
} | } | ||
|
|
||
@Override | private Timer newNettyTimer() { | ||
public <T> ListenableFuture<T> execute(Request request, AsyncHandler<T> handler) { | HashedWheelTimer timer = new HashedWheelTimer(); | ||
throw new UnsupportedOperationException("This implementation is just a stub"); | timer.start(); | ||
return timer; | |||
} | } | ||
|
|
||
@Override | @Override | ||
public void close() { | public void close() { | ||
throw new UnsupportedOperationException("This implementation is just a stub"); | if (closed.compareAndSet(false, true)) { | ||
try { | |||
channelManager.close(); | |||
|
|||
if (allowStopNettyTimer) | |||
nettyTimer.stop(); | |||
|
|||
} catch (Throwable t) { | |||
LOGGER.warn("Unexpected error on close", t); | |||
} | |||
} | |||
} | |||
|
|||
@Override | |||
public <T> ListenableFuture<T> execute(Request request, final AsyncHandler<T> asyncHandler) { | |||
try { | |||
return requestSender.sendRequest(request, asyncHandler, null, false); | |||
} catch (Exception e) { | |||
asyncHandler.onThrowable(e); | |||
return new ListenableFuture.CompletedFailure<>(e); | |||
} | |||
} | |||
|
|||
public void flushChannelPoolPartition(String partitionId) { | |||
channelManager.flushPartition(partitionId); | |||
} | |||
|
|||
public void flushChannelPoolPartitions(ChannelPoolPartitionSelector selector) { | |||
channelManager.flushPartitions(selector); | |||
} | } | ||
} | } |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
30 changes: 0 additions & 30 deletions
30
providers/netty3/src/main/java/org/asynchttpclient/netty/Callback.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.