예제 #1
0
        public void WriteTimeoutException_Query_Message_Test()
        {
            var ex = new WriteTimeoutException(ConsistencyLevel.Quorum, 8, 10, "SIMPLE");

            StringAssert.Contains("Server timeout during write query at consistency QUORUM", ex.Message);
            StringAssert.Contains(" (8 peer(s) acknowledged the write over 10 required)", ex.Message);
        }
예제 #2
0
        public void WriteTimeoutException_BatchLog_Message_Test()
        {
            var ex = new WriteTimeoutException(ConsistencyLevel.LocalOne, 0, 1, "BATCH_LOG");

            StringAssert.Contains("Server timeout during batchlog write at consistency LOCALONE", ex.Message);
            StringAssert.Contains(" (0 peer(s) acknowledged the write over 1 required)", ex.Message);
        }
예제 #3
0
        private static void NotifyWriteTimeout(IoSession session, DateTime currentTime)
        {
            Int64 writeTimeout = session.Config.WriteTimeoutInMillis;

            if ((writeTimeout > 0) && ((currentTime - session.LastWriteTime).TotalMilliseconds >= writeTimeout) &&
                !session.WriteRequestQueue.IsEmpty(session))
            {
                IWriteRequest request = session.CurrentWriteRequest;
                if (request != null)
                {
                    session.CurrentWriteRequest = null;
                    WriteTimeoutException cause = new WriteTimeoutException(request);
                    request.Future.Exception = cause;
                    session.FilterChain.FireExceptionCaught(cause);
                    // WriteException is an IOException, so we close the session.
                    session.Close(true);
                }
            }
        }