[ https://issues.apache.org/jira/browse/OAK-11656 ]


    Julian Reschke deleted comment on OAK-11656:
    --------------------------------------

was (Author: reschke):
there's a Memoize in commons-lang.

> Remove usage of Guava Suppliers.memoize
> ---------------------------------------
>
>                 Key: OAK-11656
>                 URL: https://issues.apache.org/jira/browse/OAK-11656
>             Project: Jackrabbit Oak
>          Issue Type: Technical task
>            Reporter: Julian Reschke
>            Assignee: Julian Reschke
>            Priority: Minor
>
> Can be relatively easy replaced, such as with:
> {code}
>     @Nullable private DocumentStore memoizedDocumentStore = null;
>     protected Supplier<DocumentStore> documentStoreSupplier = () -> 
> memoizedDocumentStore = Objects.requireNonNullElse(memoizedDocumentStore, new 
> MemoryDocumentStore());
> {code}
> or by the classical:
> {code}
>     @Nullable private DocumentStore memoizedDocumentStore = null;
>     @NonNull DocumentStore getDocumentStore() {
>         memoizedDocumentStore = 
> Objects.requireNonNullElse(memoizedDocumentStore, new MemoryDocumentStore()):
>         return memoizedDocumentStore;
>    }
> {code}
> Both variants require a visible local variable though.
> ...but we only have 8 instances outside tests.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to