EnlistmentNotification Problems !!

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Sahil Malik [MVP]

    EnlistmentNotification Problems !!

    Okay, so here is my EnlistmentNotif ication class - this is the class that
    implements both ISinglePhaseNot ification and IEnlistmentNoti fication (for
    non distri and distributed transactions involving non durable or more than
    one RM).

    Funny thing though, while in a single RM scenario, public void
    SinglePhaseComm it(SinglePhaseE nlistment singlePhaseEnli stment) does get
    called, in a multi RM scenario, public void Commit(Enlistme nt enlistment)
    doesn't get called. (Prepare does get called though).

    Can anyone help? Here's the code for my EnlistmentNotif ication class.

    public class EnlistmentNotif ication : IEnlistmentNoti fication,
    ISinglePhaseNot ification
    {
    private StreamReader sr;
    private StreamWriter sw;
    private string toFile = "";

    public EnlistmentNotif ication(String From, string To)
    {
    sr = new StreamReader(Fr om);
    sw = new StreamWriter(To );
    toFile = To;
    }

    #region IEnlistmentNoti fication Members

    public void Commit(Enlistme nt enlistment)
    {
    sw.Close();
    sr.Close();
    enlistment.Done ();
    }

    public void InDoubt(Enlistm ent enlistment) { ;}

    public void Prepare(Prepari ngEnlistment preparingEnlist ment)
    {
    Prepare(((Enlis tment)preparing Enlistment));
    }

    public void Rollback(Enlist ment enlistment)
    {
    sw.Flush();
    sr.Close();
    sw.Close();
    File.Delete(toF ile);
    }

    #endregion

    #region ISinglePhaseNot ification Members

    public void SinglePhaseComm it(SinglePhaseE nlistment
    singlePhaseEnli stment)
    {
    Prepare(singleP haseEnlistment) ;
    Commit(singlePh aseEnlistment);
    }

    #endregion

    private void Prepare(Enlistm ent enlistment)
    {
    sw.Write(sr.Rea dToEnd());
    }
    }

    - Sahil Malik [MVP]



  • Sahil Malik [MVP]

    #2
    Re: EnlistmentNotif ication Problems !!

    Never mind .. I figured it out !!!

    "Sahil Malik [MVP]" <contactmethrum yblog@nospam.co m> wrote in message
    news:OaHyGJqSFH A.3308@TK2MSFTN GP14.phx.gbl...[color=blue]
    > Okay, so here is my EnlistmentNotif ication class - this is the class that
    > implements both ISinglePhaseNot ification and IEnlistmentNoti fication (for
    > non distri and distributed transactions involving non durable or more than
    > one RM).
    >
    > Funny thing though, while in a single RM scenario, public void
    > SinglePhaseComm it(SinglePhaseE nlistment singlePhaseEnli stment) does get
    > called, in a multi RM scenario, public void Commit(Enlistme nt enlistment)
    > doesn't get called. (Prepare does get called though).
    >
    > Can anyone help? Here's the code for my EnlistmentNotif ication class.
    >
    > public class EnlistmentNotif ication : IEnlistmentNoti fication,
    > ISinglePhaseNot ification
    > {
    > private StreamReader sr;
    > private StreamWriter sw;
    > private string toFile = "";
    >
    > public EnlistmentNotif ication(String From, string To)
    > {
    > sr = new StreamReader(Fr om);
    > sw = new StreamWriter(To );
    > toFile = To;
    > }
    >
    > #region IEnlistmentNoti fication Members
    >
    > public void Commit(Enlistme nt enlistment)
    > {
    > sw.Close();
    > sr.Close();
    > enlistment.Done ();
    > }
    >
    > public void InDoubt(Enlistm ent enlistment) { ;}
    >
    > public void Prepare(Prepari ngEnlistment preparingEnlist ment)
    > {
    > Prepare(((Enlis tment)preparing Enlistment));
    > }
    >
    > public void Rollback(Enlist ment enlistment)
    > {
    > sw.Flush();
    > sr.Close();
    > sw.Close();
    > File.Delete(toF ile);
    > }
    >
    > #endregion
    >
    > #region ISinglePhaseNot ification Members
    >
    > public void SinglePhaseComm it(SinglePhaseE nlistment
    > singlePhaseEnli stment)
    > {
    > Prepare(singleP haseEnlistment) ;
    > Commit(singlePh aseEnlistment);
    > }
    >
    > #endregion
    >
    > private void Prepare(Enlistm ent enlistment)
    > {
    > sw.Write(sr.Rea dToEnd());
    > }
    > }
    >
    > - Sahil Malik [MVP]
    > http://codebetter.com/blogs/sahil.malik/
    >
    >[/color]


    Comment

    • Sahil Malik [MVP]

      #3
      Re: EnlistmentNotif ication Problems !!

      Its right here BTW for anyone interested. -




      "Sahil Malik [MVP]" <contactmethrum yblog@nospam.co m> wrote in message
      news:uY1ksuqSFH A.3552@TK2MSFTN GP10.phx.gbl...[color=blue]
      > Never mind .. I figured it out !!!
      >
      > "Sahil Malik [MVP]" <contactmethrum yblog@nospam.co m> wrote in message
      > news:OaHyGJqSFH A.3308@TK2MSFTN GP14.phx.gbl...[color=green]
      > > Okay, so here is my EnlistmentNotif ication class - this is the class[/color][/color]
      that[color=blue][color=green]
      > > implements both ISinglePhaseNot ification and IEnlistmentNoti fication[/color][/color]
      (for[color=blue][color=green]
      > > non distri and distributed transactions involving non durable or more[/color][/color]
      than[color=blue][color=green]
      > > one RM).
      > >
      > > Funny thing though, while in a single RM scenario, public void
      > > SinglePhaseComm it(SinglePhaseE nlistment singlePhaseEnli stment) does get
      > > called, in a multi RM scenario, public void Commit(Enlistme nt[/color][/color]
      enlistment)[color=blue][color=green]
      > > doesn't get called. (Prepare does get called though).
      > >
      > > Can anyone help? Here's the code for my EnlistmentNotif ication class.
      > >
      > > public class EnlistmentNotif ication : IEnlistmentNoti fication,
      > > ISinglePhaseNot ification
      > > {
      > > private StreamReader sr;
      > > private StreamWriter sw;
      > > private string toFile = "";
      > >
      > > public EnlistmentNotif ication(String From, string To)
      > > {
      > > sr = new StreamReader(Fr om);
      > > sw = new StreamWriter(To );
      > > toFile = To;
      > > }
      > >
      > > #region IEnlistmentNoti fication Members
      > >
      > > public void Commit(Enlistme nt enlistment)
      > > {
      > > sw.Close();
      > > sr.Close();
      > > enlistment.Done ();
      > > }
      > >
      > > public void InDoubt(Enlistm ent enlistment) { ;}
      > >
      > > public void Prepare(Prepari ngEnlistment preparingEnlist ment)
      > > {
      > > Prepare(((Enlis tment)preparing Enlistment));
      > > }
      > >
      > > public void Rollback(Enlist ment enlistment)
      > > {
      > > sw.Flush();
      > > sr.Close();
      > > sw.Close();
      > > File.Delete(toF ile);
      > > }
      > >
      > > #endregion
      > >
      > > #region ISinglePhaseNot ification Members
      > >
      > > public void SinglePhaseComm it(SinglePhaseE nlistment
      > > singlePhaseEnli stment)
      > > {
      > > Prepare(singleP haseEnlistment) ;
      > > Commit(singlePh aseEnlistment);
      > > }
      > >
      > > #endregion
      > >
      > > private void Prepare(Enlistm ent enlistment)
      > > {
      > > sw.Write(sr.Rea dToEnd());
      > > }
      > > }
      > >
      > > - Sahil Malik [MVP]
      > > http://codebetter.com/blogs/sahil.malik/
      > >
      > >[/color]
      >
      >[/color]


      Comment

      Working...