Class InjvmExporterListener
- All Implemented Interfaces:
ExporterListener
which is used to listen for changes to the InjvmExporter instances.
It maintains two ConcurrentHashMaps, one to keep track of the ExporterChangeListeners registered for each service,
and another to keep track of the currently exported services and their associated Exporter instances.
It overrides the exported and unexported methods to add or remove the corresponding Exporter instances to/from
the exporters ConcurrentHashMap, and to notify all registered ExporterChangeListeners of the change.
It also provides methods to add or remove ExporterChangeListeners for a specific service, and to retrieve the
currently exported Exporter instance for a given service.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddExporterChangeListener(ExporterChangeListener listener, String serviceKey) Adds an ExporterChangeListener for a specific service, and notifies the listener of the current Exporter instancevoidOverrides the exported method to add the given exporter to the exporters ConcurrentHashMap,voidremoveExporterChangeListener(ExporterChangeListener listener, String listenerKey) Removes an ExporterChangeListener for a specific service.voidunexported(Exporter<?> exporter) Overrides the unexported method to remove the given exporter from the exporters ConcurrentHashMap,
-
Constructor Details
-
InjvmExporterListener
public InjvmExporterListener()
-
-
Method Details
-
exported
Overrides the exported method to add the given exporter to the exporters ConcurrentHashMap,and to notify all registered ExporterChangeListeners of the export event.
- Specified by:
exportedin interfaceExporterListener- Overrides:
exportedin classExporterListenerAdapter- Parameters:
exporter- The Exporter instance that has been exported.- Throws:
RpcException- If there is an error during the export process.- See Also:
-
unexported
Overrides the unexported method to remove the given exporter from the exporters ConcurrentHashMap,and to notify all registered ExporterChangeListeners of the unexport event.
- Specified by:
unexportedin interfaceExporterListener- Overrides:
unexportedin classExporterListenerAdapter- Parameters:
exporter- The Exporter instance that has been unexported.- Throws:
RpcException- If there is an error during the unexport process.- See Also:
-
addExporterChangeListener
Adds an ExporterChangeListener for a specific service, and notifies the listener of the current Exporter instanceif it exists.
- Parameters:
listener- The ExporterChangeListener to add.serviceKey- The service key for the service to listen for changes on.
-
removeExporterChangeListener
Removes an ExporterChangeListener for a specific service.- Parameters:
listener- The ExporterChangeListener to remove.listenerKey- The service key for the service to remove the listener from.
-