当前位置: 首页>>代码示例>>C#>>正文


C# BasicStream.writeBlob方法代码示例

本文整理汇总了C#中IceInternal.BasicStream.writeBlob方法的典型用法代码示例。如果您正苦于以下问题:C# BasicStream.writeBlob方法的具体用法?C# BasicStream.writeBlob怎么用?C# BasicStream.writeBlob使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IceInternal.BasicStream的用法示例。


在下文中一共展示了BasicStream.writeBlob方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BatchRequestQueue

        public BatchRequestQueue(Instance instance, bool datagram)
        {
            Ice.InitializationData initData = instance.initializationData();
            _interceptor = initData.batchRequestInterceptor;
            _batchStreamInUse = false;
            _batchRequestNum = 0;
            _batchStream = new BasicStream(instance, Ice.Util.currentProtocolEncoding);
            _batchStream.writeBlob(Protocol.requestBatchHdr);
            _batchMarker = _batchStream.size();
            _request = new BatchRequestI(this);

            _maxSize = instance.batchAutoFlushSize();
            if(_maxSize > 0 && datagram)
            {
                int udpSndSize = initData.properties.getPropertyAsIntWithDefault("Ice.UDP.SndSize",
                                                                                 65535 - _udpOverhead);
                if(udpSndSize < _maxSize)
                {
                    _maxSize = udpSndSize;
                }
            }
        }
开发者ID:joshmoore,项目名称:ice,代码行数:22,代码来源:BatchRequestQueue.cs

示例2: flushRequests

        private void flushRequests()
        {
            _m.Lock();
            try
            {
                Debug.Assert(_connection != null && !_initialized);

                while(_batchRequestInProgress)
                {
                    _m.Wait();
                }

                //
                // We set the _flushing flag to true to prevent any additional queuing. Callers
                // might block for a little while as the queued requests are being sent but this
                // shouldn't be an issue as the request sends are non-blocking.
                //
                _flushing = true;
            }
            finally
            {
                _m.Unlock();
            }

            LinkedList<Request> sentCallbacks = new LinkedList<Request>();
            try
            {
                LinkedListNode<Request> p = _requests.First; // _requests is immutable when _flushing = true
                while(p != null)
                {
                    Request request = p.Value;
                    if([email protected] != null)
                    {
                        if(_connection.sendAsyncRequest([email protected], _compress, _response, out request.sentCallback))
                        {
                            if(request.sentCallback != null)
                            {
                                sentCallbacks.AddLast(request);
                            }
                        }
                    }
                    else if(request.batchOut != null)
                    {
                        if(_connection.flushAsyncBatchRequests(request.batchOut, out request.sentCallback))
                        {
                            if(request.sentCallback != null)
                            {
                                sentCallbacks.AddLast(request);
                            }
                        }
                    }
                    else
                    {
                        BasicStream os = new BasicStream(request.os.instance());
                        _connection.prepareBatchRequest(os);
                        try
                        {
                            request.os.pos(0);
                            os.writeBlob(request.os.readBlob(request.os.size()));
                        }
                        catch(Ice.LocalException)
                        {
                            _connection.abortBatchRequest();
                            throw;
                        }
                        _connection.finishBatchRequest(os, _compress);
                    }
                    LinkedListNode<Request> tmp = p;
                    p = p.Next;
                    _requests.Remove(tmp);
                }
            }
            catch(LocalExceptionWrapper ex)
            {
                _m.Lock();
                try
                {
                    Debug.Assert(_exception == null && _requests.Count > 0);
                    _exception = ex.get();
                    _reference.getInstance().clientThreadPool().dispatch(delegate()
                                                                        {
                                                                            flushRequestsWithException(ex);
                                                                        });
                }
                finally
                {
                    _m.Unlock();
                }
            }
            catch(Ice.LocalException ex)
            {
                _m.Lock();
                try
                {
                    Debug.Assert(_exception == null && _requests.Count > 0);
                    _exception = ex;
                    _reference.getInstance().clientThreadPool().dispatch(delegate()
                                                                        {
                                                                            flushRequestsWithException(ex);
                                                                        });
//.........这里部分代码省略.........
开发者ID:bholl,项目名称:zeroc-ice,代码行数:101,代码来源:ConnectRequestHandler.cs

示例3: streamWrite

 //
 // Marshal the endpoint
 //
 public override void streamWrite(BasicStream s)
 {
     s.startWriteEncaps(_rawEncoding, Ice.FormatType.DefaultFormat);
     s.writeBlob(_rawBytes);
     s.endWriteEncaps();
 }
开发者ID:pedia,项目名称:zeroc-ice,代码行数:9,代码来源:OpaqueEndpointI.cs

示例4: flushRequests

        private void flushRequests()
        {
            lock(this)
            {
                Debug.Assert(_connection != null && !_initialized);

                while(_batchRequestInProgress)
                {
                    System.Threading.Monitor.Wait(this);
                }

                //
                // We set the _flushing flag to true to prevent any additional queuing. Callers
                // might block for a little while as the queued requests are being sent but this
                // shouldn't be an issue as the request sends are non-blocking.
                //
                _flushing = true;
            }

            LinkedListNode<Request> p = _requests.First; // _requests is immutable when _flushing = true
            Ice.LocalException exception = null;
            while(p != null)
            {
                Request request = p.Value;
                try
                {
                    if(request.os != null)
                    {
                        BasicStream os = new BasicStream(request.os.instance(), Ice.Util.currentProtocolEncoding);
                        _connection.prepareBatchRequest(os);
                        try
                        {
                            request.os.pos(0);
                            os.writeBlob(request.os.readBlob(request.os.size()));
                        }
                        catch(Ice.LocalException)
                        {
                            _connection.abortBatchRequest();
                            throw;
                        }
                        _connection.finishBatchRequest(os, _compress);
                    }
                    else if(request.outAsync.send(_connection, _compress, _response, out request.sentCallback))
                    {
                        if(request.sentCallback != null)
                        {
                            request.outAsync.invokeSentAsync(request.sentCallback);
                        }
                    }
                }
                catch(RetryException ex)
                {
                    exception = ex.get();
                    try
                    {
                        // Remove the request handler before retrying.
                        _reference.getInstance().requestHandlerFactory().removeRequestHandler(_reference, this);
                    }
                    catch(Ice.CommunicatorDestroyedException)
                    {
                        // Ignore
                    }
                    request.outAsync.retryException(ex.get());
                }
                catch(Ice.LocalException ex)
                {
                    exception = ex;
                    Ice.AsyncCallback cb = request.outAsync.completed(ex);
                    if(cb != null)
                    {
                        request.outAsync.invokeCompletedAsync(cb);
                    }
                }
                LinkedListNode<Request> tmp = p;
                p = p.Next;
                _requests.Remove(tmp);
            }

            //
            // If we aren't caching the connection, don't bother creating a
            // connection request handler. Otherwise, update the proxies
            // request handler to use the more efficient connection request
            // handler.
            //
            if(_reference.getCacheConnection() && exception == null)
            {
                _connectionRequestHandler = new ConnectionRequestHandler(_reference, _connection, _compress);
                foreach(Ice.ObjectPrxHelperBase prx in _proxies)
                {
                    prx.setRequestHandler__(this, _connectionRequestHandler);
                }
            }

            lock(this)
            {
                Debug.Assert(!_initialized);
                _exception = exception;
                _initialized = _exception == null;
                _flushing = false;
                try
//.........这里部分代码省略.........
开发者ID:pedia,项目名称:zeroc-ice,代码行数:101,代码来源:ConnectRequestHandler.cs

示例5: streamWrite

 //
 // Marshal the endpoint
 //
 public override void streamWrite(BasicStream s)
 {
     s.writeShort(_type);
     s.startWriteEncaps();
     s.writeBlob(_rawBytes);
     s.endWriteEncaps();
 }
开发者ID:bholl,项目名称:zeroc-ice,代码行数:10,代码来源:OpaqueEndpointI.cs


注:本文中的IceInternal.BasicStream.writeBlob方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。