Beispiel #1
0
 public BlockLogBuffer(ChannelBuffer target, ByteCounterMonitor monitor)
 {
     if (!InstanceFieldsInitialized)
     {
         InitializeInstanceFields();
         InstanceFieldsInitialized = true;
     }
     this._target  = target;
     this._monitor = monitor;
     ClearInternalBuffer();
 }
Beispiel #2
0
 public Server(T requestTarget, Configuration config, LogProvider logProvider, int frameLength, ProtocolVersion protocolVersion, TxChecksumVerifier txVerifier, Clock clock, ByteCounterMonitor byteCounterMonitor, RequestMonitor requestMonitor)
 {
     this._requestTarget = requestTarget;
     this._config        = config;
     this._frameLength   = frameLength;
     this._applicationProtocolVersion = protocolVersion.ApplicationProtocol;
     this._logProvider            = logProvider;
     this._msgLog                 = this._logProvider.getLog(this.GetType());
     this._txVerifier             = txVerifier;
     this._byteCounterMonitor     = byteCounterMonitor;
     this._requestMonitor         = requestMonitor;
     this._connectedSlaveChannels = new IdleChannelReaper(this, logProvider, clock, config.OldChannelThreshold);
     this._chunkSize              = config.ChunkSize;
     assertChunkSizeIsWithinFrameSize(_chunkSize, frameLength);
 }
Beispiel #3
0
        public Client(string destinationHostNameOrIp, int destinationPort, string originHostNameOrIp, LogProvider logProvider, StoreId storeId, int frameLength, long readTimeout, int maxConcurrentChannels, int chunkSize, ResponseUnpacker responseUnpacker, ByteCounterMonitor byteCounterMonitor, RequestMonitor requestMonitor, LogEntryReader <ReadableClosablePositionAwareChannel> entryReader)
        {
            this._entryReader = entryReader;
            Debug.Assert(byteCounterMonitor != null);
            Debug.Assert(requestMonitor != null);

            this._byteCounterMonitor = byteCounterMonitor;
            this._requestMonitor     = requestMonitor;
            assertChunkSizeIsWithinFrameSize(chunkSize, frameLength);

            this._msgLog      = logProvider.getLog(this.GetType());
            this._storeId     = storeId;
            this._frameLength = frameLength;
            this._readTimeout = readTimeout;
            // ResourcePool no longer controls max concurrent channels. Use this value for the pool size
            this._maxUnusedChannels   = maxConcurrentChannels;
            this._comExceptionHandler = NoOpComExceptionHandler;

            if (destinationHostNameOrIp.Equals("0.0.0.0"))
            {
                // So it turns out that on Windows, connecting to 0.0.0.0 when specifying
                // an origin address will not succeed. But since we know we are
                // connecting to ourselves, and that we are listening on everything,
                // replacing with localhost is the proper thing to do.
                this._destination = new InetSocketAddress(LocalAddress, destinationPort);
            }
            else
            {
                // An explicit destination address is always correct
                this._destination = new InetSocketAddress(destinationHostNameOrIp, destinationPort);
            }

            if (string.ReferenceEquals(originHostNameOrIp, null) || originHostNameOrIp.Equals("0.0.0.0"))
            {
                _origin = null;
            }
            else
            {
                _origin = new InetSocketAddress(originHostNameOrIp, 0);
            }

            ProtocolVersion protocolVersion = ProtocolVersion;

            this._protocol         = CreateProtocol(chunkSize, protocolVersion.ApplicationProtocol);
            this._responseUnpacker = responseUnpacker;

            _msgLog.info(this.GetType().Name + " communication channel created towards " + _destination);
        }
Beispiel #4
0
 internal BackupClient(string destinationHostNameOrIp, int destinationPort, string originHostNameOrIp, LogProvider logProvider, StoreId storeId, long timeout, ResponseUnpacker unpacker, ByteCounterMonitor byteCounterMonitor, RequestMonitor requestMonitor, LogEntryReader <ReadableClosablePositionAwareChannel> reader) : base(destinationHostNameOrIp, destinationPort, originHostNameOrIp, logProvider, storeId, FRAME_LENGTH, timeout, Client.DEFAULT_MAX_NUMBER_OF_CONCURRENT_CHANNELS_PER_CLIENT, FRAME_LENGTH, unpacker, byteCounterMonitor, requestMonitor, reader)
 {
 }
Beispiel #5
0
 public SlaveClient(InstanceId machineId, string destinationHostNameOrIp, int destinationPort, string originHostNameOrIp, LogProvider logProvider, StoreId storeId, int maxConcurrentChannels, int chunkSize, ByteCounterMonitor byteCounterMonitor, RequestMonitor requestMonitor, LogEntryReader <ReadableClosablePositionAwareChannel> entryReader) : base(destinationHostNameOrIp, destinationPort, originHostNameOrIp, logProvider, storeId, Protocol.DEFAULT_FRAME_LENGTH, HaSettings.read_timeout.apply(from->null).toMillis(), maxConcurrentChannels, chunkSize, NO_OP_RESPONSE_UNPACKER, byteCounterMonitor, requestMonitor, entryReader)