Free cookie consent management tool by TermsFeed Policy Generator

Changeset 1044


Ignore:
Timestamp:
12/20/08 23:22:08 (16 years ago)
Author:
gkronber
Message:

worked on dispatcher for CEDMA agents. #419 (Refactor CEDMA plugins)

Location:
branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Server
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Server/HeuristicLab.CEDMA.Server.csproj

    r988 r1044  
    7575  </ItemGroup>
    7676  <ItemGroup>
     77    <Compile Include="Dispatcher.cs" />
     78    <Compile Include="Server.cs" />
    7779    <Compile Include="ServerApplication.cs" />
    7880    <Compile Include="HeuristicLabCedmaServerPlugin.cs" />
  • branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Server/ServerForm.cs

    r988 r1044  
    4242namespace HeuristicLab.CEDMA.Server {
    4343  public partial class ServerForm : Form {
    44     private ServiceHost host;
     44    private Server server;
    4545    private Store store;
     46    private Dispatcher dispatcher;
     47
    4648    private static readonly string rdfFile = AppDomain.CurrentDomain.BaseDirectory + "rdf_store.db3";
    4749    private static readonly string rdfConnectionString = "sqlite:rdf:Data Source=\"" + rdfFile + "\"";
     50   
    4851    public ServerForm() {
    4952      InitializeComponent();
    50       // windows XP returns the external ip on index 0 while windows vista returns the external ip on index 2
    51       if(System.Environment.OSVersion.Version.Major >= 6) {
    52         addressTextBox.Text = "net.tcp://" + Dns.GetHostAddresses(Dns.GetHostName())[2] + ":8002/CEDMA/World";
    53       } else {
    54         addressTextBox.Text = "net.tcp://" + Dns.GetHostAddresses(Dns.GetHostName())[0] + ":8002/CEDMA/World";
    55       }
     53      store = new Store(rdfConnectionString);
     54      server = new Server(store);
     55      server.Start();
     56      addressTextBox.Text = server.CedmaServiceUrl;
     57      dispatcher = new Dispatcher(store);
     58      dispatcher.Start();
    5659    }
    5760
    58     private void InitRunScheduler() {
    59       JobManager jobManager = new JobManager(gridAddress.Text);
    60       jobManager.Reset();
     61    private void refreshTimer_Tick(object sender, EventArgs e) {
     62      listBox.DataSource = dispatcher.DispatchQueue;
    6163    }
    6264
    63     private void InitRdfStore() {
    64       store = new Store(rdfConnectionString);
    65     }
    66 
    67     private void Start() {
    68       InitRdfStore();
    69       InitRunScheduler();
    70 
    71       host = new ServiceHost(store, new Uri(addressTextBox.Text));
    72       ServiceThrottlingBehavior throttlingBehavior = new ServiceThrottlingBehavior();
    73       throttlingBehavior.MaxConcurrentSessions = 20;
    74       host.Description.Behaviors.Add(throttlingBehavior);
    75       try {
    76         NetTcpBinding binding = new NetTcpBinding();
    77         binding.MaxReceivedMessageSize = 100000000; // 100Mbytes
    78         binding.ReaderQuotas.MaxStringContentLength = 100000000; // also 100M chars
    79         binding.ReaderQuotas.MaxArrayLength = 100000000; // also 100M elements;
    80         binding.Security.Mode = SecurityMode.None;
    81 
    82         host.AddServiceEndpoint(typeof(IStore), binding, addressTextBox.Text);
    83         host.Open();
    84       } catch(CommunicationException ex) {
    85         MessageBox.Show("An exception occurred: " + ex.Message);
    86         host.Abort();
    87       }
    88     }
    89 
    90     private void startButton_Click(object sender, EventArgs e) {
    91       Start();
    92       startButton.Enabled = false;
     65    private void connectButton_Click(object sender, EventArgs e) {
     66      // new GridExecutor(dispatcher)
    9367    }
    9468  }
  • branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Server/ServerForm.designer.cs

    r1003 r1044  
    4545    /// </summary>
    4646    private void InitializeComponent() {
     47      this.components = new System.ComponentModel.Container();
    4748      this.addressTextBox = new System.Windows.Forms.TextBox();
    4849      this.externalAddressLabel = new System.Windows.Forms.Label();
    4950      this.gridAddressLabel = new System.Windows.Forms.Label();
    5051      this.gridAddress = new System.Windows.Forms.TextBox();
    51       this.startButton = new System.Windows.Forms.Button();
     52      this.connectButton = new System.Windows.Forms.Button();
     53      this.listBox = new System.Windows.Forms.ListBox();
     54      this.refreshTimer = new System.Windows.Forms.Timer(this.components);
    5255      this.SuspendLayout();
    5356      //
     
    8285      this.gridAddress.Location = new System.Drawing.Point(106, 32);
    8386      this.gridAddress.Name = "gridAddress";
    84       this.gridAddress.Size = new System.Drawing.Size(229, 20);
     87      this.gridAddress.Size = new System.Drawing.Size(160, 20);
    8588      this.gridAddress.TabIndex = 8;
    8689      //
    87       // startButton
     90      // connectButton
    8891      //
    89       this.startButton.Location = new System.Drawing.Point(15, 84);
    90       this.startButton.Name = "startButton";
    91       this.startButton.Size = new System.Drawing.Size(75, 23);
    92       this.startButton.TabIndex = 10;
    93       this.startButton.Text = "Start";
    94       this.startButton.UseVisualStyleBackColor = true;
    95       this.startButton.Click += new System.EventHandler(this.startButton_Click);
     92      this.connectButton.Location = new System.Drawing.Point(272, 30);
     93      this.connectButton.Name = "connectButton";
     94      this.connectButton.Size = new System.Drawing.Size(75, 23);
     95      this.connectButton.TabIndex = 10;
     96      this.connectButton.Text = "Connect";
     97      this.connectButton.UseVisualStyleBackColor = true;
     98      this.connectButton.Click += new System.EventHandler(this.connectButton_Click);
     99      //
     100      // listBox
     101      //
     102      this.listBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     103                  | System.Windows.Forms.AnchorStyles.Left)
     104                  | System.Windows.Forms.AnchorStyles.Right)));
     105      this.listBox.FormattingEnabled = true;
     106      this.listBox.Location = new System.Drawing.Point(12, 58);
     107      this.listBox.Name = "listBox";
     108      this.listBox.Size = new System.Drawing.Size(350, 277);
     109      this.listBox.TabIndex = 11;
     110      //
     111      // refreshTimer
     112      //
     113      this.refreshTimer.Enabled = true;
     114      this.refreshTimer.Interval = 1000;
     115      this.refreshTimer.Tick += new System.EventHandler(this.refreshTimer_Tick);
    96116      //
    97117      // ServerForm
     
    99119      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    100120      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    101       this.ClientSize = new System.Drawing.Size(347, 119);
    102       this.Controls.Add(this.startButton);
     121      this.ClientSize = new System.Drawing.Size(374, 342);
     122      this.Controls.Add(this.listBox);
     123      this.Controls.Add(this.connectButton);
    103124      this.Controls.Add(this.gridAddressLabel);
    104125      this.Controls.Add(this.gridAddress);
     
    118139    private System.Windows.Forms.Label gridAddressLabel;
    119140    private System.Windows.Forms.TextBox gridAddress;
    120     private System.Windows.Forms.Button startButton;
     141    private System.Windows.Forms.Button connectButton;
     142    private System.Windows.Forms.ListBox listBox;
     143    private System.Windows.Forms.Timer refreshTimer;
    121144  }
    122145}
  • branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Server/ServerForm.resx

    r378 r1044  
    118118    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
    119119  </resheader>
     120  <metadata name="refreshTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
     121    <value>17, 17</value>
     122  </metadata>
    120123</root>
Note: See TracChangeset for help on using the changeset viewer.