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

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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  }
Note: See TracChangeset for help on using the changeset viewer.