Skip to content

Commit

Permalink
Merge pull request #358 from morrowgi/UpdateMicroServerIssue357
Browse files Browse the repository at this point in the history
Updating micro-server for #357
  • Loading branch information
morrowgi authored Jul 6, 2017
2 parents 3d74793 + 7645457 commit eefe296
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 16 deletions.
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
version=0.91.3
version=0.91.4
springVersion=4.3.3.RELEASE
springBootVersion=1.4.1.RELEASE
jerseyVersion=2.24
grizzlyVersion=2.3.28
cyclopsReactVersion=2.0.0-RC8
cyclopsVersion=9.0.0-MI4
cyclopsReactVersion=2.0.0-FINAL
cyclopsVersion=9.0.0-MI6
hamcrestVersion=1.3
hibernateVersion=5.1.0.Final
hibernateValidator=5.2.4.Final
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public Future<T> loadAndGet() {
comparator.toString())
.build());

return Future.ofSupplier(() -> Tuple.tuple(comparator.load(), comparator.getData()), executorService)
return Future.of(() -> Tuple.tuple(comparator.load(), comparator.getData()), executorService)
.peek(t -> bus.post(SystemData.<String, String> builder()
.correlationId(correlationId)
.dataMap(dataMap.get())
Expand All @@ -66,7 +66,7 @@ public Future<Void> saveAndIncrement(T data) {
Supplier<MapX<String, String>> dataMap = () -> MapX.fromMap(HashMapBuilder.map(MANIFEST_COMPARATOR_DATA_WRITER_KEY,
comparator.toString())
.build());
return Future.<Void> ofSupplier(() -> {
return Future.<Void> of(() -> {
comparator.saveAndIncrement(data);
return null;
} , executorService)
Expand All @@ -88,6 +88,6 @@ public Future<Void> saveAndIncrement(T data) {

@Override
public Future<Boolean> isOutOfDate() {
return Future.ofSupplier(() -> comparator.isOutOfDate(), executorService);
return Future.of(() -> comparator.isOutOfDate(), executorService);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ private void sleep() {
@GET
@Path("myEndPoint")
public Future<String> myEndPoint() {
return Future.ofSupplier(() -> {
return Future.of(() -> {
sleep();
return "hello world!";
}, Executors.newFixedThreadPool(1));
Expand Down
4 changes: 2 additions & 2 deletions micro-jersey/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ E.g. Using Future from [cyclops-react](cyclops-react.io)
```java
@GET
public Future<String> myEndPoint(){
return Future.ofSupplier(()->{
return Future.of(()->{
sleep();
return "hello world!";
}, Executors.newFixedThreadPool(1));
Expand All @@ -45,7 +45,7 @@ Would be equivalent to the following code
```java
@GET
public void myEndPoint(@Suspended AsyncResponse asyncResponse){
Future.ofSupplier(()->{
Future.of(()->{
sleep();
asyncResponse.resume("hello world!");
return 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ private Try<File, Throwable> writeToTmpFile(Object value) {
File file = new File(
dir, fileName);

return Try.of(1, Throwable.class)
return Try.success(1, Throwable.class)
.map(FluentFunctions.ofChecked(i -> {
FileOutputStream fs = new FileOutputStream(
file);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public Try<PutObjectResult, Throwable> put(String key, String value) {
* @return
*/
public Future<PutObjectResult> putAsync(String key, String value) {
return Future.ofSupplier(() -> put(key, value), this.uploadService)
return Future.of(() -> put(key, value), this.uploadService)
.map(Try::get);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ private static Histogram getHistogram(String meterName) {
private static Optional<byte[]> createNullableFile() {
final File file = new File(
System.getProperty("test.file.full.path"));
Try<byte[], Throwable> loadFileOperation = Try.of(1, Throwable.class)
Try<byte[], Throwable> loadFileOperation = Try.success(1, Throwable.class)
.map(FluentFunctions.ofChecked(i -> {
return FileUtils.readFileToByteArray(file);
}));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ public void setup() {
private void setupExpectedData(Date lastModTime, String key, String data, long version) {
expectedData = new Data<>(data, lastModTime, versionKey);
versionKey = new VersionedKey(key, version).toJson();
when(reader.getAsString(key)).thenReturn(Try.of(versionKey));
when(reader.getAsObject(versionKey)).thenReturn(Try.of(expectedData));
when(reader.getAsString(key)).thenReturn(Try.success(versionKey));
when(reader.getAsObject(versionKey)).thenReturn(Try.success(expectedData));
when(reader.getLastModified(versionKey)).thenReturn(lastModTime);
}

Expand Down
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ E.g. Using Future from [cyclops-react](cyclops-react.io)
```java
@GET
public Future<String> myEndPoint(){
return Future.ofSupplier(()->{
return Future.of(()->{
sleep();
return "hello world!";
}, Executors.newFixedThreadPool(1));
Expand All @@ -67,7 +67,7 @@ Would be equivalent to the following code
```java
@GET
public void myEndPoint(@Suspended AsyncResponse asyncResponse){
Future.ofSupplier(()->{
Future.of(()->{
sleep();
asyncResponse.resume("hello world!");
return 1;
Expand Down

0 comments on commit eefe296

Please sign in to comment.