Skip to content

Commit

Permalink
Step 2 for #980, drop provider modules
Browse files Browse the repository at this point in the history
  • Loading branch information
slandelle committed Sep 25, 2015
1 parent a811689 commit 58e50b4
Show file tree
Hide file tree
Showing 250 changed files with 103 additions and 8,263 deletions.
41 changes: 22 additions & 19 deletions client/pom.xml
@@ -1,4 +1,5 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent> <parent>
<groupId>org.asynchttpclient</groupId> <groupId>org.asynchttpclient</groupId>
<artifactId>async-http-client-project</artifactId> <artifactId>async-http-client-project</artifactId>
Expand All @@ -21,32 +22,34 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>process-classes</phase>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
<configuration>
<tasks>
<delete>
<fileset dir="${project.build.outputDirectory}/org/asynchttpclient/netty" includes="NettyAsyncHttpProvider.*" />
</delete>
</tasks>
</configuration>
</plugin>
</plugins> </plugins>
</build> </build>


<dependencies> <dependencies>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-codec-http</artifactId>
<version>4.0.31.Final</version>
</dependency>
<dependency> <dependency>
<groupId>org.reactivestreams</groupId> <groupId>org.reactivestreams</groupId>
<artifactId>reactive-streams</artifactId> <artifactId>reactive-streams</artifactId>
<version>1.0.0</version> <version>1.0.0</version>
</dependency> </dependency>
<dependency>
<groupId>com.typesafe.netty</groupId>
<artifactId>netty-reactive-streams</artifactId>
<version>1.0.0-M2</version>
</dependency>
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.20.0-GA</version>
</dependency>
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jzlib</artifactId>
<version>1.1.3</version>
</dependency>
</dependencies> </dependencies>
</project> </project>
@@ -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);
} }
} }
Expand Up @@ -47,6 +47,7 @@
import org.asynchttpclient.AsyncHandler; import org.asynchttpclient.AsyncHandler;
import org.asynchttpclient.AsyncHttpClientConfig; import org.asynchttpclient.AsyncHttpClientConfig;
import org.asynchttpclient.channel.SSLEngineFactory; import org.asynchttpclient.channel.SSLEngineFactory;
import org.asynchttpclient.channel.SSLEngineFactory.DefaultSSLEngineFactory;
import org.asynchttpclient.channel.pool.ConnectionPoolPartitioning; import org.asynchttpclient.channel.pool.ConnectionPoolPartitioning;
import org.asynchttpclient.handler.AsyncHandlerExtensions; import org.asynchttpclient.handler.AsyncHandlerExtensions;
import org.asynchttpclient.netty.Callback; import org.asynchttpclient.netty.Callback;
Expand Down
Expand Up @@ -14,7 +14,6 @@
package org.asynchttpclient.netty.handler; package org.asynchttpclient.netty.handler;


import static org.asynchttpclient.util.AsyncHttpProviderUtils.CHANNEL_CLOSED_EXCEPTION; import static org.asynchttpclient.util.AsyncHttpProviderUtils.CHANNEL_CLOSED_EXCEPTION;

import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import io.netty.channel.Channel; import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler.Sharable; import io.netty.channel.ChannelHandler.Sharable;
Expand All @@ -28,6 +27,7 @@
import java.nio.channels.ClosedChannelException; import java.nio.channels.ClosedChannelException;


import io.netty.util.ReferenceCountUtil; import io.netty.util.ReferenceCountUtil;

import org.asynchttpclient.AsyncHttpClientConfig; import org.asynchttpclient.AsyncHttpClientConfig;
import org.asynchttpclient.netty.*; import org.asynchttpclient.netty.*;
import org.asynchttpclient.netty.channel.ChannelManager; import org.asynchttpclient.netty.channel.ChannelManager;
Expand Down
Expand Up @@ -13,8 +13,10 @@
package org.asynchttpclient.netty.handler; package org.asynchttpclient.netty.handler;


import com.typesafe.netty.HandlerPublisher; import com.typesafe.netty.HandlerPublisher;

import io.netty.channel.Channel; import io.netty.channel.Channel;
import io.netty.util.concurrent.EventExecutor; import io.netty.util.concurrent.EventExecutor;

import org.asynchttpclient.HttpResponseBodyPart; import org.asynchttpclient.HttpResponseBodyPart;
import org.asynchttpclient.netty.NettyResponseFuture; import org.asynchttpclient.netty.NettyResponseFuture;
import org.asynchttpclient.netty.channel.ChannelManager; import org.asynchttpclient.netty.channel.ChannelManager;
Expand Down
Expand Up @@ -18,7 +18,6 @@
import org.asynchttpclient.AsyncHttpClient; import org.asynchttpclient.AsyncHttpClient;
import org.asynchttpclient.AsyncHttpClientConfig; import org.asynchttpclient.AsyncHttpClientConfig;
import org.asynchttpclient.DefaultAsyncHttpClient; import org.asynchttpclient.DefaultAsyncHttpClient;
import org.asynchttpclient.netty.NettyAsyncHttpProvider;


public class NettyProviderUtil { public class NettyProviderUtil {


Expand Down
2 changes: 1 addition & 1 deletion extras/jdeferred/pom.xml
Expand Up @@ -27,7 +27,7 @@
<dependency> <dependency>
<groupId>org.jdeferred</groupId> <groupId>org.jdeferred</groupId>
<artifactId>jdeferred-core</artifactId> <artifactId>jdeferred-core</artifactId>
<version>1.2.0</version> <version>1.2.4</version>
</dependency> </dependency>
</dependencies> </dependencies>
</project> </project>
16 changes: 0 additions & 16 deletions extras/registry/pom.xml
Expand Up @@ -10,20 +10,4 @@
<description> <description>
The Async Http Client Registry Extras. The Async Http Client Registry Extras.
</description> </description>

<!-- broken, packages and classes are the same -->
<dependencies>
<dependency>
<groupId>org.asynchttpclient</groupId>
<artifactId>async-http-client-netty3</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.asynchttpclient</groupId>
<artifactId>async-http-client-netty4</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</project> </project>
12 changes: 0 additions & 12 deletions extras/rxjava/pom.xml
Expand Up @@ -14,17 +14,5 @@
<artifactId>rxjava</artifactId> <artifactId>rxjava</artifactId>
<version>1.0.14</version> <version>1.0.14</version>
</dependency> </dependency>
<dependency>
<groupId>org.asynchttpclient</groupId>
<artifactId>async-http-client-netty3</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.asynchttpclient</groupId>
<artifactId>async-http-client-netty4</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependencies> </dependencies>
</project> </project>
Expand Up @@ -26,9 +26,6 @@
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertNotNull;


/**
*
*/
public class AsyncHttpObservableTest { public class AsyncHttpObservableTest {


@Test(groups = "fast") @Test(groups = "fast")
Expand Down Expand Up @@ -170,5 +167,4 @@ public BoundRequestBuilder call() {
Thread.currentThread().interrupt(); Thread.currentThread().interrupt();
} }
} }

} }
1 change: 0 additions & 1 deletion pom.xml
Expand Up @@ -322,7 +322,6 @@
</repositories> </repositories>
<modules> <modules>
<module>client</module> <module>client</module>
<module>providers</module>
<module>extras</module> <module>extras</module>
</modules> </modules>
<dependencies> <dependencies>
Expand Down
21 changes: 0 additions & 21 deletions providers/netty3/pom.xml

This file was deleted.

This file was deleted.

0 comments on commit 58e50b4

Please sign in to comment.