Free cookie consent management tool by TermsFeed Policy Generator

Changeset 734


Ignore:
Timestamp:
11/11/08 17:50:43 (15 years ago)
Author:
kgrading
Message:

implemented a threadsafe MessageQueue (#347)

Location:
trunk/sources
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Hive.Client.Common/HeuristicLab.Hive.Client.Common.csproj

    r729 r734  
    6767    <Compile Include="CommonPlugin.cs" />
    6868    <Compile Include="Logging.cs" />
     69    <Compile Include="MessageContainer.cs" />
     70    <Compile Include="MessageQueue.cs" />
    6971    <Compile Include="Properties\AssemblyInfo.cs" />
    7072  </ItemGroup>
  • trunk/sources/HeuristicLab.Hive.Client.Core/CoreApplication.cs

    r733 r734  
    1414    public override void Run() {
    1515 
    16       Logging.getInstance().Info(this.Name, "Info Message");
    17       Logging.getInstance().Error(this.Name, "Error Message");
    18       Logging.getInstance().Error(this.Name, "Exception Message", new Exception("Exception"));
     16      //Logging.getInstance().Info(this.Name, "Info Message");
     17      //Logging.getInstance().Error(this.Name, "Error Message");
     18      //Logging.getInstance().Error(this.Name, "Exception Message", new Exception("Exception"));
    1919     
    2020      Heartbeat beat = new Heartbeat();
    2121      beat.Interval = 1000;
    2222      beat.StartHeartbeat();
    23       DoRubbish();
    24       Console.WriteLine("done");
    25       Thread.Sleep(99999);
    26     }
     23      MessageQueue queue = MessageQueue.GetInstance();
     24     
     25      while (true) {
     26        MessageContainer container = queue.GetMessage();
     27        Console.WriteLine(container.Message.ToString());
     28      }
    2729
    28     private void DoRubbish() {
    29       for (int w = 0; w < 20000000; w++)
    30         for (int x = 0; x < 20000000; x++)
    31           for (int y = 0; y < 20000000; y++) {
    32           }
    33 
     30     
    3431    }
    3532  }
  • trunk/sources/HeuristicLab.Hive.Client.Core/Heartbeat.cs

    r733 r734  
    44using System.Text;
    55using System.Timers;
     6using HeuristicLab.Hive.Client.Common;
    67
    78namespace HeuristicLab.Hive.Client.Core {
     
    2425      heartbeatTimer.AutoReset = true;
    2526      heartbeatTimer.Elapsed += new ElapsedEventHandler(heartbeatTimer_Elapsed);
    26       heartbeatTimer.Start();           
     27      heartbeatTimer.Start();               
    2728    }
    2829
    2930    void heartbeatTimer_Elapsed(object sender, ElapsedEventArgs e) {
    3031      Console.WriteLine("tick");
     32      MessageQueue.GetInstance().AddMessage(MessageQueue.MessageType.FetchJob);
    3133    }
    3234
Note: See TracChangeset for help on using the changeset viewer.