ServiceStateChangeListener (Apache Hadoop Main 3.5.0 API)
Description: declaration: package: org.apache.hadoop.service, interface: ServiceStateChangeListener

Package org.apache.hadoop.service

# Interface ServiceStateChangeListener

All Known Implementing Classes:
  `LoggingStateChangeListener`

@Public @Stable public interface ServiceStateChangeListener
Interface to notify state changes of a service.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `stateChanged(Service service)`
  Callback to notify of a state change.

- ## Method Details

  - ### stateChanged

    void stateChanged(Service service)
    Callback to notify of a state change. The service will already have changed state before this callback is invoked. This operation is invoked on the thread that initiated the state change, while the service itself in in a sychronized section.
    1. Any long-lived operation here will prevent the service state change from completing in a timely manner.
    2. If another thread is somehow invoked from the listener, and that thread invokes the methods of the service (including subclass-specific methods), there is a risk of a deadlock.
    Parameters:
      `service` - the service that has changed.