Ed Kramer
2005-04-14 20:23:45 UTC
I figured I would test to make sure that it's not some sort of weird remoting
voodoo ( since I am remoting in the above app ) and thus wrote a quick test
app. All the test app does is attach to a queue ( or create a queue if it
doesn't exit ), once set up it calls .BeginPeek() as above. There is
additional functionality added to allow me to toss a message into the queue
and retreive it but that's all she wrote. Nothing fancy there...
It's basically just...
queue.PeekCompleted+= new PeekCompletedEventHandler( queue_PeekCompleted);
queue.BeginPeek( timeout );
private void queue_PeekCompleted(object sender, PeekCompletedEventArgs e)
{
try
{
Console.Write("Taking a peek...");
queue.EndPeek( e.AsyncResult );
}
catch( MessageQueueException ex )
{
if ( ex.MessageQueueErrorCode == MessageQueueErrorCode.IOTimeout )
{
Console.WriteLine("Peek timeout");
}
}
finally
{
if ( ! this.queueShutdown )
queue.BeginPeek( PEEK_TIMEOUT, e.AsyncResult.AsyncState );
else
KillQueue( );
}
}
In the last hour the BeginPeek() has leaked 2,664 message objects and 2,673
ManualResetEvents.
voodoo ( since I am remoting in the above app ) and thus wrote a quick test
app. All the test app does is attach to a queue ( or create a queue if it
doesn't exit ), once set up it calls .BeginPeek() as above. There is
additional functionality added to allow me to toss a message into the queue
and retreive it but that's all she wrote. Nothing fancy there...
It's basically just...
queue.PeekCompleted+= new PeekCompletedEventHandler( queue_PeekCompleted);
queue.BeginPeek( timeout );
private void queue_PeekCompleted(object sender, PeekCompletedEventArgs e)
{
try
{
Console.Write("Taking a peek...");
queue.EndPeek( e.AsyncResult );
}
catch( MessageQueueException ex )
{
if ( ex.MessageQueueErrorCode == MessageQueueErrorCode.IOTimeout )
{
Console.WriteLine("Peek timeout");
}
}
finally
{
if ( ! this.queueShutdown )
queue.BeginPeek( PEEK_TIMEOUT, e.AsyncResult.AsyncState );
else
KillQueue( );
}
}
In the last hour the BeginPeek() has leaked 2,664 message objects and 2,673
ManualResetEvents.