本文整理汇总了C#中Event.getNumber方法的典型用法代码示例。如果您正苦于以下问题:C# Event.getNumber方法的具体用法?C# Event.getNumber怎么用?C# Event.getNumber使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Event
的用法示例。
在下文中一共展示了Event.getNumber方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: getNextFIFOE
private void getNextFIFOE(string name, Event e)
{
lock (this) {
try
{
foreach (Event queueE in this.queueEvents)
{
if (queueE.getNumber() == (e.getNumber() + 1) && (queueE.getSender().Equals(e.getSender())))
{
// Console.WriteLine("FOUND NEXT MESSAGE : " + queueE.getNumber());
sentToSubscriberFIFO(queueE.getSender(), queueE);
// Thread thread = new Thread(() => this.sentToSubscriberFIFO(queueE.getSender(), queueE));
// thread.Start();
break;
}
}
}
catch (Exception ex) { Console.WriteLine(ex); }
}
}
示例2: sentToSubscriberFIFO
private void sentToSubscriberFIFO(string name, Event e)
{
bool existsTopic = false;
lock (this)
{
//}
if (!(this.lastSeqNumber.ContainsKey(name)))
{
try
{
lastSeqNumber.Add(name, 0);
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
}
// Console.WriteLine("Event iD ->" + e.getNumber() + "FROM " + e.getSender());
foreach (KeyValuePair<string, string> kvp in topicSubs)
{
if (itsForSend(kvp, e.getTopic()))
{
Console.WriteLine("Found a Subscriber:" + kvp.Value);
existsTopic = true;
if (lastSeqNumber[name] + 1 == e.getNumber())
{
ISubscriber sub = (ISubscriber)Activator.GetObject(
typeof(ISubscriber),
kvp.Value);
Console.WriteLine("Sending to : " + kvp.Value + " EVENT :" + e.getNumber() + "FROM:" + name);
sub.receiveEvent(e.getSender(), e);
events.Add(new KeyValuePair<string, Event>(name, e));
sendToPM("SubEvent " + sub.getName() + " , " + e.getSender() + " , " + e.getTopic() + " , " + e.getNumber());
// Console.WriteLine("COME ON IN");
if (queueEvents.Contains(e))
queueEvents.Remove(e);
lastSeqNumber[name] += 1;
// Console.WriteLine("SENT SUB WITH EVENT NUMBER:" + e.getNumber() + " AND SEQNUMB: " + lastSeqNumber[name] + " PUB:" + e.getSender());
getNextFIFOE(name, e);
}
else
{
Console.WriteLine("Go to Priority, Event:" + e.getNumber());
queueEvents.Add(e);
// getNextFIFOE(name, lastSeqNumber[name] + 1);
}
}
}
if (!existsTopic)
{
if ((lastSeqNumber[name] + 1 == e.getNumber()) && (name.Equals(e.getSender())))
{
lastSeqNumber[name] += 1;
getNextFIFOE(name, e);
}
else
{
queueEvents.Add(e);
//getNextFIFOE(name, e);
}
}
}
}
示例3: sendToSubscriber
public void sendToSubscriber(Event e)
{
foreach (KeyValuePair<string,string> kvp in topicSubs)
{
Console.WriteLine("Event iD ->" + e.getNumber());
if (itsForSend(kvp , e.getTopic()))
{
ISubscriber sub = (ISubscriber)Activator.GetObject(
typeof(ISubscriber),
kvp.Value);
Console.WriteLine("Sending to : " + kvp.Value);
sub.receiveEvent(e.getSender(), e);
sendToPM("SubEvent "+sub.getName()+" , "+e.getSender()+" , "+e.getTopic()+" , "+e.getNumber());
}
}
}
示例4: receivePub
public string receivePub(string name, Event e)
{
if (isFrozen)
{
FrozenEvent fe = new FrozenEvent("EVENT",e);
frozenEvents.Add(fe);
return "ACK";
}
Console.WriteLine("Received Publish" + "Name: " + name + "eventTopic: " + e.getTopic() + " " + e.getNumber());
if (!(name.StartsWith("broker")))
{
sendToPM("PubEvent " + name + " , " + e.getSender() + " , " + e.getTopic() + " , " + e.getNumber());
}
propagate(e);
sentToSub(name, e);
return "ACK";
}
示例5: floodNoOrder
public void floodNoOrder(Event e)
{
Console.WriteLine("Flooding Started");
string lastHop = e.getLastHop();
e.setLastHop(this.myUrl);
if (lastHop.Equals("null"))
{
if (! (parentURL.Equals("null")))
{
IBroker parent = (IBroker)Activator.GetObject(
typeof(IBroker),
this.parentURL);
parent.receivePub(e.getSender(), e);
sendToPM("BroEvent " + name + " , " + e.getSender() + " , " + e.getTopic() + " , " + e.getNumber());
}
if (!(childs.Count == 0))
{
foreach (string childurl in childs.Values)
{
IBroker child = (IBroker)Activator.GetObject(
typeof(IBroker),
childurl);
child.receivePub(e.getSender(), e);
sendToPM("BroEvent " + name + " , " + e.getSender() + " , " + e.getTopic() + " , " + e.getNumber());
}
}
}
else
{
if (!(this.parentURL.Equals("null")) && !(this.parentURL.Equals(lastHop)))
{
IBroker parent = (IBroker)Activator.GetObject(
typeof(IBroker),
this.parentURL);
parent.receivePub(e.getSender(), e);
sendToPM("BroEvent " + name + " , " + e.getSender() + " , " + e.getTopic() + " , " + e.getNumber());
}
if (!(childs.Count == 0))
{
foreach (string childurl in childs.Values)
{
if (!(childurl.Equals(lastHop)))
{
IBroker child = (IBroker)Activator.GetObject(
typeof(IBroker),
childurl);
child.receivePub(e.getSender(), e);
sendToPM("BroEvent " + name + " , " + e.getSender() + " , " + e.getTopic() + " , " + e.getNumber());
}
}
}
}
}
示例6: receiveEvent
public void receiveEvent(string name, Event e)
{
if (isFrozen)
{
FrozenEvent fe = new FrozenEvent("EVENT", e);
frozenEvents.Add(fe);
return;
}
this.eventsReceived.Add(new KeyValuePair<string, Event>(name, e));
Console.WriteLine("Evento Recebido de "+e.getSender()+" sobre " + e.getTopic()+" EventNumber : "+e.getNumber());
}
示例7: sendEvent
public void sendEvent(string numberEvents, string topic, string interval)
{
Event e;
int times = Int32.Parse(numberEvents);
int sleep = Int32.Parse(interval);
int i = 0;
int eventNumber;
Console.WriteLine(this.brokerUrl);
for (i = 0; i < times; i++)
{
eventNumber = this.SeqNumber();
e = new Event(topic, "",this.name, eventNumber);
if (isFrozen)
{
FrozenEvent fe = new FrozenEvent("EVENT", e);
frozenEvents.Add(fe);
Thread.Sleep(sleep);
}
else
{
this.broker.receivePub(this.name, e);
events.Add(new KeyValuePair<string, Event>(name, e));
Console.WriteLine("Creating Event : " + topic + e.getNumber());
Thread.Sleep(sleep);
}
}
}