Package edu.jas.util

Class ExecutableChannels


  • public class ExecutableChannels
    extends java.lang.Object
    ExecutableChannels used to receive and execute classes.
    Author:
    Heinz Kredel
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected ExecutableChannels()
      Internal constructor.
        ExecutableChannels​(java.lang.String mfile)
      Constructor from machine file.
        ExecutableChannels​(java.lang.String[] srvs)
      Constructor from array of server:port strings.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      close all channels and ChannelFactory.
      SocketChannel getChannel​(int i)
      getChannel.
      java.lang.String getMasterHost()
      get master host.
      int getMasterPort()
      get master port.
      int numChannels()
      number of channels.
      int numServers()
      number of servers.
      void open()
      open, setup of SocketChannels.
      void open​(int nc)
      open, setup of SocketChannels.
      java.lang.Object receive​(int i)
      receive on channel i.
      void send​(int i, java.lang.Object o)
      send on channel i.
      protected void setServerPort​(int i, java.lang.String srv)  
      java.lang.String toString()
      String representation.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • ExecutableChannels

        public ExecutableChannels​(java.lang.String[] srvs)
        Constructor from array of server:port strings.
        Parameters:
        srvs - A String array.
      • ExecutableChannels

        public ExecutableChannels​(java.lang.String mfile)
                           throws java.io.FileNotFoundException
        Constructor from machine file.
        Parameters:
        mfile -
        Throws:
        java.io.FileNotFoundException
    • Method Detail

      • setServerPort

        protected void setServerPort​(int i,
                                     java.lang.String srv)
      • toString

        public java.lang.String toString()
        String representation.
        Overrides:
        toString in class java.lang.Object
      • numServers

        public int numServers()
        number of servers.
      • getMasterHost

        public java.lang.String getMasterHost()
        get master host.
      • numChannels

        public int numChannels()
        number of channels.
      • open

        public void open()
                  throws java.io.IOException
        open, setup of SocketChannels.
        Throws:
        java.io.IOException
      • open

        public void open​(int nc)
                  throws java.io.IOException
        open, setup of SocketChannels. If nc > servers.length open in round robin fashion.
        Parameters:
        nc - number of channels to open.
        Throws:
        java.io.IOException
      • close

        public void close()
        close all channels and ChannelFactory.
      • send

        public void send​(int i,
                         java.lang.Object o)
                  throws java.io.IOException
        send on channel i.
        Parameters:
        i - channel number.
        o - object to send.
        Throws:
        java.io.IOException
      • receive

        public java.lang.Object receive​(int i)
                                 throws java.io.IOException,
                                        java.lang.ClassNotFoundException
        receive on channel i.
        Parameters:
        i - channel number.
        Returns:
        object received.
        Throws:
        java.io.IOException
        java.lang.ClassNotFoundException