Skip to content

Commit

Permalink
Merge pull request #349 from aol/cyclops9MI2
Browse files Browse the repository at this point in the history
migration to cyclops 9 MI2
  • Loading branch information
johnmcclean authored Jun 3, 2017
2 parents 5ab8171 + b0f6804 commit 3979e76
Show file tree
Hide file tree
Showing 111 changed files with 385 additions and 353 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
version=0.91.1
springVersion=4.3.3.RELEASE
springBootVersion=1.4.1.RELEASE
jerseyVersion=2.24
grizzlyVersion=2.3.28
cyclopsReactVersion=2.0.0-MI5
cyclopsVersion=9.0.0-MI1
cyclopsReactVersion=2.0.0-MI7
cyclopsVersion=9.0.0-MI2
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 @@ -2,8 +2,8 @@

import java.util.List;

import cyclops.Semigroups;
import cyclops.collections.ListX;
import cyclops.companion.Semigroups;
import cyclops.collections.mutable.ListX;
import cyclops.function.Monoid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import java.util.Map;
import java.util.Objects;

import cyclops.collections.ListX;
import cyclops.collections.mutable.ListX;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,16 @@ public ServiceRegistryResource(Cleaner cleaner, Finder finder, Register register
@Path("/list")
@Produces("application/json")
public void list(@Suspended AsyncResponse response) {
ReactiveSeq.of(this)
.futureOperations(WorkerThreads.ioExecutor.get())
.forEachX(Long.MAX_VALUE,next -> {
ReactiveSeq.of(this).foldFuture(WorkerThreads.ioExecutor.get(),
s->s.forEach(Long.MAX_VALUE,next -> {
try{
cleaner.clean();
response.resume(finder.find());
}catch(Exception e){
logger.error(e.getMessage(),e);
response.resume(Arrays.asList("failed due to error"));
}
});
}));

}

Expand All @@ -62,17 +61,16 @@ public void list(@Suspended AsyncResponse response) {
@Consumes("application/json")
@Produces("application/json")
public void schedule(@Suspended AsyncResponse response) {
ReactiveSeq.of(this)
.futureOperations(WorkerThreads.ioExecutor.get())
.forEachX(Long.MAX_VALUE,next -> {
ReactiveSeq.of(this).foldFuture(WorkerThreads.ioExecutor.get(),s->
s.forEach(Long.MAX_VALUE,next -> {
try{
job.schedule();
response.resume(HashMapBuilder.of("status", "success"));
}catch(Exception e){
logger.error(e.getMessage(),e);
response.resume(HashMapBuilder.of("status", "failure"));
}
});
}));

}

Expand All @@ -81,17 +79,16 @@ public void schedule(@Suspended AsyncResponse response) {
@Consumes("application/json")
@Produces("application/json")
public void register(@Suspended AsyncResponse response,RegisterEntry entry) {
ReactiveSeq.of(this)
.futureOperations(WorkerThreads.ioExecutor.get())
.forEachX(Long.MAX_VALUE,next -> {
ReactiveSeq.of(this).foldFuture(WorkerThreads.ioExecutor.get(),
s->s.forEach(Long.MAX_VALUE,next -> {
try{
register.register(entry);
response.resume(HashMapBuilder.of("status", "complete"));
}catch(Exception e){
logger.error(e.getMessage(),e);
response.resume(HashMapBuilder.of("status", "failure"));
}
});
}));

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
import com.aol.micro.server.application.registry.RegisterConfig;
import com.aol.micro.server.application.registry.ServiceRegistryResource;
import com.aol.micro.server.application.registry.RegistryStatsChecker;
import cyclops.collections.immutable.PSetX;
import cyclops.collections.immutable.PersistentSetX;

public class ApplicationRegistryPlugin implements Plugin {

@Override
public PSetX<Class> springClasses() {
return PSetX.of(ApplicationRegisterImpl.class, Cleaner.class, Register.class, ServiceRegistryResource.class,
public PersistentSetX<Class> springClasses() {
return PersistentSetX.of(ApplicationRegisterImpl.class, Cleaner.class, Register.class, ServiceRegistryResource.class,
RegisterConfig.class, Job.class, Finder.class, RegistryHealthChecker.class, RegistryStatsChecker.class);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
import com.aol.micro.server.HealthStatusChecker;
import com.aol.micro.server.StatsSupplier;
import com.aol.micro.server.auto.discovery.Rest;
import cyclops.collections.MapXs;
import cyclops.companion.MapXs;


@Rest
@Path("/health")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import java.util.concurrent.Executors;
import java.util.function.BinaryOperator;

import cyclops.collections.ListX;
import cyclops.collections.SetX;
import cyclops.collections.mutable.ListX;
import cyclops.collections.mutable.SetX;
import cyclops.stream.ReactiveSeq;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import com.aol.micro.server.manifest.ManifestComparator;
import com.aol.micro.server.utility.HashMapBuilder;

import cyclops.collections.MapX;
import cyclops.collections.mutable.MapX;
import lombok.AllArgsConstructor;
import lombok.Getter;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import com.aol.micro.server.events.SystemData;
import com.google.common.eventbus.EventBus;

import cyclops.collections.ListX;
import cyclops.collections.mutable.ListX;
import cyclops.stream.ReactiveSeq;
import lombok.AllArgsConstructor;

Expand All @@ -23,10 +23,9 @@ public void schedule() {
loader.forEach(dl -> {

// run on startup
create(dl).limit(1)
.futureOperations(executor)
.forEachX(Long.MAX_VALUE,l -> {
});
create(dl).limit(1).foldFuture(executor,
s->s.forEach(Long.MAX_VALUE,l -> {
}));

// schedule
create(dl).schedule(dl.getCron(), executor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import com.aol.micro.server.Plugin;
import com.aol.micro.server.async.data.loader.ConfigureSchedulingAsyncDataLoader;
import cyclops.collections.SetX;
import cyclops.collections.mutable.SetX;

public class AsyncDataLoaderPlugin implements Plugin {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
import javax.ws.rs.Path;
import javax.ws.rs.Produces;

import cyclops.collections.immutable.PStackX;
import cyclops.collections.immutable.LinkedListX;
import cyclops.control.Maybe;
import org.springframework.beans.factory.annotation.Autowired;


import com.aol.micro.server.async.data.loader.DataLoader;

import com.aol.micro.server.auto.discovery.Rest;
import com.aol.micro.server.distributed.DistributedMap;
import com.aol.micro.server.events.SystemData;
Expand All @@ -21,7 +21,7 @@
public class CouchbaseResource {

private final DistributedMap client;
private volatile PStackX<SystemData> dataLoads = PStackX.empty();
private volatile LinkedListX<SystemData> dataLoads = LinkedListX.empty();

@Autowired
public CouchbaseResource(DistributedMap client, EventBus bus) {
Expand All @@ -38,7 +38,7 @@ public synchronized void events(SystemData event) {
@GET
@Path("/loading-events")
@Produces("application/json")
public synchronized PStackX<SystemData> loadingEvents() {
public synchronized LinkedListX<SystemData> loadingEvents() {
return dataLoads;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import javax.ws.rs.Path;
import javax.ws.rs.Produces;

import cyclops.collections.immutable.PStackX;
import cyclops.collections.immutable.LinkedListX;
import cyclops.control.Maybe;
import org.springframework.beans.factory.annotation.Autowired;

Expand All @@ -21,7 +21,7 @@
public class CouchbaseResource {

private final DistributedMap client;
private volatile PStackX<SystemData> dataLoads = PStackX.empty();
private volatile LinkedListX<SystemData> dataLoads = LinkedListX.empty();

@Autowired
public CouchbaseResource(DistributedMap client, EventBus bus) {
Expand All @@ -38,7 +38,7 @@ public synchronized void events(SystemData event) {
@GET
@Path("/loading-events")
@Produces("application/json")
public synchronized PStackX<SystemData> loadingEvents() {
public synchronized LinkedListX<SystemData> loadingEvents() {
return dataLoads;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import com.google.common.eventbus.EventBus;

import cyclops.collections.ListX;
import cyclops.collections.mutable.ListX;
import cyclops.stream.ReactiveSeq;
import lombok.AllArgsConstructor;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import java.util.concurrent.Executors;
import java.util.function.BinaryOperator;

import cyclops.collections.ListX;
import cyclops.collections.mutable.ListX;
import cyclops.control.Maybe;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import com.aol.micro.server.manifest.ManifestComparator;
import com.aol.micro.server.utility.HashMapBuilder;

import cyclops.collections.MapX;
import cyclops.collections.mutable.MapX;
import lombok.AllArgsConstructor;
import lombok.Getter;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import java.util.function.Supplier;

import cyclops.async.Future;
import cyclops.collections.MapX;
import cyclops.collections.mutable.MapX;
import org.jooq.lambda.tuple.Tuple;


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;

import cyclops.collections.ListX;
import cyclops.collections.mutable.ListX;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@


import cyclops.async.Future;
import cyclops.collections.ListX;
import cyclops.collections.mutable.ListX;
import lombok.AllArgsConstructor;

@AllArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import com.aol.micro.server.Plugin;
import com.aol.micro.server.async.data.cleaner.ConfigureSchedulingAsyncDataWriter;
import com.aol.micro.server.async.data.writer.ConfigureDataWriter;
import cyclops.collections.SetX;
import cyclops.collections.mutable.SetX;

public class AsyncDataWriterPlugin implements Plugin {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import javax.ws.rs.Path;
import javax.ws.rs.Produces;

import cyclops.collections.immutable.PStackX;
import cyclops.collections.immutable.LinkedListX;
import cyclops.control.Maybe;
import org.springframework.beans.factory.annotation.Autowired;

Expand All @@ -21,7 +21,7 @@ public class CouchbaseResource {

private final DistributedMap client;

private volatile PStackX<SystemData> dataCleans = PStackX.empty();
private volatile LinkedListX<SystemData> dataCleans = LinkedListX.empty();

@Autowired
public CouchbaseResource(DistributedMap client, EventBus bus) {
Expand All @@ -37,7 +37,7 @@ public synchronized void events(SystemData event) {
@GET
@Path("/cleaning-events")
@Produces("application/json")
public synchronized PStackX<SystemData> cleaningEvents() {
public synchronized LinkedListX<SystemData> cleaningEvents() {
return dataCleans;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import javax.ws.rs.Path;
import javax.ws.rs.Produces;

import cyclops.collections.immutable.PStackX;
import cyclops.collections.immutable.LinkedListX;
import cyclops.control.Maybe;
import org.springframework.beans.factory.annotation.Autowired;

Expand All @@ -21,7 +21,7 @@ public class CouchbaseResource {

private final DistributedMap client;

private volatile PStackX<SystemData> dataCleans = PStackX.empty();
private volatile LinkedListX<SystemData> dataCleans = LinkedListX.empty();

@Autowired
public CouchbaseResource(DistributedMap client, EventBus bus) {
Expand All @@ -37,7 +37,7 @@ public synchronized void events(SystemData event) {
@GET
@Path("/cleaning-events")
@Produces("application/json")
public synchronized PStackX<SystemData> cleaningEvents() {
public synchronized LinkedListX<SystemData> cleaningEvents() {
return dataCleans;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import static org.hamcrest.CoreMatchers.equalTo;
import static org.junit.Assert.assertThat;

import cyclops.collections.ListX;
import cyclops.collections.mutable.ListX;
import org.junit.Before;
import org.junit.Test;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


import com.aol.micro.server.Plugin;
import cyclops.collections.immutable.PSetX;
import cyclops.collections.immutable.PersistentSetX;

/**
*
Expand All @@ -12,8 +12,8 @@
public class ClientPlugin implements Plugin{

@Override
public PSetX<Class> springClasses() {
return PSetX.of(SpringConfig.class);
public PersistentSetX<Class> springClasses() {
return PersistentSetX.of(SpringConfig.class);
}


Expand Down
Loading

0 comments on commit 3979e76

Please sign in to comment.