Example #1
0
        internal ClientConductor(Aeron.Context ctx)
        {
            _ctx = ctx;

            _clientLock                     = ctx.ClientLock();
            _epochClock                     = ctx.EpochClock();
            _nanoClock                      = ctx.NanoClock();
            _errorHandler                   = ctx.ErrorHandler();
            _counterValuesBuffer            = ctx.CountersValuesBuffer();
            _driverProxy                    = ctx.DriverProxy();
            _logBuffersFactory              = ctx.LogBuffersFactory();
            _imageMapMode                   = ctx.ImageMapMode();
            _keepAliveIntervalNs            = ctx.KeepAliveInterval();
            _driverTimeoutMs                = ctx.DriverTimeoutMs();
            _driverTimeoutNs                = _driverTimeoutMs * 1000000;
            _interServiceTimeoutNs          = ctx.InterServiceTimeout();
            _publicationConnectionTimeoutMs = ctx.PublicationConnectionTimeout();
            _driverListener                 = new DriverListenerAdapter(ctx.ToClientBuffer(), this);
            _driverAgentInvoker             = ctx.DriverAgentInvoker();

            long nowNs = _nanoClock.NanoTime();

            _timeOfLastKeepaliveNs      = nowNs;
            _timeOfLastCheckResourcesNs = nowNs;
            _timeOfLastWorkNs           = nowNs;
        }
Example #2
0
        internal ClientConductor(Aeron.Context ctx)
        {
            _ctx = ctx;

            _clientLock = ctx.ClientLock();
            _epochClock = ctx.EpochClock();
            _nanoClock  = ctx.NanoClock();

            _driverProxy       = ctx.DriverProxy();
            _logBuffersFactory = ctx.LogBuffersFactory();

            _keepAliveIntervalNs            = ctx.KeepAliveInterval();
            _driverTimeoutMs                = ctx.DriverTimeoutMs();
            _driverTimeoutNs                = _driverTimeoutMs * 1000000;
            _interServiceTimeoutNs          = ctx.InterServiceTimeout();
            _defaultAvailableImageHandler   = ctx.AvailableImageHandler();
            _defaultUnavailableImageHandler = ctx.UnavailableImageHandler();
            _availableCounterHandler        = ctx.AvailableCounterHandler();
            _unavailableCounterHandler      = ctx.UnavailableCounterHandler();
            _driverEventsAdapter            = new DriverEventsAdapter(ctx.ToClientBuffer(), this);
            _counterValuesBuffer            = ctx.CountersValuesBuffer();
            _countersReader =
                new CountersReader(ctx.CountersMetaDataBuffer(), ctx.CountersValuesBuffer(), Encoding.ASCII);

            long nowNs = _nanoClock.NanoTime();

            _timeOfLastKeepAliveNs      = nowNs;
            _timeOfLastResourcesCheckNs = nowNs;
            _timeOfLastServiceNs        = nowNs;
        }
Example #3
0
        internal ClientConductor(Aeron.Context ctx)
        {
            _clientLock                     = ctx.ClientLock();
            _epochClock                     = ctx.EpochClock();
            _nanoClock                      = ctx.NanoClock();
            _errorHandler                   = ctx.ErrorHandler();
            _counterValuesBuffer            = ctx.CountersValuesBuffer();
            _driverProxy                    = ctx.DriverProxy();
            _logBuffersFactory              = ctx.LogBuffersFactory();
            _imageMapMode                   = ctx.ImageMapMode();
            _keepAliveIntervalNs            = ctx.KeepAliveInterval();
            _driverTimeoutMs                = ctx.DriverTimeoutMs();
            _driverTimeoutNs                = _driverTimeoutMs * 1000000;
            _interServiceTimeoutNs          = ctx.InterServiceTimeout();
            _publicationConnectionTimeoutMs = ctx.PublicationConnectionTimeout();
            _defaultAvailableImageHandler   = ctx.AvailableImageHandler();
            _defaultUnavailableImageHandler = ctx.UnavailableImageHandler();
            _driverEventsAdapter            = new DriverEventsAdapter(ctx.ToClientBuffer(), this);

            long nowNs = _nanoClock.NanoTime();

            _timeOfLastKeepAliveNs      = nowNs;
            _timeOfLastResourcesCheckNs = nowNs;
            _timeOfLastServiceNs        = nowNs;
        }
Example #4
0
        internal ClientConductor(
            IEpochClock epochClock,
            INanoClock nanoClock,
            CopyBroadcastReceiver broadcastReceiver,
            ILogBuffersFactory logBuffersFactory,
            UnsafeBuffer counterValuesBuffer,
            DriverProxy driverProxy,
            ErrorHandler errorHandler,
            AvailableImageHandler availableImageHandler,
            UnavailableImageHandler unavailableImageHandler,
            long keepAliveIntervalNs,
            long driverTimeoutMs,
            long interServiceTimeoutNs,
            long publicationConnectionTimeoutMs)
        {
            _epochClock                     = epochClock;
            _nanoClock                      = nanoClock;
            _timeOfLastKeepalive            = nanoClock.NanoTime();
            _timeOfLastCheckResources       = nanoClock.NanoTime();
            _timeOfLastWork                 = nanoClock.NanoTime();
            _errorHandler                   = errorHandler;
            _counterValuesBuffer            = counterValuesBuffer;
            _driverProxy                    = driverProxy;
            _logBuffersFactory              = logBuffersFactory;
            _availableImageHandler          = availableImageHandler;
            _unavailableImageHandler        = unavailableImageHandler;
            _keepAliveIntervalNs            = keepAliveIntervalNs;
            _driverTimeoutMs                = driverTimeoutMs;
            _driverTimeoutNs                = NanoUtil.FromMilliseconds(driverTimeoutMs);
            _interServiceTimeoutNs          = interServiceTimeoutNs;
            _publicationConnectionTimeoutMs = publicationConnectionTimeoutMs;

            _driverListener = new DriverListenerAdapter(broadcastReceiver, this);
        }
Example #5
0
        internal ClientConductor(Aeron.Context ctx, Aeron aeron)
        {
            _ctx   = ctx;
            _aeron = aeron;

            _clientLock                     = ctx.ClientLock();
            _epochClock                     = ctx.EpochClock();
            _nanoClock                      = ctx.NanoClock();
            _awaitingIdleStrategy           = ctx.AwaitingIdleStrategy();
            _driverProxy                    = ctx.DriverProxy();
            _logBuffersFactory              = ctx.LogBuffersFactory();
            _keepAliveIntervalNs            = ctx.KeepAliveIntervalNs();
            _driverTimeoutMs                = ctx.DriverTimeoutMs();
            _driverTimeoutNs                = _driverTimeoutMs * 1000000;
            _interServiceTimeoutNs          = ctx.InterServiceTimeoutNs();
            _defaultAvailableImageHandler   = ctx.AvailableImageHandler();
            _defaultUnavailableImageHandler = ctx.UnavailableImageHandler();
            _driverEventsAdapter            =
                new DriverEventsAdapter(ctx.ToClientBuffer(), ctx.ClientId(), this, _asyncCommandIdSet);
            _driverAgentInvoker  = ctx.DriverAgentInvoker();
            _counterValuesBuffer = ctx.CountersValuesBuffer();
            _countersReader      =
                new CountersReader(ctx.CountersMetaDataBuffer(), ctx.CountersValuesBuffer(), Encoding.ASCII);

            if (null != ctx.AvailableCounterHandler())
            {
                _availableCounterHandlers.Add(ctx.AvailableCounterHandler());
            }

            if (null != ctx.UnavailableCounterHandler())
            {
                _unavailableCounterHandlers.Add(ctx.UnavailableCounterHandler());
            }

            if (null != ctx.CloseHandler())
            {
                _closeHandlers.Add(ctx.CloseHandler());
            }

            long nowNs = _nanoClock.NanoTime();

            _timeOfLastKeepAliveNs = nowNs;
            _timeOfLastServiceNs   = nowNs;
        }