From f83677056891e436bf5ba99e79240df2a44528cd Mon Sep 17 00:00:00 2001 From: "Stephen D. Huston" Date: Fri, 21 Oct 2011 14:42:12 +0000 Subject: Merged out from trunk git-svn-id: https://svn.apache.org/repos/asf/qpid/branches/QPID-2519@1187375 13f79535-47bb-0310-9956-ffa450edef68 --- .../Qpid.Client/Client/Protocol/ProtocolWriter.cs | 107 --------------------- 1 file changed, 107 deletions(-) delete mode 100644 dotnet/Qpid.Client/Client/Protocol/ProtocolWriter.cs (limited to 'dotnet/Qpid.Client/Client/Protocol/ProtocolWriter.cs') diff --git a/dotnet/Qpid.Client/Client/Protocol/ProtocolWriter.cs b/dotnet/Qpid.Client/Client/Protocol/ProtocolWriter.cs deleted file mode 100644 index 11918f1ea2..0000000000 --- a/dotnet/Qpid.Client/Client/Protocol/ProtocolWriter.cs +++ /dev/null @@ -1,107 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -using System; -using Apache.Qpid.Client.Protocol.Listener; -using Apache.Qpid.Client.Transport; -using Apache.Qpid.Framing; - -using log4net; - -namespace Apache.Qpid.Client.Protocol -{ - /// - /// A convenient interface to writing protocol frames. - /// - public class ProtocolWriter - { - - private ILog _logger = LogManager.GetLogger(typeof(ProtocolWriter)); - - IProtocolWriter _protocolWriter; - IProtocolListener _protocolListener; - - public ProtocolWriter(IProtocolWriter protocolWriter, IProtocolListener protocolListener) - { - _protocolWriter = protocolWriter; - _protocolListener = protocolListener; - } - - public void WriteFrame(IDataBlock frame) - { - _protocolWriter.Write(frame); - } - - /// - /// Convenience method that writes a frame to the protocol session and waits for - /// a particular response. Equivalent to calling getProtocolSession().write() then - /// waiting for the response. - /// - /// the frame - /// the blocking listener. Note the calling thread will block. - /// set the number of milliseconds to wait - private AMQMethodEvent SyncWrite(AMQFrame frame, BlockingMethodFrameListener listener, int timeout) - { - try - { - _protocolListener.AddFrameListener(listener); - _protocolWriter.Write(frame); - - return listener.BlockForFrame(timeout); - } - finally - { - _protocolListener.RemoveFrameListener(listener); - } - // When control resumes before this line, a reply will have been received - // that matches the criteria defined in the blocking listener - } - - /// - /// Convenience method that writes a frame to the protocol session and waits for - /// a particular response. Equivalent to calling getProtocolSession().write() then - /// waiting for the response. - /// - /// the frame - /// the type of method response - public AMQMethodEvent SyncWrite(AMQFrame frame, Type responseType) - { - // TODO: If each frame knew it's response type, then the responseType argument would - // TODO: not be neccesary. - return SyncWrite(frame, responseType, DefaultTimeouts.MaxWaitForSyncWriter); - } - - /// - /// Convenience method that writes a frame to the protocol session and waits for - /// a particular response. Equivalent to calling getProtocolSession().write() then - /// waiting for the response. - /// - /// the frame - /// the type of method response - /// set the number of milliseconds to wait - /// set the number of milliseconds to wait - public AMQMethodEvent SyncWrite(AMQFrame frame, Type responseType, int timeout) - { - return SyncWrite(frame, new SpecificMethodFrameListener(frame.Channel, responseType), timeout); - } - } -} - - -- cgit v1.2.1