Skip to content

Commit d6c4b84

Browse files
author
Matthias Radestock
committed
do not implement IDisposable
Dequeue operations are permitted (and in many cases very much necessary) after Close() until the queue is drained. Since Dispose() calls Close() (and what else would it do?), we would be left with an object that has been disposed but must still be useable. While there is nothing technically stopping that from happening, it constitutes a departure from the intent of IDisposable.
1 parent 3c18c7d commit d6c4b84

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

src/util/SharedQueue.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161

6262
namespace RabbitMQ.Util {
6363
///<summary>A thread-safe shared queue implementation.</summary>
64-
public class SharedQueue: IDisposable {
64+
public class SharedQueue {
6565
///<summary>The shared queue.</summary>
6666
///<remarks>
6767
///Subclasses must ensure appropriate locking discipline when
@@ -88,12 +88,6 @@ public void Close() {
8888
}
8989
}
9090

91-
///<summary>Implement IDisposable.Dispose. Delegates directly
92-
///to Close().</summary>
93-
public void Dispose() {
94-
Close();
95-
}
96-
9791
///<summary>Call only when the lock on m_queue is held.</summary>
9892
/// <exception cref="EndOfStreamException" />
9993
private void EnsureIsOpen() {

0 commit comments

Comments
 (0)