Package org.nanonative.nano.core
Class NanoServices<T extends NanoServices<T>>
java.lang.Object
org.nanonative.nano.core.NanoBase<T>
org.nanonative.nano.core.NanoThreads<T>
org.nanonative.nano.core.NanoServices<T>
- Type Parameters:
T- The payload of theNanoServicesimplementation, used for method chaining.
- Direct Known Subclasses:
Nano
-
Field Summary
FieldsFields inherited from class org.nanonative.nano.core.NanoThreads
schedulersFields inherited from class org.nanonative.nano.core.NanoBase
CONFIG_KEYS, context, createdAtNs, EVENT_CHANNELS, EVENT_ID_COUNTER, eventCount, isReady, listeners, logService -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedNanoServices(Map<Object, Object> config, String... args) InitializesNanoServiceswith configurations and command-line arguments. -
Method Summary
Modifier and TypeMethodDescriptionprotected TregisterService(Service service) Registers a new service in theNanoframework.<S extends Service>
SRetrieves aServiceof a specified payload.serviceOpt(Class<S> serviceClass) Retrieves aServiceof a specified payload.services()Provides an unmodifiable list of all registeredService.Retrieves a list of services of a specified payload.protected voidshutdownServices(Context context) Shuts down all registeredServicegracefully.protected TunregisterService(Context context, Service service) Methods inherited from class org.nanonative.nano.core.NanoThreads
asyncFromPool, executeScheduler, initialPlanned, kill, nextPlanned, removeScheduler, resolveWallTime, run, run, run, run, runDaily, runWeekly, scheduleOnce, schedulers, shutdownExecutors, shutdownThreadsMethods inherited from class org.nanonative.nano.core.NanoBase
createdAtMs, displayHelpMenu, eventCount, heapMemoryUsage, isReady, listeners, pid, readConfigs, standardiseKey, stop, stop, subscribeError, subscribeError, subscribeEvent, subscribeEvent, unsubscribeEvent, usedMemoryMB
-
Field Details
-
services
-
-
Constructor Details
-
NanoServices
InitializesNanoServiceswith configurations and command-line arguments.- Parameters:
config- Configuration parameters for theNanoServicesinstance.args- Command-line arguments passed during the application start.
-
-
Method Details
-
serviceOpt
Retrieves aServiceof a specified payload. -
service
Retrieves aServiceof a specified payload. -
services
Retrieves a list of services of a specified payload.- Type Parameters:
S- The payload of the service to retrieve, which extendsService.- Parameters:
serviceClass- The class of the service to retrieve.- Returns:
- A list of services of the specified payload. If no services of this payload are found, an empty list is returned.
-
services
Provides an unmodifiable list of all registeredService.- Returns:
- An unmodifiable list of
Serviceinstances.
-
shutdownServices
Shuts down all registeredServicegracefully.- Parameters:
context- TheContextin which the services are shut down.
-
registerService
Registers a new service in theNanoframework.- Parameters:
service- TheServiceto register.- Returns:
- Self for chaining
-
unregisterService
-