|
//--------------------------------------------
// Written by Roman Kiss (rkiss@pathcom.com)
// November 14, 2001
//
// history:
// RK 10142001 init
//--------------------------------------------
using System;
using System.Diagnostics;
using System.Threading;
using System.Runtime.Remoting;
using System.Runtime.InteropServices;
//
using RKiss.RemoteObject; // abstract definitions
namespace RKiss.RemoteObjectA
{
public class RmObjectA : MarshalByRefObject, IRmObject
{
public RmObjectA()
{
Trace.WriteLine(string.Format("[{0}]RmObjectA activated", GetHashCode()));
}
public string Echo(string msg)
{
Trace.WriteLine(string.Format("[{0}]RmObjectA.Echo({1})", GetHashCode(), msg));
return msg;
}
// stateless callbacks
public string GiveMeCallback(int timeinsec, string ticketId, object objwire)
{
RemoteCallback wire = objwire as RemoteCallback;
bool bProgress = true;
CallbackEventArgs cea = new CallbackEventArgs();
cea.TicketId = ticketId;
cea.State = "running ...";
cea.Sender = GetType().ToString();
wire(cea.Sender, cea);
while(timeinsec-- > 0 && bProgress)
{
Thread.Sleep(1000);
cea.State = timeinsec;
bProgress = wire(cea.Sender, cea);
}
cea.State = bProgress?"done":string.Format("aborted at {0}", ++timeinsec);
wire(cea.Sender, cea);
//
Trace.WriteLine(string.Format("[{0}]RmObjectA.GiveMeCallback({1}, {2}, {3})",
GetHashCode(), timeinsec, ticketId, wire.GetType().FullName));
return ticketId;
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.