aeron-client/src/main/java/io/aeron/CommonContext.java
public static boolean isDriverActive(
        final long driverTimeoutMs, final Consumer<String> logger, final ByteBuffer cncByteBuffer)
    {
        if (null == cncByteBuffer)
        {
            return false;
        }

        final UnsafeBuffer cncMetaDataBuffer = CncFileDescriptor.createMetaDataBuffer(cncByteBuffer);

        final long startTimeMs = System.currentTimeMillis();
        int cncVersion;
        while (0 == (cncVersion = cncMetaDataBuffer.getIntVolatile(CncFileDescriptor.cncVersionOffset(0))))
        {
            if (System.currentTimeMillis() > (startTimeMs + driverTimeoutMs))
            {
                throw new DriverTimeoutException("CnC file is created but not initialised.");
            }

            sleep(1);
        }

        if (CNC_VERSION != cncVersion)
        {
            throw new AeronException(
                "Aeron CnC version does not match: required=" + CNC_VERSION + " version=" + cncVersion);
        }

        final ManyToOneRingBuffer toDriverBuffer = new ManyToOneRingBuffer(
            CncFileDescriptor.createToDriverBuffer(cncByteBuffer, cncMetaDataBuffer));

        final long timestamp = toDriverBuffer.consumerHeartbeatTime();
        final long now = System.currentTimeMillis();
        final long timestampAge = now - timestamp;

        logger.accept("INFO: Aeron toDriver consumer heartbeat is (ms): " + timestampAge);

        return timestampAge <= driverTimeoutMs;
    }
public static boolean isDriverActive(
        final long driverTimeoutMs, final Consumer<String> logger, final ByteBuffer cncByteBuffer)
    {
        if (null == cncByteBuffer)
        {
            return false;
        }

        final UnsafeBuffer cncMetaDataBuffer = CncFileDescriptor.createMetaDataBuffer(cncByteBuffer);

        final long startTimeMs = System.currentTimeMillis();
        int cncVersion;
        while (0 == (cncVersion = cncMetaDataBuffer.getIntVolatile(CncFileDescriptor.cncVersionOffset(0))))
        {
            if (System.currentTimeMillis() > (startTimeMs + driverTimeoutMs))
            {
                throw new DriverTimeoutException("CnC file is created but not initialised.");
            }

            sleep(1);
        }

        if (CNC_VERSION != cncVersion)
        {
            throw new AeronException(
                "Aeron CnC version does not match: required=" + CNC_VERSION + " version=" + cncVersion);
        }

        final ManyToOneRingBuffer toDriverBuffer = new ManyToOneRingBuffer(
            CncFileDescriptor.createToDriverBuffer(cncByteBuffer, cncMetaDataBuffer));

        final long timestamp = toDriverBuffer.consumerHeartbeatTime();
        final long now = System.currentTimeMillis();
        final long timestampAge = now - timestamp;

        logger.accept("INFO: Aeron toDriver consumer heartbeat is (ms): " + timestampAge);

        return timestampAge <= driverTimeoutMs;
    }
public static boolean isDriverActive ( final long driverTimeoutMs , final Consumer < String > logger , final ByteBuffer cncByteBuffer ) { if ( null == cncByteBuffer ) { return false ; } final UnsafeBuffer cncMetaDataBuffer = CncFileDescriptor . createMetaDataBuffer ( cncByteBuffer ) ; final long startTimeMs = System . currentTimeMillis ( ) ; int cncVersion ; while ( 0 == ( cncVersion = cncMetaDataBuffer . getIntVolatile ( CncFileDescriptor . cncVersionOffset ( 0 ) ) ) ) { if ( System . currentTimeMillis ( ) > ( startTimeMs + driverTimeoutMs ) ) { throw new DriverTimeoutException ( "CnC file is created but not initialised." ) ; } sleep ( 1 ) ; } if ( CNC_VERSION != cncVersion ) { throw new AeronException ( "Aeron CnC version does not match: required=" + CNC_VERSION + " version=" + cncVersion ) ; } final ManyToOneRingBuffer toDriverBuffer = new ManyToOneRingBuffer ( CncFileDescriptor . createToDriverBuffer ( cncByteBuffer , cncMetaDataBuffer ) ) ; final long timestamp = toDriverBuffer . consumerHeartbeatTime ( ) ; final long now = System . currentTimeMillis ( ) ; final long timestampAge = now - timestamp ; logger . accept ( "INFO: Aeron toDriver consumer heartbeat is (ms): " + timestampAge ) ; return timestampAge <= driverTimeoutMs ; }
Is a media driver active in the current mapped CnC buffer? If the driver is mid start then it will wait for
up to the driverTimeoutMs by checking for the cncVersion being set.

@param driverTimeoutMs for the driver liveness check.
@param logger          for feedback as liveness checked.
@param cncByteBuffer   for the existing CnC file.
@return true if a driver is active or false if not.
Is a media driver active in the current mapped CnC buffer? If the driver is mid start then it will wait for up to the driverTimeoutMs by checking for the cncVersion being set .