public abstract class Sender
extends java.lang.Object
Constructor and Description |
---|
Sender(Data d,
int destID,
Workers w,
byte command)
To send data between workers, sender and
receiver must both have valid IDs.
|
Sender(Data d,
java.lang.String h,
int p,
byte command)
Use host and port directly do send between
any to processes It can send data from a
process other than workers or send data from
a worker to a process outside.
|
Modifier and Type | Method and Description |
---|---|
boolean |
execute()
Send the data
|
protected byte |
getCommand()
Get the command
|
protected int |
getDestWorkerID()
Get the ID of the destination worker
|
protected Workers |
getWorkers()
Get the workers
|
protected abstract void |
handleData(Connection conn,
Data data)
Abstract method for handling the data
|
public Sender(Data d, int destID, Workers w, byte command)
d
- the datadestID
- the ID of the destinationw
- the workerscommand
- the commandpublic Sender(Data d, java.lang.String h, int p, byte command)
d
- h
- p
- command
- public boolean execute()
protected int getDestWorkerID()
protected Workers getWorkers()
protected byte getCommand()
protected abstract void handleData(Connection conn, Data data) throws java.lang.Exception
conn
- the connection objectdata
- the Datajava.lang.Exception