|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.UCL.xmiddle.framework.controller.Locator | +--edu.UCL.xmiddle.controller.UDPLocator
The UDPLocator is responsible for "showing" to other hosts that we
are online and realising which other hosts are currently in
reach. It does this, by multicasting an online message (which
includes information such as the primaryID, the secondary ID, the
ip address, the linktable (linkedFrom and exports tables) etc, and
by receiving similar messages multicasted by the other hosts that
are in reach. A host is deemed to be offline, if a specified amount
of time has passed since the last time the Locator received its
online message. UDPLocator contains three inner classes/threads:
OnlineMessage
that multicasts to other hosts that we
are on line, OfflineTimer
that realises when a host is
off line and MessageQueueParser
that parses all
messages received by the Locator. UDPLocator is also responsible
for passing HostListener events to the localhost.
Locator
Field Summary |
Fields inherited from class edu.UCL.xmiddle.framework.controller.Locator |
caller, inReach, localhost |
Constructor Summary | |
UDPLocator(LocalHost localhost,
java.net.MulticastSocket connection,
int port,
java.lang.String groupAddress,
int PORT,
int segmentSize)
Creates a new UDPLocator instance. |
Method Summary | |
void |
exit()
Signifies that the platform is about to exit, and exits all threads |
Host |
getHost(java.lang.Object primaryID)
Returns the Host representation for the given
primary ID, if the host is currently in reach. |
Host |
getHostByAddress(java.lang.String address)
Returns a host representation (if the host is in reach) by its IP address |
boolean |
isInReach(java.lang.Object primaryID)
Shows if the given host is in reach at the moment |
void |
pause()
Signifies that the Locator and its threads should stop processing/sending/receiving |
void |
run()
Receives packets from the network. |
void |
setConnection(java.net.MulticastSocket socket)
Describe setConnection method here. |
void |
setPort(int port)
Changes the private listening port |
void |
start()
Signifies that the Locator and its threads should start processing/sending/receiving |
Methods inherited from class edu.UCL.xmiddle.framework.controller.Locator |
getHosts, setLocalHost |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public UDPLocator(LocalHost localhost, java.net.MulticastSocket connection, int port, java.lang.String groupAddress, int PORT, int segmentSize)
UDPLocator
instance.
localhost
- a reference to the LocalHost, so that we can
have access to the LinkTableconnection
- The MulticastSocket
that
provides the connection to the networkport
- The port (UDP) at which the host is listening for requestsgroupAddress
- The multicast group's ip addressPORT
- The multicast group's portsegmentSize
- The maximum segment size that this host can
acceptMethod Detail |
public void setPort(int port)
port
- an int
valuepublic boolean isInReach(java.lang.Object primaryID)
isInReach
in class Locator
primaryID
- The primary ID of the host which we need to
find out if it is in reach.
public Host getHost(java.lang.Object primaryID)
Host
representation for the given
primary ID, if the host is currently in reach.
getHost
in class Locator
primaryID
- The primaryID of the host
Host
valuepublic void exit()
exit
in class Locator
public void pause()
pause
in class Locator
public void start()
start
in class Locator
public Host getHostByAddress(java.lang.String address)
address
- The ip address of the host
Host
valuepublic void run()
run
in interface java.lang.Runnable
run
in class Locator
public void setConnection(java.net.MulticastSocket socket)
setConnection
method here.
socket
- a MulticastSocket
value
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |