Skip to content
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
8 changes: 5 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -109,21 +109,23 @@ subprojects {
extensions.configure<com.diffplug.gradle.spotless.SpotlessExtension> {
java {
googleJavaFormat()
importOrder("dev.dbos", "java", "javax", "")
cleanthat()
formatAnnotations()
removeUnusedImports()
importOrder("dev.dbos", "java", "javax", "")
trimTrailingWhitespace()
endWithNewline()
}
kotlin {
target("**/*.kt")
targetExclude("build/**/*.kt")
ktfmt("0.61").googleStyle()
ktfmt("0.62").googleStyle()
trimTrailingWhitespace()
endWithNewline()
}
kotlinGradle {
target("**/*.gradle.kts")
ktfmt("0.61").googleStyle()
ktfmt("0.62").googleStyle()
trimTrailingWhitespace()
endWithNewline()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import java.util.List;

public class GetMetricsResponse extends BaseResponse {
public static record MetricsDataOutput(String metric_type, String metric_name, long value) {
public record MetricsDataOutput(String metric_type, String metric_name, long value) {
public static MetricsDataOutput fromMetricData(MetricData m) {
return new MetricsDataOutput(m.metricType(), m.metricName(), m.value());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

public class GetWorkflowAggregatesResponse extends BaseResponse {

public static record WorkflowAggregateOutput(Map<String, String> group, long count) {
public record WorkflowAggregateOutput(Map<String, String> group, long count) {
public static WorkflowAggregateOutput from(WorkflowAggregateRow row) {
return new WorkflowAggregateOutput(row.group(), row.count());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import java.util.List;

public class ListApplicationVersionsResponse extends BaseResponse {
public static record AppVersionInfo(
public record AppVersionInfo(
String version_id, String version_name, long version_timestamp, long created_at) {
public static AppVersionInfo fromVersionInfo(VersionInfo v) {
return new AppVersionInfo(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ static <T> Result<T> failure(Throwable exception) {
}

@SuppressWarnings("unchecked")
public static <T, E extends Exception> T process(Result<T> result) throws E {
static <T, E extends Exception> T process(Result<T> result) throws E {
if (result instanceof Result.Success<T> success) {
return success.value();
} else if (result instanceof Result.Failure<T> failure) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public static List<String> getAndStartQueuedWorkflows(
DbContext ctx, Queue queue, String executorId, String appVersion, String partitionKey)
throws SQLException {

if (partitionKey != null && partitionKey.length() == 0) {
if (partitionKey != null && partitionKey.isEmpty()) {
partitionKey = null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public static WorkflowInitResult initWorkflowStatus(
} // end try with resources connection closed
}

static record InsertWorkflowResult(
record InsertWorkflowResult(
int recoveryAttempts,
String status,
String workflowName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
public sealed interface SignalKey
permits SignalKey.Cancellation, SignalKey.Event, SignalKey.Message, SignalKey.Shutdown {

public enum WakeReason {
enum WakeReason {
MESSAGE,
EVENT,
CANCELLED,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ public static Throwable safeParseError(
* serializer used (to be stored in the DB).
*/
/** Result of serialization, containing the serialized string and the format used. */
public static record SerializedResult(String serializedValue, String serialization) {
public record SerializedResult(String serializedValue, String serialization) {
public SerializedResult {
Objects.requireNonNull(serializedValue);
// serialization can be null for backward compatibility (default format)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public record Queue(
RateLimit rateLimit) {

/** Rate limit parameter structure for DBOS workflow queues */
public static record RateLimit(int limit, Duration period) {}
public record RateLimit(int limit, Duration period) {}

public Queue {
Objects.requireNonNull(name, "Queue name must not be null");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ interface ExecutingService {

void stepWithNoReturn();

public static class MyAppException extends Exception {
class MyAppException extends Exception {
public MyAppException() {
super("You asked for it");
}
Expand Down
4 changes: 2 additions & 2 deletions transact/src/test/java/dev/dbos/transact/issues/Issue218.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@

interface Issue218Service {

public void taskWorkflow(int i) throws Exception;
void taskWorkflow(int i) throws Exception;

public void parentParallel() throws Exception;
void parentParallel() throws Exception;
}

class Issue218ServiceImpl implements Issue218Service {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package dev.dbos.transact.queue;

public interface ConcurrencyTestService {
public int noopWorkflow(int i);
int noopWorkflow(int i);

public int blockedWorkflow(int i) throws InterruptedException;
int blockedWorkflow(int i) throws InterruptedException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

public interface ServiceI {

public Integer workflowI(int number);
Integer workflowI(int number);
}
6 changes: 3 additions & 3 deletions transact/src/test/java/dev/dbos/transact/queue/ServiceQ.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

public interface ServiceQ {

public String simpleQWorkflow(String input);
String simpleQWorkflow(String input);

public Double limitWorkflow(String var1, String var2);
Double limitWorkflow(String var1, String var2);

public String priorityWorkflow(int input);
String priorityWorkflow(int input);
}
25 changes: 12 additions & 13 deletions transact/src/test/java/dev/dbos/transact/step/StepsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ public String stepWithLongRetry(String input) throws Exception {
throw new Exception("First try");
}
if (System.currentTimeMillis() - startedTime > 500) {
var rv = Integer.valueOf(this.stepWithLongRetryRuns).toString();
var rv = Integer.toString(this.stepWithLongRetryRuns);
startedTime = 0;
return rv;
}
Expand All @@ -217,7 +217,7 @@ public String stepRetryWorkflow(String input) {
boolean caught = false;
String result = "2 Retries: ";
try {
result = result + self.stepWith2Retries(input);
result += self.stepWith2Retries(input);
} catch (Exception e) {
caught = true;
}
Expand Down Expand Up @@ -273,17 +273,16 @@ public String inlineStepRetryWorkflow(String input) {
boolean caught = false;
String result = "2 Retries: ";
try {
result =
result
+ dbos.runStep(
() -> {
++this.stepWithRetryRuns;
throw new Exception("Will not ever run");
},
new StepOptions("inlineStepWithRetries")
.withMaxAttempts(2)
.withRetryInterval(Duration.ofMillis(100))
.withBackoffRate(2.0));
result +=
dbos.runStep(
() -> {
++this.stepWithRetryRuns;
throw new Exception("Will not ever run");
},
new StepOptions("inlineStepWithRetries")
.withMaxAttempts(2)
.withRetryInterval(Duration.ofMillis(100))
.withBackoffRate(2.0));
;
} catch (Exception e) {
caught = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,25 @@

interface SimpleService {

public String workWithString(String input);
String workWithString(String input);

public void workWithError() throws Exception;
void workWithError() throws Exception;

public String parentWorkflowWithoutSet(String input);
String parentWorkflowWithoutSet(String input);

public String workflowWithMultipleChildren(String input) throws Exception;
String workflowWithMultipleChildren(String input) throws Exception;

public String childWorkflow(String input);
String childWorkflow(String input);

public String childWorkflow2(String input);
String childWorkflow2(String input);

public String childWorkflow3(String input);
String childWorkflow3(String input);

public String childWorkflow4(String input) throws Exception;
String childWorkflow4(String input) throws Exception;

public String grandchildWorkflow(String input);
String grandchildWorkflow(String input);

public String grandParent(String input) throws Exception;
String grandParent(String input) throws Exception;

String syncWithQueued();

Expand Down Expand Up @@ -91,7 +91,7 @@ public void workWithError() throws Exception {
public String parentWorkflowWithoutSet(String input) {
String result = input;

result = result + self.childWorkflow("abc");
result += self.childWorkflow("abc");

return result;
}
Expand All @@ -110,17 +110,17 @@ public String workflowWithMultipleChildren(String input) throws Exception {
try (var id = new WorkflowOptions("child1").setContext()) {
self.childWorkflow("abc");
}
result = result + dbos.retrieveWorkflow("child1").getResult();
result += dbos.retrieveWorkflow("child1").getResult();

try (var id = new WorkflowOptions("child2").setContext()) {
self.childWorkflow2("def");
}
result = result + dbos.retrieveWorkflow("child2").getResult();
result += dbos.retrieveWorkflow("child2").getResult();

try (var id = new WorkflowOptions("child3").setContext()) {
self.childWorkflow3("ghi");
}
result = result + dbos.retrieveWorkflow("child3").getResult();
result += dbos.retrieveWorkflow("child3").getResult();

return result;
}
Expand Down
Loading