Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#1703 fixed wrongly emptied out search index on policy retrieval erro…
…r due to internal timeouts Signed-off-by: Thomas Jäckle <thomas.jaeckle@beyonnex.io>
- Loading branch information
Showing
6 changed files
with
138 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
.../cache/src/main/java/org/eclipse/ditto/internal/utils/cache/entry/FailedToFetchEntry.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
* Copyright (c) 2023 Contributors to the Eclipse Foundation | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information regarding copyright ownership. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0 | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*/ | ||
package org.eclipse.ditto.internal.utils.cache.entry; | ||
|
||
import java.util.NoSuchElementException; | ||
import java.util.Optional; | ||
|
||
import javax.annotation.concurrent.Immutable; | ||
|
||
@Immutable | ||
final class FailedToFetchEntry<T> implements Entry<T> { | ||
|
||
private final Throwable throwable; | ||
|
||
/* this object is not supposed to be constructed anywhere else. */ | ||
private FailedToFetchEntry(final Throwable throwable) { | ||
this.throwable = throwable; | ||
} | ||
|
||
@Override | ||
public long getRevision() { | ||
return 0; | ||
} | ||
|
||
@Override | ||
public T getValueOrThrow() { | ||
throw new NoSuchElementException(); | ||
} | ||
|
||
@Override | ||
public boolean exists() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean isFetchError() { | ||
return true; | ||
} | ||
|
||
@Override | ||
public Optional<Throwable> getFetchErrorCause() { | ||
return Optional.of(throwable); | ||
} | ||
|
||
static <T> FailedToFetchEntry<T> of(final Throwable throwable) { | ||
return new FailedToFetchEntry<>(throwable); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters