Return-Path: Delivered-To: apmail-geronimo-activemq-commits-archive@www.apache.org Received: (qmail 83489 invoked from network); 19 Oct 2006 05:44:31 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 19 Oct 2006 05:44:31 -0000 Received: (qmail 7195 invoked by uid 500); 19 Oct 2006 05:44:31 -0000 Delivered-To: apmail-geronimo-activemq-commits-archive@geronimo.apache.org Received: (qmail 7151 invoked by uid 500); 19 Oct 2006 05:44:31 -0000 Mailing-List: contact activemq-commits-help@geronimo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: activemq-dev@geronimo.apache.org Delivered-To: mailing list activemq-commits@geronimo.apache.org Received: (qmail 7141 invoked by uid 99); 19 Oct 2006 05:44:31 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 18 Oct 2006 22:44:31 -0700 X-ASF-Spam-Status: No, hits=-9.2 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME,PORN_URL_SEX X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [140.211.166.113] (HELO eris.apache.org) (140.211.166.113) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 18 Oct 2006 22:44:28 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id E91571A981A; Wed, 18 Oct 2006 22:44:07 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: svn commit: r465501 - in /incubator/activemq/activemq-dotnet/trunk: ./ src/main/csharp/ActiveMQ/ src/main/csharp/ActiveMQ/Transport/ src/main/csharp/ActiveMQ/Util/ src/test/csharp/MSMQ/ Date: Thu, 19 Oct 2006 05:44:07 -0000 To: activemq-commits@geronimo.apache.org From: chirino@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20061019054407.E91571A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: chirino Date: Wed Oct 18 22:44:03 2006 New Revision: 465501 URL: http://svn.apache.org/viewvc?view=rev&rev=465501 Log: Adding vs2005 project files for the .NET Compact Framework part of patch in http://issues.apache.org/activemq/browse/AMQ-969 Thanks Oleg! Also modified all our uses of the Monitor.Wait and Monitor.PulseAll so that it uses AutoResetEvent and ManaualResetEvent objects instead so that we are compatible with the Compact Framework.. All that's left is to figure out how to unit test under the Conpact Framework. Added: incubator/activemq/activemq-dotnet/trunk/src/test/csharp/MSMQ/CommonAssemblyInfo.cs incubator/activemq/activemq-dotnet/trunk/vs2005-activemq-cf20.csproj incubator/activemq/activemq-dotnet/trunk/vs2005-nms-cf20.csproj Modified: incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Dispatcher.cs incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Transport/FutureResponse.cs incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Transport/WireFormatNegotiator.cs incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Util/CountDownLatch.cs incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Util/URISupport.cs incubator/activemq/activemq-dotnet/trunk/vs2005.sln Modified: incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Dispatcher.cs URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Dispatcher.cs?view=diff&rev=465501&r1=465500&r2=465501 ============================================================================== --- incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Dispatcher.cs (original) +++ incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Dispatcher.cs Wed Oct 18 22:44:03 2006 @@ -31,6 +31,7 @@ Queue queue = new Queue(); Object semaphore = new Object(); ArrayList messagesToRedeliver = new ArrayList(); + readonly AutoResetEvent resetEvent = new AutoResetEvent(false); /// /// Whem we start a transaction we must redeliver any rolled back messages @@ -52,7 +53,8 @@ replacement.Enqueue(element); } queue = replacement; - Monitor.PulseAll(semaphore); + if (queue.Count > 0) + resetEvent.Set(); } } @@ -75,7 +77,7 @@ lock (semaphore) { queue.Enqueue(message); - Monitor.PulseAll(semaphore); + resetEvent.Set(); } } @@ -84,33 +86,36 @@ /// public IMessage DequeueNoWait() { + IMessage rc = null; lock (semaphore) { if (queue.Count > 0) { - return (IMessage) queue.Dequeue(); - } + rc = (IMessage) queue.Dequeue(); + if (queue.Count > 0) + { + resetEvent.Set(); + } + } } - return null; + return rc; } - + /// /// Method Dequeue /// public IMessage Dequeue(TimeSpan timeout) { - lock (semaphore) + IMessage rc = DequeueNoWait(); + while (rc == null) { - if (queue.Count == 0) - { - Monitor.Wait(semaphore, timeout); - } - if (queue.Count > 0) + if( !resetEvent.WaitOne((int)timeout.TotalMilliseconds, false) ) { - return (IMessage) queue.Dequeue(); + break; } + rc = DequeueNoWait(); } - return null; + return rc; } /// @@ -118,10 +123,16 @@ /// public IMessage Dequeue() { - lock (semaphore) + IMessage rc = DequeueNoWait(); + while (rc == null) { - return (IMessage) queue.Dequeue(); + if (!resetEvent.WaitOne(-1, false)) + { + break; + } + rc = DequeueNoWait(); } + return rc; } } Modified: incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Transport/FutureResponse.cs URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Transport/FutureResponse.cs?view=diff&rev=465501&r1=465500&r2=465501 ============================================================================== --- incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Transport/FutureResponse.cs (original) +++ incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Transport/FutureResponse.cs Wed Oct 18 22:44:03 2006 @@ -17,6 +17,7 @@ using ActiveMQ.Commands; using System; using System.Threading; +using ActiveMQ.Util; namespace ActiveMQ.Transport { @@ -24,35 +25,18 @@ /// /// Handles asynchronous responses /// - public class FutureResponse : IAsyncResult + public class FutureResponse { - + + private static int maxWait = -1; + + private readonly CountDownLatch latch = new CountDownLatch(1); private Response response; - private Mutex asyncWaitHandle = new Mutex(); - private Object semaphore = new Object(); - private int maxWait = 3000; - private bool isCompleted; public WaitHandle AsyncWaitHandle { - get { return asyncWaitHandle; } - } - - public object AsyncState - { - get { return response; } - set { Response = (Response) value; } - } - - public bool IsCompleted - { - get { return isCompleted; } - } - - public bool CompletedSynchronously - { - get { return false; } - } + get { return latch.AsyncWaitHandle; } + } public Response Response { @@ -62,25 +46,25 @@ { try { - lock (semaphore) - { - Monitor.Wait(semaphore, maxWait); - } + latch.await(maxWait); } catch (Exception e) { Tracer.Error("Caught while waiting on monitor: " + e); } } - return response; + lock (latch) + { + return response; + } } + set { - lock (semaphore) + lock (latch) { response = value; - isCompleted = true; - Monitor.PulseAll(semaphore); } + latch.countDown(); } } } Modified: incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Transport/WireFormatNegotiator.cs URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Transport/WireFormatNegotiator.cs?view=diff&rev=465501&r1=465500&r2=465501 ============================================================================== --- incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Transport/WireFormatNegotiator.cs (original) +++ incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Transport/WireFormatNegotiator.cs Wed Oct 18 22:44:03 2006 @@ -31,7 +31,7 @@ public class WireFormatNegotiator : TransportFilter { private OpenWireFormat wireFormat; - private TimeSpan negotiateTimeout=new TimeSpan(0,0,15); + private int negotiateTimeout=15000; private AtomicBoolean firstStart=new AtomicBoolean(true); private CountDownLatch readyCountDownLatch = new CountDownLatch(1); Modified: incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Util/CountDownLatch.cs URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Util/CountDownLatch.cs?view=diff&rev=465501&r1=465500&r2=465501 ============================================================================== --- incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Util/CountDownLatch.cs (original) +++ incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Util/CountDownLatch.cs Wed Oct 18 22:44:03 2006 @@ -15,14 +15,15 @@ * limitations under the License. */ using System; -using System.Text; using System.Threading; namespace ActiveMQ.Util { class CountDownLatch { + readonly ManualResetEvent mutex = new ManualResetEvent(false); int remaining; + public CountDownLatch(int i) { remaining=i; @@ -30,29 +31,38 @@ public void countDown() { - lock(this) + lock (mutex) { - if( remaining > 0 ) { + if( remaining > 0 ) + { remaining--; - Monitor.PulseAll(this); + if( remaining == 0 ) + { + mutex.Set(); + } } } } - public bool await(TimeSpan timeout) + public int Remaining { - lock (this) - { - if (remaining > 0) + get { + lock(mutex) { - Monitor.Wait(this, timeout); - if (remaining > 0) - { - return false; - } - } + return remaining; + } } - return true; } + + public bool await(int timeout) + { + return mutex.WaitOne(timeout, false); + } + + public WaitHandle AsyncWaitHandle + { + get { return mutex; } + } + } } Modified: incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Util/URISupport.cs URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Util/URISupport.cs?view=diff&rev=465501&r1=465500&r2=465501 ============================================================================== --- incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Util/URISupport.cs (original) +++ incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Util/URISupport.cs Wed Oct 18 22:44:03 2006 @@ -16,6 +16,7 @@ */ using System; using System.Collections.Specialized; +using System.Globalization; using System.Text; namespace ActiveMQ.Util @@ -79,7 +80,7 @@ System.Reflection.PropertyInfo prop = type.GetProperty(bareKey, System.Reflection.BindingFlags.FlattenHierarchy | System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.IgnoreCase); if (prop != null) { - prop.SetValue(target, Convert.ChangeType(map[key], prop.PropertyType), null); + prop.SetValue(target, Convert.ChangeType(map[key], prop.PropertyType, CultureInfo.InvariantCulture), null); } else { Added: incubator/activemq/activemq-dotnet/trunk/src/test/csharp/MSMQ/CommonAssemblyInfo.cs URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-dotnet/trunk/src/test/csharp/MSMQ/CommonAssemblyInfo.cs?view=auto&rev=465501 ============================================================================== --- incubator/activemq/activemq-dotnet/trunk/src/test/csharp/MSMQ/CommonAssemblyInfo.cs (added) +++ incubator/activemq/activemq-dotnet/trunk/src/test/csharp/MSMQ/CommonAssemblyInfo.cs Wed Oct 18 22:44:03 2006 @@ -0,0 +1,27 @@ +using System; +using System.Reflection; +using System.Runtime.InteropServices; + +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:2.0.50727.42 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +[assembly: ComVisibleAttribute(false)] +[assembly: CLSCompliantAttribute(true)] +[assembly: AssemblyTitleAttribute("Apache NMS for MSMQ Tests")] +[assembly: AssemblyDescriptionAttribute("Unit Tests for the NMS (.Net Messaging Library) to MSMQ")] +[assembly: AssemblyConfigurationAttribute("SNAPSHOT")] +[assembly: AssemblyCompanyAttribute("http://incubator.apache.org/activemq/")] +[assembly: AssemblyProductAttribute("Apache ActiveMQ")] +[assembly: AssemblyCopyrightAttribute("Copyright (C) 2005-2006 Apache Software Foundation")] +[assembly: AssemblyTrademarkAttribute("")] +[assembly: AssemblyCultureAttribute("")] +[assembly: AssemblyVersionAttribute("4.0")] +[assembly: AssemblyInformationalVersionAttribute("4.0")] + Added: incubator/activemq/activemq-dotnet/trunk/vs2005-activemq-cf20.csproj URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-dotnet/trunk/vs2005-activemq-cf20.csproj?view=auto&rev=465501 ============================================================================== --- incubator/activemq/activemq-dotnet/trunk/vs2005-activemq-cf20.csproj (added) +++ incubator/activemq/activemq-dotnet/trunk/vs2005-activemq-cf20.csproj Wed Oct 18 22:44:03 2006 @@ -0,0 +1,743 @@ + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {B166EC33-6048-4231-BCCA-6C5AE55139A3} + Library + Properties + ActiveMQ + Apache.ActiveMQ.CF20 + {4D628B5B-2FBC-4AA6-8C16-197242AEB884};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + PocketPC + 3C41C503-53EF-4c2a-8DD4-A8217CAD115E + 4.20 + vs2005_activemq_cf20 + v2.0 + + + + + true + full + false + bin\Debug\ + TRACE;DEBUG;PocketPC, NETCF, NETCF_2_0 + true + true + prompt + 512 + 4 + Off + + + pdbonly + true + bin\Release\ + TRACE;$(PlatformFamilyName) + true + true + prompt + 512 + 4 + Off + + + + + + + + + + + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + + Code + + + Code + + + Code + + + Code + + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + + + + Code + + + + + {9C67B162-803E-4765-8A1C-041871E6928C} + vs2005-nms-cf20 + + + + + + + + + + + + + \ No newline at end of file Added: incubator/activemq/activemq-dotnet/trunk/vs2005-nms-cf20.csproj URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-dotnet/trunk/vs2005-nms-cf20.csproj?view=auto&rev=465501 ============================================================================== --- incubator/activemq/activemq-dotnet/trunk/vs2005-nms-cf20.csproj (added) +++ incubator/activemq/activemq-dotnet/trunk/vs2005-nms-cf20.csproj Wed Oct 18 22:44:03 2006 @@ -0,0 +1,94 @@ + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {9C67B162-803E-4765-8A1C-041871E6928C} + Library + Properties + NMS + Apache.NMS.CF20 + {4D628B5B-2FBC-4AA6-8C16-197242AEB884};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + PocketPC + 3C41C503-53EF-4c2a-8DD4-A8217CAD115E + 4.20 + vs2005_nms_cf20 + v2.0 + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE;$(PlatformFamilyName) + true + true + prompt + 512 + 4 + Off + + + pdbonly + true + bin\Release\ + TRACE;$(PlatformFamilyName) + true + true + prompt + 512 + 4 + Off + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file Modified: incubator/activemq/activemq-dotnet/trunk/vs2005.sln URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-dotnet/trunk/vs2005.sln?view=diff&rev=465501&r1=465500&r2=465501 ============================================================================== --- incubator/activemq/activemq-dotnet/trunk/vs2005.sln (original) +++ incubator/activemq/activemq-dotnet/trunk/vs2005.sln Wed Oct 18 22:44:03 2006 @@ -13,6 +13,10 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "vs2005-activemq-test", "vs2005-activemq-test.csproj", "{EB943C69-2C9B-45E7-B95B-FB916E7057ED}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "vs2005-nms-cf20", "vs2005-nms-cf20.csproj", "{9C67B162-803E-4765-8A1C-041871E6928C}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "vs2005-activemq-cf20", "vs2005-activemq-cf20.csproj", "{B166EC33-6048-4231-BCCA-6C5AE55139A3}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -43,6 +47,14 @@ {EB943C69-2C9B-45E7-B95B-FB916E7057ED}.Debug|Any CPU.Build.0 = Debug|Any CPU {EB943C69-2C9B-45E7-B95B-FB916E7057ED}.Release|Any CPU.ActiveCfg = Release|Any CPU {EB943C69-2C9B-45E7-B95B-FB916E7057ED}.Release|Any CPU.Build.0 = Release|Any CPU + {9C67B162-803E-4765-8A1C-041871E6928C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9C67B162-803E-4765-8A1C-041871E6928C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9C67B162-803E-4765-8A1C-041871E6928C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9C67B162-803E-4765-8A1C-041871E6928C}.Release|Any CPU.Build.0 = Release|Any CPU + {B166EC33-6048-4231-BCCA-6C5AE55139A3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B166EC33-6048-4231-BCCA-6C5AE55139A3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B166EC33-6048-4231-BCCA-6C5AE55139A3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B166EC33-6048-4231-BCCA-6C5AE55139A3}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE