pub struct ServiceManager<T: ServiceTask + 'static> { /* private fields */ }
Expand description
Service thread implementation with lifecycle management
Implementations§
Source§impl<T: ServiceTask + 'static> ServiceManager<T>
impl<T: ServiceTask + 'static> ServiceManager<T>
pub fn new_arc(service: Arc<T>) -> Self
Sourcepub async fn start(&self) -> RocketMQResult<()>
pub async fn start(&self) -> RocketMQResult<()>
Start the service thread
Sourcepub async fn shutdown(&self) -> RocketMQResult<()>
pub async fn shutdown(&self) -> RocketMQResult<()>
Shutdown the service
Sourcepub async fn shutdown_with_interrupt(
&self,
interrupt: bool,
) -> RocketMQResult<()>
pub async fn shutdown_with_interrupt( &self, interrupt: bool, ) -> RocketMQResult<()>
Shutdown the service with optional interrupt
Sourcepub async fn wait_for_running(&self, interval: Duration)
pub async fn wait_for_running(&self, interval: Duration)
Wait for running with interval
Sourcepub fn is_stopped(&self) -> bool
pub fn is_stopped(&self) -> bool
Check if service is stopped
Sourcepub fn set_daemon(&self, daemon: bool)
pub fn set_daemon(&self, daemon: bool)
Set daemon flag
Sourcepub async fn get_lifecycle_state(&self) -> ServiceLifecycle
pub async fn get_lifecycle_state(&self) -> ServiceLifecycle
Get current service state
Sourcepub fn is_started(&self) -> bool
pub fn is_started(&self) -> bool
Check if service is started
Trait Implementations§
Source§impl<T: ServiceTask> AsRef<T> for ServiceManager<T>
impl<T: ServiceTask> AsRef<T> for ServiceManager<T>
Auto Trait Implementations§
impl<T> !Freeze for ServiceManager<T>
impl<T> !RefUnwindSafe for ServiceManager<T>
impl<T> Send for ServiceManager<T>
impl<T> Sync for ServiceManager<T>
impl<T> Unpin for ServiceManager<T>
impl<T> !UnwindSafe for ServiceManager<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more