Class DestroyedState

  • All Implemented Interfaces:
    com.inmobi.media.ads.common.base.state.State

    
    public final class DestroyedState
     implements State
                        

    Represents the final state when an ad unit manager has been destroyed and is cleaning up resources.

    This state is the terminal state in the ad unit manager lifecycle. It handles the destruction of all associated components including the AdUnit, AdUnitTimeoutManager, and IAdManagerComponent. The cleanup process is performed asynchronously and ensures proper resource deallocation and coroutine scope cancellation to prevent memory leaks.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      Unit initialize() Initializes the destroyed state and performs cleanup operations.
      • Methods inherited from class com.inmobi.media.ads.common.base.state.State

        cleanUp
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • initialize

         Unit initialize()

        Initializes the destroyed state and performs cleanup operations.

        This method orchestrates the destruction process by:

        • Destroying the timeout manager to cancel any pending timeouts

        • Destroying the ad unit to release ad-specific resources

        • Finishing the logger to flush any pending logs

        • Cancelling the ad manager scope to stop all coroutines

        • Nullifying all references to prevent memory leaks

        The cleanup is performed asynchronously to avoid blocking the main thread.