Skip to content

Commit

Permalink
WIP, figuring out supplier/memoize
Browse files Browse the repository at this point in the history
  • Loading branch information
meatballspaghetti committed Aug 30, 2024
1 parent 1d365a9 commit 170bc5f
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,11 @@ public class ClientContext implements AccumuloClient {
private ThreadPoolExecutor cleanupThreadPool;
private ThreadPoolExecutor scannerReadaheadPool;

private final Supplier<InstanceId> instanceIdSupplier = Suppliers.memoize(this::getInstanceId);
public InstanceId getMemoizedInstanceId() {
return instanceIdSupplier.get();
}

private void ensureOpen() {
if (closed) {
throw new IllegalStateException("This client was closed.");
Expand Down Expand Up @@ -544,6 +549,7 @@ public List<String> getManagerLocations() {
*/
public InstanceId getInstanceID() {
ensureOpen();
// return instanceIdSupplier.get();
if (instanceId == null) {
// lookup by name
final String instanceName = info.getInstanceName();
Expand Down

0 comments on commit 170bc5f

Please sign in to comment.