Skip to content

Commit a2c45bd

Browse files
committed
fix: use ulid library safe for graalvm native compilation
Signed-off-by: Matheus Cruz <[email protected]>
1 parent 94f41da commit a2c45bd

File tree

4 files changed

+44
-10
lines changed

4 files changed

+44
-10
lines changed

impl/core/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
<artifactId>slf4j-api</artifactId>
2222
</dependency>
2323
<dependency>
24-
<groupId>com.github.f4b6a3</groupId>
25-
<artifactId>ulid-creator</artifactId>
24+
<groupId>de.huxhorn.sulky</groupId>
25+
<artifactId>de.huxhorn.sulky.ulid</artifactId>
2626
</dependency>
2727
</dependencies>
2828
</project>
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* Copyright 2020-Present The Serverless Workflow Specification Authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package io.serverlessworkflow.impl;
17+
18+
import de.huxhorn.sulky.ulid.ULID;
19+
import java.security.SecureRandom;
20+
21+
/**
22+
* A {@link WorkflowInstanceIdFactory} implementation that generates ULIDs as workflow instance IDs.
23+
*/
24+
public class UlidWorkflowInstanceIdFactory implements WorkflowInstanceIdFactory {
25+
26+
private final SecureRandom random = new SecureRandom();
27+
private final ULID ulid = new ULID(random);
28+
29+
@Override
30+
public String get() {
31+
return ulid.nextULID();
32+
}
33+
}

impl/core/src/main/java/io/serverlessworkflow/impl/WorkflowApplication.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
*/
1616
package io.serverlessworkflow.impl;
1717

18-
import com.github.f4b6a3.ulid.UlidCreator;
1918
import io.serverlessworkflow.api.types.SchemaInline;
2019
import io.serverlessworkflow.api.types.Workflow;
2120
import io.serverlessworkflow.impl.events.EventConsumer;
@@ -31,6 +30,7 @@
3130
import io.serverlessworkflow.impl.resources.StaticResource;
3231
import io.serverlessworkflow.impl.schema.SchemaValidator;
3332
import io.serverlessworkflow.impl.schema.SchemaValidatorFactory;
33+
import java.security.SecureRandom;
3434
import java.util.ArrayList;
3535
import java.util.Collection;
3636
import java.util.Collections;
@@ -141,7 +141,8 @@ public SchemaValidator getValidator(SchemaInline inline) {
141141
private ResourceLoaderFactory resourceLoaderFactory = DefaultResourceLoaderFactory.get();
142142
private SchemaValidatorFactory schemaValidatorFactory;
143143
private WorkflowPositionFactory positionFactory = () -> new QueueWorkflowPosition();
144-
private WorkflowInstanceIdFactory idFactory = () -> UlidCreator.getMonotonicUlid().toString();
144+
private final SecureRandom secureRandom = new SecureRandom();
145+
private WorkflowInstanceIdFactory idFactory = new UlidWorkflowInstanceIdFactory();
145146
private ExecutorServiceFactory executorFactory = new DefaultExecutorServiceFactory();
146147
private EventConsumer<?, ?> eventConsumer;
147148
private Collection<EventPublisher> eventPublishers = new ArrayList<>();

impl/pom.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
<name>Serverless Workflow :: Impl</name>
1010
<packaging>pom</packaging>
1111
<properties>
12-
<version.org.glassfish.jersey>3.1.11</version.org.glassfish.jersey>
13-
<version.net.thisptr>1.6.0</version.net.thisptr>
14-
<version.com.github.f4b6a3>5.2.3</version.com.github.f4b6a3>
12+
<version.de.huxhorn.sulky>8.3.0</version.de.huxhorn.sulky>
1513
<version.jakarta.ws.rs>4.0.0</version.jakarta.ws.rs>
14+
<version.net.thisptr>1.6.0</version.net.thisptr>
15+
<version.org.glassfish.jersey>3.1.11</version.org.glassfish.jersey>
1616
</properties>
1717
<dependencyManagement>
1818
<dependencies>
@@ -42,9 +42,9 @@
4242
<version>${version.net.thisptr}</version>
4343
</dependency>
4444
<dependency>
45-
<groupId>com.github.f4b6a3</groupId>
46-
<artifactId>ulid-creator</artifactId>
47-
<version>${version.com.github.f4b6a3}</version>
45+
<groupId>de.huxhorn.sulky</groupId>
46+
<artifactId>de.huxhorn.sulky.ulid</artifactId>
47+
<version>${version.de.huxhorn.sulky}</version>
4848
</dependency>
4949
<dependency>
5050
<groupId>jakarta.ws.rs</groupId>

0 commit comments

Comments
 (0)