Write() public abstract method

public abstract Write ( Stream stream ) : void
stream Stream
return void
 internal void WriteRaw(RedisMessage message)
 {
     if (message.Db >= 0)
     {
         throw new ArgumentException("message", "WriteRaw cannot be used with db-centric messages");
     }
     RecordSent(message);
     message.Write(outBuffer);
     Interlocked.Increment(ref messagesSent);
 }
        private void Outgoing()
        {
            try
            {
                OnOpened();
                int          db = 0;
                RedisMessage next;
                Trace.WriteLine("Redis send-pump is starting");
                bool isHigh, shouldFlush;
                while (unsent.TryDequeue(false, out next, out isHigh, out shouldFlush))
                {
                    if (abort)
                    {
                        CompleteMessage(next, RedisResult.Error("The system aborted before this message was sent"));
                        continue;
                    }
                    if (!next.ChangeState(MessageState.NotSent, MessageState.Sent))
                    {
                        // already cancelled; not our problem any more...
                        Interlocked.Increment(ref messagesCancelled);
                        continue;
                    }
                    if (isHigh)
                    {
                        Interlocked.Increment(ref queueJumpers);
                    }
                    WriteMessage(ref db, next, null);
                    Flush(shouldFlush);
                }
                Interlocked.CompareExchange(ref state, (int)ConnectionState.Closing, (int)ConnectionState.Open);
                if (redisStream != null)
                {
                    RedisMessage quit = RedisMessage.Create(-1, RedisLiteral.QUIT).ExpectOk().Critical();

                    RecordSent(quit, !abort);
                    quit.Write(outBuffer);
                    outBuffer.Flush();
                    redisStream.Flush();
                    Interlocked.Increment(ref messagesSent);
                }
                Trace.WriteLine("Redis send-pump is exiting");
            }
            catch (Exception ex)
            {
                OnError("Outgoing queue", ex, true);
            }
        }
Ejemplo n.º 3
0
 public override void Write(Stream stream)
 {
     innnerMessage.Write(stream);
 }