Skip to content
This repository was archived by the owner on Jun 20, 2025. It is now read-only.

Prepare release #97

Merged
merged 10 commits into from
Sep 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
package io.scalecube.benchmarks;

import java.time.Duration;
import reactor.core.scheduler.Scheduler;

public interface BenchmarkTask {
public interface BenchmarkTask extends Runnable {

BenchmarkSettings settings();

void schedule(Duration interval);

void scheduleWithInterval();

void scheduleNow();
Scheduler scheduler();
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import static io.scalecube.benchmarks.BenchmarkTaskImpl.Status.COMPLETING;
import static io.scalecube.benchmarks.BenchmarkTaskImpl.Status.SCHEDULED;

import java.time.Duration;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicLong;
Expand All @@ -19,7 +18,7 @@
import reactor.core.publisher.Mono;
import reactor.core.scheduler.Scheduler;

public class BenchmarkTaskImpl implements BenchmarkTask, Runnable {
public class BenchmarkTaskImpl implements BenchmarkTask {

private static final Logger LOGGER = LoggerFactory.getLogger(BenchmarkTaskImpl.class);

Expand Down Expand Up @@ -64,22 +63,8 @@ public BenchmarkSettings settings() {
}

@Override
public void schedule(Duration interval) {
if (interval == null || interval.isZero()) {
scheduleNow();
} else {
scheduler.schedule(this, interval.toMillis(), TimeUnit.MILLISECONDS);
}
}

@Override
public void scheduleWithInterval() {
schedule(settings.executionTaskInterval());
}

@Override
public void scheduleNow() {
scheduler.schedule(this);
public Scheduler scheduler() {
return scheduler;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,16 @@ public BenchmarkMeter meter(String name) {
return new BenchmarkMeter() {
@Override
public void mark() {
meter.mark();
if (enabled.get()) {
meter.mark();
}
}

@Override
public void mark(long value) {
meter.mark(value);
if (enabled.get()) {
meter.mark(value);
}
}
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,13 @@ public static void main(String[] args) {
return serviceCaller
.call("hello")
.doOnTerminate(timeContext::stop)
.doOnTerminate(task::scheduleWithInterval);
.doOnTerminate(
() ->
task.scheduler()
.schedule(
task,
task.settings().executionTaskInterval().toMillis(),
TimeUnit.MILLISECONDS));
});
},
(state, serviceCaller) -> serviceCaller.close());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,13 @@ public static void main(String[] args) {
Mono.fromRunnable(RampUpSimpleTestRunner::heavy)
.doOnTerminate(
() -> LOGGER.info("User: " + userId + " | iteration: " + i))
.doOnTerminate(task::scheduleWithInterval),
.doOnTerminate(
() ->
task.scheduler()
.schedule(
task,
task.settings().executionTaskInterval().toMillis(),
TimeUnit.MILLISECONDS)),
// teardown
(state, userId) -> {
LOGGER.info("User done:" + userId);
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 @@
<parent>
<groupId>io.scalecube</groupId>
<artifactId>scalecube-parent-pom</artifactId>
<version>0.0.11</version>
<version>0.0.15</version>
</parent>

<artifactId>scalecube-benchmarks-parent</artifactId>
Expand Down
6 changes: 3 additions & 3 deletions src/main/scripts/ci/after-success.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ echo Running $0
echo *-*-*-*-*-*-*-*-*-*-*-*-*-*

if [ -z "$CODACY_PROJECT_TOKEN" ]; then
echo [WARNING] Please go to https://app.codacy.com/app/$TRAVIS_REPO_SLUG/settings/coverage and add CODACY_PROJECT_TOKEN to travis settings
echo [WARNING] Please go to https://app.codacy.com/app/$TRAVIS_REPO_SLUG/settings/coverage and add CODACY_PROJECT_TOKEN to travis settings
else
find -name jacoco.xml -exec java -jar ~/codacy-coverage-reporter-assembly.jar report -l Java -r {} --partial\;
java -jar ~/codacy-coverage-reporter-assembly.jar final
find -name jacoco.xml | xargs -i java -jar ~/codacy-coverage-reporter-assembly.jar report -l Java --partial -r {}
java -jar ~/codacy-coverage-reporter-assembly.jar final
fi;
3 changes: 3 additions & 0 deletions src/main/scripts/ci/before-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
echo Running $0
echo *-*-*-*-*-*-*-*-*-*-*-*-*-*

echo logging to docker image repository:
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin

# get latest version of codacy reporter from sonatype
latest=$(curl "https://oss.sonatype.org/service/local/repositories/releases/content/com/codacy/codacy-coverage-reporter/maven-metadata.xml" | xpath -e "/metadata/versioning/release/text()")

Expand Down
7 changes: 6 additions & 1 deletion travis-settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,14 @@
<username>${env.SONATYPE_USERNAME}</username>
<password>${env.SONATYPE_PASSWORD}</password>
</server>
<server>
<id>docker.io</id>
<username>${env.DOCKER_USERNAME}</username>
<password>${env.DOCKER_PASSWORD}</password>
</server>
</servers>
<activeProfiles>
<activeProfile>bintray</activeProfile>
<activeProfile>ossrh</activeProfile>
</activeProfiles>
</settings>
</settings>