Skip to content

Commit

Permalink
Full API redraw
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume Chauvet committed Jul 17, 2016
1 parent 481bde8 commit 7dbefe8
Show file tree
Hide file tree
Showing 20 changed files with 1,366 additions and 836 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ vertx-async snapshots are available on OSSRH repository:
```java
@Override
public void start(final Future<Void> startFuture) {
AsyncCollections.each(IntStream.iterate(0, i -> i + 1).limit(100).boxed().collect(Collectors.toList()), (item, handler) -> {
AsyncFactorySingleton.getInstance().createCollections(context)
.each(IntStream.iterate(0, i -> i + 1).limit(100).boxed().collect(Collectors.toList()), (item, handler) -> {
System.out.println("get " + item);
handler.handle(DefaultAsyncResult.succeed());
}, e -> {
Expand All @@ -45,7 +46,8 @@ vertx-async snapshots are available on OSSRH repository:
```java
@Override
public void start(final Future<Void> startFuture) {
AsyncCollections.each(IntStream.iterate(0, i -> i + 1).limit(100).boxed().collect(Collectors.toMap(p -> p.toString(), Function.identity())), (item, handler) -> {
AsyncFactorySingleton.getInstance().createCollections(context)
.each(IntStream.iterate(0, i -> i + 1).limit(100).boxed().collect(Collectors.toMap(p -> p.toString(), Function.identity())), (item, handler) -> {
System.out.println(item.getKey() + " -> " + item.getValue());
handler.handle(DefaultAsyncResult.succeed());
}, e -> {
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<groupId>io.zatarox</groupId>
<artifactId>vertx-async</artifactId>
<packaging>jar</packaging>
<version>0.27.0</version>
<version>1.0.0</version>
<name>[Vertx] Async</name>
<description>Async helpers for Vert.x</description>
<url>https://github.com/gchauvet/vertx-async</url>
Expand Down
56 changes: 56 additions & 0 deletions src/main/java/io/zatarox/vertx/async/AsyncFactorySingleton.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* Copyright 2016 Guillaume Chauvet.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.zatarox.vertx.async;

import io.zatarox.vertx.async.api.AsyncFactory;
import io.zatarox.vertx.async.api.AsyncUtils;
import io.vertx.core.Context;
import io.zatarox.vertx.async.api.AsyncCollections;
import io.zatarox.vertx.async.api.AsyncFlows;
import io.zatarox.vertx.async.impl.AsyncCollectionsImpl;
import io.zatarox.vertx.async.impl.AsyncFlowsImpl;
import io.zatarox.vertx.async.impl.AsyncUtilsImpl;

public final class AsyncFactorySingleton implements AsyncFactory {

private static AsyncFactorySingleton instance = null;

private AsyncFactorySingleton() {
}

@Override
public AsyncUtils createUtils(final Context context) {
return new AsyncUtilsImpl(context);
}

@Override
public AsyncCollections createCollections(final Context context) {
return new AsyncCollectionsImpl(context);
}

@Override
public AsyncFlows createFlows(final Context context) {
return new AsyncFlowsImpl(context);
}

public static AsyncFactorySingleton getInstance() {
if (instance == null) {
instance = new AsyncFactorySingleton();
}
return instance;
}

}
Loading

0 comments on commit 7dbefe8

Please sign in to comment.