Class ExecutableChannels
java.lang.Object
edu.jas.util.ExecutableChannels
ExecutableChannels used to receive and execute classes.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final ChannelFactoryprotected SocketChannel[]protected static final Stringdefault machine file.protected static final intdefault port.private static final org.apache.logging.log4j.Loggerprotected int[]protected String[] -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedInternal constructor.ExecutableChannels(String mfile) Constructor from machine file.ExecutableChannels(String[] srvs) Constructor from array of server:port strings. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()close all channels and ChannelFactory.getChannel(int i) getChannel.(package private) SocketChannel[]getChannels.get master host.intget master port.intnumber of channels.intnumber of servers.voidopen()open, setup of SocketChannels.voidopen(int nc) open, setup of SocketChannels.receive(int i) receive on channel i.voidsend on channel i.protected voidsetServerPort(int i, String srv) toString()String representation.
-
Field Details
-
logger
private static final org.apache.logging.log4j.Logger logger -
DEFAULT_PORT
protected static final int DEFAULT_PORTdefault port.- See Also:
-
DEFAULT_MFILE
-
cf
-
channels
-
servers
-
ports
protected int[] ports
-
-
Constructor Details
-
ExecutableChannels
protected ExecutableChannels()Internal constructor. -
ExecutableChannels
Constructor from array of server:port strings.- Parameters:
srvs- A String array.
-
ExecutableChannels
Constructor from machine file.- Parameters:
mfile-- Throws:
FileNotFoundException
-
-
Method Details
-
setServerPort
-
toString
-
numServers
public int numServers()number of servers. -
getMasterHost
get master host. -
getMasterPort
public int getMasterPort()get master port. -
numChannels
public int numChannels()number of channels. -
open
-
open
open, setup of SocketChannels. If nc > servers.length open in round robin fashion.- Parameters:
nc- number of channels to open.- Throws:
IOException
-
close
public void close()close all channels and ChannelFactory. -
getChannel
-
getChannels
SocketChannel[] getChannels()getChannels. -
send
send on channel i.- Parameters:
i- channel number.o- object to send.- Throws:
IOException
-
receive
receive on channel i.- Parameters:
i- channel number.- Returns:
- object received.
- Throws:
IOExceptionClassNotFoundException
-