org.jgroups

Class EnsChannel

Implemented Interfaces:
Hot_Callbacks, Transport

public class EnsChannel
extends Channel
implements Hot_Callbacks

EnsChannel is an implementation of Channel based on Ensemble. It maps a process group to a channel. Requirements are the presence of an executable called outboard (which is Ensemble) and gossip running.

Field Summary

protected Log
log

Fields inherited from class org.jgroups.Channel

AUTO_GETSTATE, AUTO_RECONNECT, BLOCK, GET_STATE_EVENTS, LOCAL, SUSPECT, VIEW, channel_listener, up_handler

Constructor Summary

EnsChannel()
EnsChannel(Object props)
Creates a new EnsChannel, which spawns an outboard process and connects to it.
EnsChannel(Object props, String transport_props, int outboard_port)
Creates a new EnsChannel.

Method Summary

void
acceptedView(Hot_GroupContext gctx, Object env, Hot_ViewState viewState)
void
block(Hot_GroupContext gctx, Object env)
void
blockOk()
void
close()
void
connect(String channel_name)
void
disconnect()
void
exit(Hot_GroupContext gctx, Object env)
boolean
getAllStates(Vector targets, long timeout)
String
getChannelName()
Address
getLocalAddress()
Object
getOpt(int option)
boolean
getState(Address target, long timeout)
View
getView()
void
heartbeat(Hot_GroupContext gctx, Object env, int rate)
boolean
isConnected()
boolean
isOpen()
Object
peek(long timeout)
Object
receive(long timeout)
void
receiveCast(Hot_GroupContext gctx, Object env, Hot_Endpoint origin, Hot_Message msg)
void
receiveSend(Hot_GroupContext gctx, Object env, Hot_Endpoint origin, Hot_Message msg)
void
returnState(byte[] state)
void
send(Address dst, Address src, Serializable obj)
void
send(Message msg)
void
setOpt(int option, Object value)

Methods inherited from class org.jgroups.Channel

blockOk, close, connect, disconnect, down, getAllStates, getChannelName, getLocalAddress, getNumMessages, getOpt, getState, getView, isConnected, isOpen, open, option2String, peek, receive, returnState, send, send, setChannelListener, setOpt, setUpHandler

Field Details

log

protected Log log

Constructor Details

EnsChannel

public EnsChannel()
            throws ChannelException

EnsChannel

public EnsChannel(Object props)
            throws ChannelException
Creates a new EnsChannel, which spawns an outboard process and connects to it.
Parameters:
props - Ensemble properties (cf. Ensemble reference manual). A value of null uses the default properties.

EnsChannel

public EnsChannel(Object props,
                  String transport_props,
                  int outboard_port)
            throws ChannelException
Creates a new EnsChannel. Instead of spawning a new outboard process, it connects to an already running outboard process (on the same machine) using outboard_port. This allows multiple EnsChannels to share a copy of outboard. If the port is 0, outboard will be spawned. Parameter transport_props defines the type of transport to be used (UDP, ATM, IP MCAST etc).
Parameters:
props - Ensemble properties (cf. Ensemble reference manual). A value of null uses the default properties.
transport_props - Transport parameters. Null means use default (UDP). Example: "UDP:DEERING" uses IP multicast (gossip is not needed in this case).
outboard_port - Port on which the local outboard process is listening. The outboard process has to be started before. Value of 0 means spawn outboard nevertheless.

Method Details

acceptedView

public void acceptedView(Hot_GroupContext gctx,
                         Object env,
                         Hot_ViewState viewState)
Specified by:
acceptedView in interface Hot_Callbacks

block

public void block(Hot_GroupContext gctx,
                  Object env)
Specified by:
block in interface Hot_Callbacks

blockOk

public void blockOk()
Overrides:
blockOk in interface Channel

close

public void close()
Overrides:
close in interface Channel

connect

public void connect(String channel_name)
            throws ChannelClosedException
Overrides:
connect in interface Channel

disconnect

public void disconnect()
Overrides:
disconnect in interface Channel

exit

public void exit(Hot_GroupContext gctx,
                 Object env)
Specified by:
exit in interface Hot_Callbacks

getAllStates

public boolean getAllStates(Vector targets,
                            long timeout)
Overrides:
getAllStates in interface Channel

getChannelName

public String getChannelName()
Overrides:
getChannelName in interface Channel

getLocalAddress

public Address getLocalAddress()
Overrides:
getLocalAddress in interface Channel

getOpt

public Object getOpt(int option)
Overrides:
getOpt in interface Channel

getState

public boolean getState(Address target,
                        long timeout)
Overrides:
getState in interface Channel

getView

public View getView()
Overrides:
getView in interface Channel

heartbeat

public void heartbeat(Hot_GroupContext gctx,
                      Object env,
                      int rate)
Specified by:
heartbeat in interface Hot_Callbacks

isConnected

public boolean isConnected()
Overrides:
isConnected in interface Channel

isOpen

public boolean isOpen()
Overrides:
isOpen in interface Channel

peek

public Object peek(long timeout)
            throws ChannelNotConnectedException,
                   ChannelClosedException,
                   TimeoutException
Overrides:
peek in interface Channel

receive

public Object receive(long timeout)
            throws ChannelNotConnectedException,
                   ChannelClosedException,
                   TimeoutException
Specified by:
receive in interface Transport
Overrides:
receive in interface Channel

receiveCast

public void receiveCast(Hot_GroupContext gctx,
                        Object env,
                        Hot_Endpoint origin,
                        Hot_Message msg)
Specified by:
receiveCast in interface Hot_Callbacks

receiveSend

public void receiveSend(Hot_GroupContext gctx,
                        Object env,
                        Hot_Endpoint origin,
                        Hot_Message msg)
Specified by:
receiveSend in interface Hot_Callbacks

returnState

public void returnState(byte[] state)
Overrides:
returnState in interface Channel

send

public void send(Address dst,
                 Address src,
                 Serializable obj)
            throws ChannelNotConnectedException,
                   ChannelClosedException
Overrides:
send in interface Channel

send

public void send(Message msg)
            throws ChannelNotConnectedException,
                   ChannelClosedException
Specified by:
send in interface Transport
Overrides:
send in interface Channel

setOpt

public void setOpt(int option,
                   Object value)
Overrides:
setOpt in interface Channel

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