Skip to content
Permalink
Browse files
https://issues.apache.org/activemq/browse/AMQNET-254
Some enhancements and fixes for Failover processing and shutdown.
  • Loading branch information
Timothy A. Bish committed Jul 8, 2010
1 parent f8e4fc2 commit 63ed4451d609fb628509848adbca6d7e062a33af
Showing 3 changed files with 14 additions and 23 deletions.
@@ -18,6 +18,8 @@
using System;
using System.Collections;

using Apache.NMS.Stomp.State;

namespace Apache.NMS.Stomp.Commands
{
public class ShutdownInfo : BaseCommand
@@ -57,6 +59,11 @@ public override bool IsShutdownInfo
}
}

public override Response visit(ICommandVisitor visitor)
{
return visitor.processShutdownInfo( this );
}

};
}

@@ -470,8 +470,13 @@ public void Oneway(Command command)
// Release so that the reconnect task can run
try
{
// Wait for something
ThreadUtil.MonitorWait(reconnectMutex, 1000);
// This is a bit of a hack, what should be happening is that when
// there's a reconnect the reconnectTask should signal the Monitor
// or some other event object to indicate that we can wakeup right
// away here, instead of performing the full wait.
Monitor.Exit(reconnectMutex);
Thread.Sleep(100);
Monitor.Enter(reconnectMutex);
}
catch(Exception e)
{
@@ -22,27 +22,6 @@ namespace Apache.NMS.Stomp.Util
{
public class ThreadUtil
{
public static bool MonitorWait(Mutex mutex, int timeout)
{
#if NETCF
int waitTime = 0;
bool acquiredLock = false;

// Release so that the reconnect task can run
Monitor.Exit(mutex);
// Wait for something
while(!(acquiredLock = Monitor.TryEnter(mutex)) && waitTime < timeout)
{
Thread.Sleep(1);
waitTime++;
}

return acquiredLock;
#else
return Monitor.Wait(mutex, timeout);
#endif
}

public static void DisposeTimer(Timer timer, int timeout)
{
#if NETCF

0 comments on commit 63ed445

Please sign in to comment.