edu.jas.util
Class ExecutableChannels

java.lang.Object
  extended by edu.jas.util.ExecutableChannels

public class ExecutableChannels
extends java.lang.Object

Class ExecutableChannels used to receive and execute classes


Field Summary
protected  edu.unima.ky.parallel.ChannelFactory cf
           
protected  edu.unima.ky.parallel.SocketChannel[] channels
           
protected  int DEFAULT_PORT
           
protected  int[] ports
           
protected  java.lang.String[] servers
           
 
Constructor Summary
protected ExecutableChannels()
           
  ExecutableChannels(java.lang.String fname)
          Constructor from machine file
  ExecutableChannels(java.lang.String[] srvs)
          Constructor from array of server:port strings
 
Method Summary
 void close()
          close all channels and ChannelFactory
 edu.unima.ky.parallel.SocketChannel getChannel(int i)
          getChannel
 edu.unima.ky.parallel.SocketChannel[] getChannels()
          getChannels
 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)
          recieve 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
 

Field Detail

cf

protected final edu.unima.ky.parallel.ChannelFactory cf

channels

protected edu.unima.ky.parallel.SocketChannel[] channels

servers

protected java.lang.String[] servers

ports

protected int[] ports

DEFAULT_PORT

protected final int DEFAULT_PORT
See Also:
Constant Field Values
Constructor Detail

ExecutableChannels

protected ExecutableChannels()

ExecutableChannels

public ExecutableChannels(java.lang.String[] srvs)
Constructor from array of server:port strings


ExecutableChannels

public ExecutableChannels(java.lang.String fname)
                   throws java.io.FileNotFoundException
Constructor from machine file

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


getMasterPort

public int getMasterPort()
get master port


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

Throws:
java.io.IOException

close

public void close()
close all channels and ChannelFactory


getChannel

public edu.unima.ky.parallel.SocketChannel getChannel(int i)
getChannel

Parameters:
i - channel number

getChannels

public edu.unima.ky.parallel.SocketChannel[] getChannels()
getChannels


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
recieve on channel i

Parameters:
i - channel number
Returns:
object recieved
Throws:
java.io.IOException
java.lang.ClassNotFoundException