T
- type of service configurerV
- type of service contextpublic interface Service<T extends ServiceConfigurer,V extends ServiceContext> extends ProgramLifecycle<V>
Modifier and Type | Method and Description |
---|---|
void |
configure(T configurer)
Configure the Service by adding
HttpServiceHandler s to handle requests. |
default void |
destroy()
Destroy the
Service . |
default void |
initialize(V context)
Initialize the
Service . |
void configure(T configurer)
HttpServiceHandler
s to handle requests.configurer
- to use to add handlers to the Service.default void initialize(V context) throws Exception
Service
. This method will be called before the service starts up.
This method will be called before each service instance starts up. If there is more than one instance of
the service, it will be called more than once.
Note that unlike most program types, this method is not called within an implicit transaction,
but instead it can start its own transactions using Transactional.execute(TxRunnable)
.
methods.initialize
in interface ProgramLifecycle<V extends ServiceContext>
context
- An instance of RuntimeContext
Exception
- If there is any error during initialization.default void destroy()
Service
.
This method will be called before each service instance shuts down. If there is more than one instance of
the service, it will be called more than once.
Note that unlike most program types, this method is not called within an implicit transaction,
but instead it can start its own transactions using Transactional.execute(TxRunnable)
.destroy
in interface ProgramLifecycle<V extends ServiceContext>
Copyright © 2022 Cask Data, Inc. Licensed under the Apache License, Version 2.0.