Class NetworkBootstrapEndpointResolver
java.lang.Object
org.j7m.middleware.registry.bootstrap.NetworkBootstrapEndpointResolver
- All Implemented Interfaces:
AutoCloseable, BootstrapEndpointResolver
public final class NetworkBootstrapEndpointResolver
extends Object
implements BootstrapEndpointResolver, AutoCloseable
Explicit, thread-safe lazy resolver for
bootstrap+tls://host:port endpoints.
The supplied TLS context must provide a client identity and trust the server; HTTPS endpoint
identification verifies the original hostname or IP SAN. Resolution creates no network connection.
Each operation uses a fresh socket and at most the configured budget, additionally bounded by the
bootstrap traversal deadline. There are at most 64 active calls and four DNS workers with no queue.
A JDK DNS lookup may ignore cancellation; such a lookup retains its worker until actual exit,
causing bounded admission failures rather than spawning more threads. The resolver owns its
sockets, DNS workers and timers; returned facades own no shared backend and are read-only.-
Constructor Summary
ConstructorsConstructorDescriptionNetworkBootstrapEndpointResolver(SSLContext tls, Duration operationBudget) Creates an explicit network resolver. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes active sockets and owned DNS/timer resources.Optional<org.j7m.middleware.registry.api.RegistryClient> Creates a lazy read-only facade using the configured per-operation budget.Optional<org.j7m.middleware.registry.api.RegistryClient> Creates a facade whose operations share an original absolute traversal deadline.
-
Constructor Details
-
NetworkBootstrapEndpointResolver
Creates an explicit network resolver.- Parameters:
tls- nonnull host-owned TLS identity/trust configurationoperationBudget- maximum total operation budget, 1ms through 5s- Throws:
IllegalArgumentException- for an invalid budget
-
-
Method Details
-
resolve
Creates a lazy read-only facade using the configured per-operation budget.- Specified by:
resolvein interfaceBootstrapEndpointResolver- Parameters:
endpoint- explicit bootstrap TLS URI- Returns:
- empty for another scheme or malformed endpoint, otherwise a lazy client
- Throws:
org.j7m.middleware.api.MiddlewareException- if this resolver has been closed
-
resolve
public Optional<org.j7m.middleware.registry.api.RegistryClient> resolve(String endpoint, long deadlineMillis) Creates a facade whose operations share an original absolute traversal deadline.- Specified by:
resolvein interfaceBootstrapEndpointResolver- Parameters:
endpoint- explicit bootstrap TLS URI; hostname or IPv4/IPv6 literaldeadlineMillis- absolute epoch-millisecond deadline, or zero for per-operation budget- Returns:
- a lazy client for a syntactically valid endpoint, otherwise empty
- Throws:
org.j7m.middleware.api.MiddlewareException- if this resolver has been closed
-
close
public void close()Closes active sockets and owned DNS/timer resources. Idempotent; existing facades then fail. DNS interruption is advisory and never triggers replacement workers beyond the fixed cap.- Specified by:
closein interfaceAutoCloseable
-