Skip to content

Commit

Permalink
Rename ReservationNodePath
Browse files Browse the repository at this point in the history
  • Loading branch information
terrymanu committed Jan 6, 2025
1 parent 3366c5e commit d1b438d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
import lombok.NoArgsConstructor;

/**
* Reservation node.
* Reservation node path.
*/
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class ReservationNode {
public final class ReservationNodePath {

private static final String ROOT_NODE = "reservation";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;

class ReservationNodeTest {
class ReservationNodePathTest {

@Test
void assertGetWorkerIdReservationPath() {
assertThat(ReservationNode.getWorkerIdReservationPath(1), is("/reservation/worker_id/1"));
assertThat(ReservationNodePath.getWorkerIdReservationPath(1), is("/reservation/worker_id/1"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
package org.apache.shardingsphere.mode.manager.cluster.persist.service;

import lombok.RequiredArgsConstructor;
import org.apache.shardingsphere.metadata.persist.node.ReservationNode;
import org.apache.shardingsphere.metadata.persist.node.ReservationNodePath;
import org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepository;
import org.apache.shardingsphere.mode.repository.cluster.exception.ClusterRepositoryPersistException;

Expand All @@ -41,7 +41,7 @@ public final class ReservationPersistService {
*/
public Optional<Integer> reserveWorkerId(final Integer preselectedWorkerId, final String instanceId) {
try {
return repository.persistExclusiveEphemeral(ReservationNode.getWorkerIdReservationPath(preselectedWorkerId), instanceId) ? Optional.of(preselectedWorkerId) : Optional.empty();
return repository.persistExclusiveEphemeral(ReservationNodePath.getWorkerIdReservationPath(preselectedWorkerId), instanceId) ? Optional.of(preselectedWorkerId) : Optional.empty();
} catch (final ClusterRepositoryPersistException ignore) {
return Optional.empty();
}
Expand Down

0 comments on commit d1b438d

Please sign in to comment.