//
// Author:
// Atsushi Enomoto <atsushi@ximian.com>
+// Ankit Jain <JAnkit@novell.com>
//
// (C)2005 Novell Inc,
+// (C)2006 Novell Inc,
//
#if NET_2_0
+using System.Threading;
+
namespace System.Transactions
{
public class PreparingEnlistment : Enlistment
{
- internal PreparingEnlistment ()
+ bool prepared = false;
+ Transaction tx;
+ IEnlistmentNotification enlisted;
+ WaitHandle waitHandle;
+ Exception ex;
+
+ internal PreparingEnlistment (Transaction tx, IEnlistmentNotification enlisted)
{
+ this.tx = tx;
+ this.enlisted = enlisted;
+ waitHandle = new ManualResetEvent (false);
}
- [MonoTODO]
public void ForceRollback ()
{
- throw new NotImplementedException ();
+ ForceRollback (null);
}
[MonoTODO]
public void ForceRollback (Exception ex)
{
- throw new NotImplementedException ();
+ tx.Rollback (ex, enlisted);
+ /* See test RMFail2 */
+ ((ManualResetEvent) waitHandle).Set ();
}
[MonoTODO]
public void Prepared ()
{
- throw new NotImplementedException ();
+ prepared = true;
+ /* See test RMFail2 */
+ ((ManualResetEvent) waitHandle).Set ();
}
[MonoTODO]
{
throw new NotImplementedException ();
}
+
+ internal bool IsPrepared {
+ get { return prepared; }
+ }
+
+ internal WaitHandle WaitHandle {
+ get { return waitHandle; }
+ }
+
+ internal IEnlistmentNotification EnlistmentNotification
+ {
+ get { return enlisted; }
+ }
+
+ // Uncatched exceptions thrown during prepare will
+ // be saved here so they can be retrieved by TM.
+ internal Exception Exception
+ {
+ get { return ex; }
+ set { ex = value; }
+ }
}
}