Interface ServiceBinding<T>
- Type Parameters:
T- ordinary business interface
- All Superinterfaces:
AutoCloseable
Stable live service handle; each business invocation captures one exact target and is never
replayed automatically. The owning activation closes the handle to detach discovery/listeners.
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Detaches discovery and observers; future business calls fail rather than resurrecting targets.Exposes absence explicitly without manufacturing a null proxy.proxy()Returns one identity-stable business proxy, even after target refresh.snapshot()Returns an immutable typed snapshot; references are not authorization tokens.watch(Consumer<BindingSnapshot> listener) Observes future coalesced refresh snapshots on bounded owner workers, outside state locks.
-
Method Details
-
proxy
T proxy()Returns one identity-stable business proxy, even after target refresh.- Returns:
- nonnull stable proxy
- Throws:
IllegalStateException- for closed handles or OPTIONAL policy
-
optionalProvider
ManagedProvider<Optional<T>> optionalProvider()Exposes absence explicitly without manufacturing a null proxy.- Returns:
- provider of an optional stable proxy, empty when no eligible target exists
- Throws:
IllegalStateException- if closed
-
snapshot
BindingSnapshot snapshot()Returns an immutable typed snapshot; references are not authorization tokens.- Returns:
- current publication state
-
watch
Observes future coalesced refresh snapshots on bounded owner workers, outside state locks. Slow listeners may miss intermediate snapshots, never the latest published generation. Closing revokes future scheduling; an already running listener must cooperate with shutdown.- Parameters:
listener- bounded nonblocking observer, never supplied invocation payloads- Returns:
- listener registration, at most32 per binding
- Throws:
IllegalStateException- if closed or listener capacity is exhausted
-
close
void close()Detaches discovery and observers; future business calls fail rather than resurrecting targets.- Specified by:
closein interfaceAutoCloseable
-