|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcomm.ExecutableChannels
public class ExecutableChannels
Class ExecutableChannels. Used to establish channels to peer servers and to provide send and receive methods to each peer.
Field Summary | |
---|---|
protected ChannelFactory |
cf
|
protected SocketChannel[] |
channels
|
protected int |
DEFAULT_PORT
|
private static Logger |
logger
|
protected int[] |
ports
|
protected java.lang.String[] |
servers
|
Constructor Summary | |
---|---|
protected |
ExecutableChannels()
|
|
ExecutableChannels(java.lang.String fname)
Constructor from maschine file. |
|
ExecutableChannels(java.lang.String[] srvs)
Constructor from array of server:port strings. |
Method Summary | |
---|---|
void |
close()
Close all channels and ChannelFactory. |
SocketChannel |
getChannel(int i)
Get channel. |
SocketChannel[] |
getChannels()
Get channel array. |
java.lang.String |
getMasterHost()
Get master host, i.e. first host in servers array. |
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 |
---|
private static Logger logger
protected final ChannelFactory cf
protected SocketChannel[] channels
protected java.lang.String[] servers
protected int[] ports
protected final int DEFAULT_PORT
Constructor Detail |
---|
protected ExecutableChannels()
public ExecutableChannels(java.lang.String[] srvs)
srvs
- server:port array.public ExecutableChannels(java.lang.String fname) throws java.io.FileNotFoundException
fname
- name of machine file.
FileNotFoundException.
java.io.FileNotFoundException
Method Detail |
---|
protected void setServerPort(int i, java.lang.String srv)
public java.lang.String toString()
toString
in class java.lang.Object
public int numServers()
public java.lang.String getMasterHost()
public int getMasterPort()
public int numChannels()
public void open() throws java.io.IOException
java.io.IOException
public void open(int nc) throws java.io.IOException
nc
- number of channels to open.
IOException.
java.io.IOException
public void close()
public SocketChannel getChannel(int i)
i
- channel number.public SocketChannel[] getChannels()
public void send(int i, java.lang.Object o) throws java.io.IOException
i
- channel number.o
- object to send.
java.io.IOException
public java.lang.Object receive(int i) throws java.io.IOException, java.lang.ClassNotFoundException
i
- channel number.
java.io.IOException
java.lang.ClassNotFoundException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |