Package aleph

Examples of aleph.Message


   **/
  protected Message receive () throws IOException {
    try {
      if (DEBUG)
        Aleph.debug("TCPConnection: receive socket is " + socket);
      Message message = (Message) objectInput.readObject();
      Logger.debug("Received " + message.stamp);
      if (DEBUG)
        Aleph.debug("TCPConnection: received " + message + " From: " + remoteAddress);
      return message;
    } catch (ClassNotFoundException e) {
View Full Code Here


  private class MessageHandler extends Thread {
    public void run() {
      try {
        while(! quit) {         // keep on keeping on
          Message message = Connection.this.receive();
          if (message != null) { // ignore spurious nulls
            if (DEBUG)
              Aleph.debug("Connection received " + message);
            if (message instanceof AsynchMessage)
              Scheduler.getScheduler().schedule(message); // maybe later
            else
              message.run();
          }
        }
      } catch(IOException e) {
        if (DEBUG)
          Aleph.debug("tcp.Connection closing: " + e);
View Full Code Here

  private class MessageHandler extends Thread {
    public void run() {
      try {
        while(! quit) {         // keep snarfing up messages
          Message message = Connection.this.receive();
          if (message != null) {  //  ignore spurious nulls in stream
            if (DEBUG)
              Aleph.debug("Connection received " + message);
            if (message instanceof AsynchMessage)
              scheduler.schedule(message); // place in work pool
            else
              message.run()// run it immediately
          }
        }
      } catch(java.io.IOException e) {
        return;           
      } catch(Exception e) {
View Full Code Here

  private class Worker extends Thread {
   public void run () {
     while (true) {
       if (DEBUG)
         Aleph.debug("waiting for message ...");
       Message message = (Message) queue.deq();
       if (DEBUG)
         if (message instanceof AsynchMessage)
           Aleph.debug("dequeued asynchronous " + message);
         else
           Aleph.debug("dequeued normal " + message);
       if (message instanceof AsynchMessage)
         scheduler.schedule(message); // do it later
       else
         message.run();         //
     }
   }
View Full Code Here

  public synchronized Message deq () {
    if (DEBUG)
      Aleph.debug("MessageQueue.deq ...");
    while (queue.isEmpty())
      try {wait();} catch (InterruptedException e) {}
    Message message = (Message) queue.removeLast();
    if (DEBUG)
      Aleph.debug("MessageQueue.deq() returns " + message);
    return message;
  }
View Full Code Here

TOP

Related Classes of aleph.Message

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.