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 type of theNanoServicesimplementation, used for method chaining.
- Direct Known Subclasses:
Nano
-
Field Summary
FieldsFields inherited from class org.nanonative.nano.core.NanoThreads
schedulers, threadPoolFields inherited from class org.nanonative.nano.core.NanoBase
CONFIG_KEYS, context, createdAtMs, EVENT_ID_COUNTER, EVENT_TYPES, eventCount, isReady, listeners, logger -
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 type.services()Provides an unmodifiable list of all registeredService.Retrieves a list of services of a specified type.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, kill, removeScheduler, run, run, run, schedulers, shutdownExecutors, shutdownThreads, threadPoolMethods inherited from class org.nanonative.nano.core.NanoBase
createdAtMs, displayHelpMenu, eventCount, heapMemoryUsage, isReady, listeners, logger, pid, putAll, readConfigs, setLogLevel, standardiseKey, stop, stop, 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
-
service
Retrieves aServiceof a specified type. -
services
Retrieves a list of services of a specified type.- Type Parameters:
S- The type of the service to retrieve, which extendsService.- Parameters:
serviceClass- The class of the service to retrieve.- Returns:
- A list of services of the specified type. If no services of this type 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
-