aeron-archive/src/main/java/io/aeron/archive/client/AeronArchive.java
public static AsyncConnect asyncConnect(final Context ctx)
    {
        Subscription subscription = null;
        Publication publication = null;
        try
        {
            ctx.conclude();

            final Aeron aeron = ctx.aeron();
            final long messageTimeoutNs = ctx.messageTimeoutNs();
            final long deadlineNs = aeron.context().nanoClock().nanoTime() + messageTimeoutNs;

            subscription = aeron.addSubscription(ctx.controlResponseChannel(), ctx.controlResponseStreamId());
            final ControlResponsePoller controlResponsePoller = new ControlResponsePoller(subscription);

            publication = aeron.addExclusivePublication(ctx.controlRequestChannel(), ctx.controlRequestStreamId());
            final ArchiveProxy archiveProxy = new ArchiveProxy(
                publication, ctx.idleStrategy(), aeron.context().nanoClock(), messageTimeoutNs, DEFAULT_RETRY_ATTEMPTS);

            return new AsyncConnect(ctx, controlResponsePoller, archiveProxy, deadlineNs);
        }
        catch (final Exception ex)
        {
            if (!ctx.ownsAeronClient())
            {
                CloseHelper.quietClose(subscription);
                CloseHelper.quietClose(publication);
            }

            ctx.close();

            throw ex;
        }
    }
public static AsyncConnect asyncConnect(final Context ctx)
    {
        Subscription subscription = null;
        Publication publication = null;
        try
        {
            ctx.conclude();

            final Aeron aeron = ctx.aeron();
            final long messageTimeoutNs = ctx.messageTimeoutNs();
            final long deadlineNs = aeron.context().nanoClock().nanoTime() + messageTimeoutNs;

            subscription = aeron.addSubscription(ctx.controlResponseChannel(), ctx.controlResponseStreamId());
            final ControlResponsePoller controlResponsePoller = new ControlResponsePoller(subscription);

            publication = aeron.addExclusivePublication(ctx.controlRequestChannel(), ctx.controlRequestStreamId());
            final ArchiveProxy archiveProxy = new ArchiveProxy(
                publication, ctx.idleStrategy(), aeron.context().nanoClock(), messageTimeoutNs, DEFAULT_RETRY_ATTEMPTS);

            return new AsyncConnect(ctx, controlResponsePoller, archiveProxy, deadlineNs);
        }
        catch (final Exception ex)
        {
            if (!ctx.ownsAeronClient())
            {
                CloseHelper.quietClose(subscription);
                CloseHelper.quietClose(publication);
            }

            ctx.close();

            throw ex;
        }
    }
public static AsyncConnect asyncConnect ( final Context ctx ) { Subscription subscription = null ; Publication publication = null ; try { ctx . conclude ( ) ; final Aeron aeron = ctx . aeron ( ) ; final long messageTimeoutNs = ctx . messageTimeoutNs ( ) ; final long deadlineNs = aeron . context ( ) . nanoClock ( ) . nanoTime ( ) + messageTimeoutNs ; subscription = aeron . addSubscription ( ctx . controlResponseChannel ( ) , ctx . controlResponseStreamId ( ) ) ; final ControlResponsePoller controlResponsePoller = new ControlResponsePoller ( subscription ) ; publication = aeron . addExclusivePublication ( ctx . controlRequestChannel ( ) , ctx . controlRequestStreamId ( ) ) ; final ArchiveProxy archiveProxy = new ArchiveProxy ( publication , ctx . idleStrategy ( ) , aeron . context ( ) . nanoClock ( ) , messageTimeoutNs , DEFAULT_RETRY_ATTEMPTS ) ; return new AsyncConnect ( ctx , controlResponsePoller , archiveProxy , deadlineNs ) ; } catch ( final Exception ex ) { if ( ! ctx . ownsAeronClient ( ) ) { CloseHelper . quietClose ( subscription ) ; CloseHelper . quietClose ( publication ) ; } ctx . close ( ) ; throw ex ; } }
Begin an attempt at creating a connection which can be completed by calling {@link AsyncConnect#poll()} until
it returns the client, before complete it will return null.

@param ctx for the archive connection.
@return the {@link AsyncConnect} that can be polled for completion.
Begin an attempt at creating a connection which can be completed by calling { @link AsyncConnect#poll () } until it returns the client before complete it will return null .