org.jgroups.blocks

Class LogicalLink

Implemented Interfaces:
Link.Receiver

public class LogicalLink
extends java.lang.Object
implements Link.Receiver

Implements a logical point-to-point link between 2 entities consisting of a number of physical links. Traffic is routed over any of the physical link, according to policies. Examples are: send traffic over all links, round-robin, use first link for 70% of traffic, other links for the remaining 30%.
Author:
Bela Ban, June 2000

Nested Class Summary

class
LogicalLink.AllLinksDown
class
LogicalLink.NoLinksAvailable
static interface
LogicalLink.Receiver

Constructor Summary

LogicalLink()
LogicalLink(LogicalLink.Receiver r)

Method Summary

void
addLink(String local_addr, int local_port, String remote_addr, int remote_port)
void
addLink(String local_addr, int local_port, String remote_addr, int remote_port, long timeout, long hb_interval)
Vector
getLinks()
void
linkDown(InetAddress local, int local_port, InetAddress remote, int remote_port)
One of the physical links went down
void
linkUp(InetAddress local, int local_port, InetAddress remote, int remote_port)
One of the physical links came up
static void
main(String[] args)
void
missedHeartbeat(InetAddress local, int local_port, InetAddress remote, int remote_port, int num_missed_hbs)
Missed one or more heartbeats.
int
numberOfEstablishedLinks()
int
numberOfLinks()
void
receive(byte[] buf)
Receive a message from any of the physical links.
void
receivedHeartbeatAgain(InetAddress local, int local_port, InetAddress remote, int remote_port)
Heartbeat came back again (before link was taken down) after missing some heartbeats
void
removeAllLinks()
boolean
send(byte[] buf)
Send a message to the other side
void
setReceiver(LogicalLink.Receiver r)
void
start()
Start all links
void
stop()
Stop all links

Constructor Details

LogicalLink

public LogicalLink()

LogicalLink

public LogicalLink(LogicalLink.Receiver r)

Method Details

addLink

public void addLink(String local_addr,
                    int local_port,
                    String remote_addr,
                    int remote_port)

addLink

public void addLink(String local_addr,
                    int local_port,
                    String remote_addr,
                    int remote_port,
                    long timeout,
                    long hb_interval)

getLinks

public Vector getLinks()

linkDown

public void linkDown(InetAddress local,
                     int local_port,
                     InetAddress remote,
                     int remote_port)
One of the physical links went down
Specified by:
linkDown in interface Link.Receiver

linkUp

public void linkUp(InetAddress local,
                   int local_port,
                   InetAddress remote,
                   int remote_port)
One of the physical links came up
Specified by:
linkUp in interface Link.Receiver

main

public static void main(String[] args)

missedHeartbeat

public void missedHeartbeat(InetAddress local,
                            int local_port,
                            InetAddress remote,
                            int remote_port,
                            int num_missed_hbs)
Missed one or more heartbeats. Link is not yet down, though
Specified by:
missedHeartbeat in interface Link.Receiver

numberOfEstablishedLinks

public int numberOfEstablishedLinks()

numberOfLinks

public int numberOfLinks()

receive

public void receive(byte[] buf)
Receive a message from any of the physical links. That's why this and the next methods have to be synchronized
Specified by:
receive in interface Link.Receiver

receivedHeartbeatAgain

public void receivedHeartbeatAgain(InetAddress local,
                                   int local_port,
                                   InetAddress remote,
                                   int remote_port)
Heartbeat came back again (before link was taken down) after missing some heartbeats
Specified by:
receivedHeartbeatAgain in interface Link.Receiver

removeAllLinks

public void removeAllLinks()

send

public boolean send(byte[] buf)
            throws LogicalLink.AllLinksDown,
                   LogicalLink.NoLinksAvailable
Send a message to the other side

setReceiver

public void setReceiver(LogicalLink.Receiver r)

start

public void start()
Start all links

stop

public void stop()
Stop all links

Copyright B) 2001,2002 www.jgroups.com . All Rights Reserved.