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
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,7 @@ private LeaderCallbacks leaderCallbacks() {
return new LeaderCallbacks(
this::startLeading,
this::stopLeading,
leader -> {
log.info("New leader with identity: {}", leader);
});
leader -> log.info("New leader with identity: {}", leader));
}

private void startLeading() {
Expand All @@ -82,7 +80,7 @@ private void stopLeading() {
}

private String identity(LeaderElectionConfiguration config) {
var id = config.getIdentity().orElse(System.getenv("HOSTNAME"));
var id = config.getIdentity().orElseGet(() -> System.getenv("HOSTNAME"));
if (id == null || id.isBlank()) {
id = UUID.randomUUID().toString();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public ReconcileResult<R> reconcile(P primary, Context<P> context) {
if (updatable) {
final var match = updater.match(actual, primary, context);
if (!match.matched()) {
final var desired = match.computedDesired().orElse(desired(primary, context));
final var desired = match.computedDesired().orElseGet(() -> desired(primary, context));
throwIfNull(desired, primary, "Desired");
logForOperation("Updating", primary, desired);
var updatedResource = handleUpdate(actual, desired, primary, context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ private PostExecutionControl<P> handleErrorStatusHandler(P resource, P originalR
Exception e) throws Exception {
if (isErrorStatusHandlerPresent()) {
try {
RetryInfo retryInfo = context.getRetryInfo().orElse(new RetryInfo() {
RetryInfo retryInfo = context.getRetryInfo().orElseGet(() -> new RetryInfo() {
@Override
public int getAttemptCount() {
return 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,11 @@ public Stream<T> list(String namespace, Predicate<T> predicate) {
if (isWatchingAllNamespaces()) {
return getSource(ALL_NAMESPACES_MAP_KEY)
.map(source -> source.list(namespace, predicate))
.orElse(Stream.empty());
.orElseGet(Stream::empty);
} else {
return getSource(namespace)
.map(source -> source.list(predicate))
.orElse(Stream.empty());
.orElseGet(Stream::empty);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public UpdateControl<MySQLSchema> reconcile(MySQLSchema schema, Context<MySQLSch
decode(secret.getData().get(MYSQL_SECRET_USERNAME)));
log.info("Schema {} created - updating CR status", s.getName());
return UpdateControl.patchStatus(schema);
}).orElse(UpdateControl.noUpdate());
}).orElseGet(UpdateControl::noUpdate);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public UpdateControl<Tomcat> reconcile(Tomcat tomcat, Context<Tomcat> context) {
tomcat.getMetadata().getNamespace(),
tomcat.getStatus().getReadyReplicas());
return UpdateControl.patchStatus(updatedTomcat);
}).orElse(UpdateControl.noUpdate());
}).orElseGet(UpdateControl::noUpdate);
}

private Tomcat updateTomcatStatus(Tomcat tomcat, Deployment deployment) {
Expand Down