Esempio n. 1
0
 public RiakResult PbcWrite <TRequest>(TRequest request)
 {
     try
     {
         _socket.Write(request);
         return(RiakResult.Success());
     }
     catch (Exception ex)
     {
         Disconnect();
         return(RiakResult.Error(ResultCode.CommunicationError, ex.Message));
     }
 }
 public RiakResult PbcWrite <TRequest>(TRequest request)
     where TRequest : class
 {
     try
     {
         _socket.Write(request);
         return(RiakResult.Success());
     }
     catch (RiakException ex)
     {
         if (ex.NodeOffline)
         {
             Disconnect();
         }
         return(RiakResult.Error(ResultCode.CommunicationError, ex.Message, ex.NodeOffline));
     }
     catch (Exception ex)
     {
         Disconnect();
         return(RiakResult.Error(ResultCode.CommunicationError, ex.Message, true));
     }
 }
Esempio n. 3
0
 private async Task PbcWrite(RiakPbcSocket socket, MessageCode messageCode)
 {
     try
     {
         await socket.Write(messageCode).ConfigureAwait(false);
     }
     catch (RiakException ex)
     {
         if (ex.NodeOffline)
         {
             Disconnect(socket).ConfigureAwait(false).GetAwaiter().GetResult();
         }
         throw new RiakException((uint)ResultCode.CommunicationError, ex.Message, ex.NodeOffline);
     }
     catch (Exception ex)
     {
         Disconnect(socket).ConfigureAwait(false).GetAwaiter().GetResult();
         throw new RiakException((uint)ResultCode.CommunicationError, ex.Message, true);
     }
 }