Logo Search packages:      
Sourcecode: libjgroups-java version File versions

org::jgroups::JChannel Class Reference

Inheritance diagram for org::jgroups::JChannel:

org::jgroups::Channel org::jgroups::Transport org::jgroups::mux::MuxChannel

List of all members.


Detailed Description

JChannel is a pure Java implementation of Channel. When a JChannel object is instantiated it automatically sets up the protocol stack.

Properties

Properties are used to configure a channel, and are accepted in several forms; the String form is described here. A property string consists of a number of properties separated by colons. For example:

"<prop1>(arg1=val1):<prop2>(arg1=val1;arg2=val2):<prop3>:<propn>"

Each property relates directly to a protocol layer, which is implemented as a Java class. When a protocol stack is to be created based on the above property string, the first property becomes the bottom-most layer, the second one will be placed on the first, etc.: the stack is created from the bottom to the top, as the string is parsed from left to right. Each property has to be the name of a Java class that resides in the org.jgroups.protocols package.

Note that only the base name has to be given, not the fully specified class name (e.g., UDP instead of org.jgroups.protocols.UDP).

Each layer may have 0 or more arguments, which are specified as a list of name/value pairs in parentheses directly after the property. In the example above, the first protocol layer has 1 argument, the second 2, the third none. When a layer is created, these properties (if there are any) will be set in a layer by invoking the layer's setProperties() method

As an example the property string below instructs JGroups to create a JChannel with protocols UDP, PING, FD and GMS:

"UDP(mcast_addr=228.10.9.8;mcast_port=5678):PING:FD:GMS"

The UDP protocol layer is at the bottom of the stack, and it should use mcast address 228.10.9.8. and port 5678 rather than the default IP multicast address and port. The only other argument instructs FD to output debug information while executing. Property UDP refers to a class org.jgroups.protocols.UDP, which is subsequently loaded and an instance of which is created as protocol layer. If any of these classes are not found, an exception will be thrown and the construction of the stack will be aborted.

Author:
Bela Ban
Version:
Id
JChannel.java,v 1.158.2.18 2008/05/28 15:09:38 vlada Exp

Definition at line 76 of file JChannel.java.


Public Member Functions

synchronized void addChannelListener (ChannelListener listener)
void blockOk ()
synchronized void clearChannelListeners ()
synchronized void close ()
final void closeMessageQueue (boolean flush_entries)
synchronized void connect (String cluster_name, Address target, String state_id, long timeout) throws ChannelException
synchronized void connect (String cluster_name) throws ChannelException
synchronized void disconnect ()
void down (Event evt)
Object downcall (Event evt)
String dumpQueue ()
Map< String, Object > dumpStats ()
String dumpTimerQueue ()
void enableStats (boolean stats)
boolean flushSupported ()
boolean getAllStates (Vector targets, long timeout) throws ChannelNotConnectedException, ChannelClosedException
String getChannelName ()
String getClusterName ()
Map< String, Object > getInfo ()
Address getLocalAddress ()
int getNumberOfTasksInTimer ()
int getNumMessages ()
Object getOpt (int option)
String getProperties ()
ProtocolStack getProtocolStack ()
long getReceivedBytes ()
long getReceivedMessages ()
long getSentBytes ()
long getSentMessages ()
boolean getState (Address target, String state_id, long timeout, boolean useFlushIfPresent) throws ChannelNotConnectedException, ChannelClosedException
boolean getState (Address target, String state_id, long timeout) throws ChannelNotConnectedException, ChannelClosedException
boolean getState (Address target, long timeout) throws ChannelNotConnectedException, ChannelClosedException
int getTimerThreads ()
View getView ()
boolean isConnected ()
boolean isOpen ()
 JChannel (Object properties) throws ChannelException
 JChannel (ProtocolStackConfigurator configurator) throws ChannelException
 JChannel (String properties) throws ChannelException
 JChannel (URL properties) throws ChannelException
 JChannel (Element properties) throws ChannelException
 JChannel (File properties) throws ChannelException
 JChannel () throws ChannelException
synchronized void open () throws ChannelException
Object peek (long timeout) throws ChannelNotConnectedException, ChannelClosedException, TimeoutException
String printProtocolSpec (boolean include_properties)
Object receive (long timeout) throws ChannelNotConnectedException, ChannelClosedException, TimeoutException
synchronized void removeChannelListener (ChannelListener listener)
void resetStats ()
void returnState (byte[] state, String state_id)
void returnState (byte[] state)
void send (Address dst, Address src, Serializable obj) throws ChannelNotConnectedException, ChannelClosedException
void send (Message msg) throws ChannelNotConnectedException, ChannelClosedException
void setChannelListener (ChannelListener channel_listener)
void setInfo (String key, Object value)
void setOpt (int option, Object value)
void setReceiver (Receiver r)
void setUpHandler (UpHandler up_handler)
synchronized void shutdown ()
boolean startFlush (long timeout, boolean automatic_resume)
boolean startFlush (List< Address > flushParticipants, boolean automatic_resume)
boolean startFlush (boolean automatic_resume)
boolean statsEnabled ()
void stopFlush (List< Address > flushParticipants)
void stopFlush ()
String toString (boolean details)
Object up (Event evt)

Static Public Member Functions

static String option2String (int option)

Static Public Attributes

static final int AUTO_GETSTATE = 6
static final int AUTO_RECONNECT = 5
static final int BLOCK = 0
static final String DEFAULT_PROTOCOL_STACK = "udp.xml"
static final int GET_STATE_EVENTS = 4
static final int LOCAL = 3
static final int SUSPECT = 2
static final int VIEW = 1

Protected Member Functions

void _close (boolean disconnect, boolean close_mq)
void checkClosed () throws ChannelClosedException
void checkClosedOrNotConnected () throws ChannelNotConnectedException, ChannelClosedException
Map< String, Long > dumpChannelStats ()
Log getLog ()
final void init (ProtocolStackConfigurator configurator) throws ChannelException
 JChannel (boolean no_op)
void notifyChannelClosed (Channel c)
void notifyChannelConnected (Channel c)
void notifyChannelDisconnected (Channel c)
void notifyChannelReconnected (Address addr)
void notifyChannelShunned ()
void stopStack (boolean disconnect, boolean destroy)

Protected Attributes

final Map< String, Object > additional_data = new HashMap<String,Object>()
Set< ChannelListenerchannel_listeners = null
volatile boolean closed = false
CloserThread closer = null
volatile boolean connected = false
final ConcurrentMap< String,
Object > 
info = new ConcurrentHashMap<String,Object>()
final Log log = LogFactory.getLog(getClass())
long received_bytes = 0
long received_msgs = 0
Receiver receiver = null
long sent_bytes = 0
long sent_msgs = 0
boolean stats = true
UpHandler up_handler = null

Package Functions

Address determineCoordinator ()

Static Package Functions

static Object getEvent (Event evt)

Static Package Attributes

static final String FORCE_PROPS = "force.properties"

Private Member Functions

TimeScheduler getTimer ()
void handleExit (Event evt)
void init ()
void startStack (String cluster_name) throws ChannelException

Private Attributes

final Exchanger
< StateTransferInfo
applstate_exchanger = new Exchanger<StateTransferInfo>()
boolean auto_getstate = false
boolean auto_reconnect = true
String cluster_name = null
volatile boolean flush_supported = false
final Promise< Boolean > flush_unblock_promise = new Promise<Boolean>()
Address local_addr = null
final Promise< Addresslocal_addr_promise = new Promise<Address>()
long LOCAL_ADDR_TIMEOUT = 30000
final Queue mq = new Queue()
View my_view = null
String props = null
ProtocolStack prot_stack = null
boolean receive_blocks = false
boolean receive_local_msgs = true
final Promise< Boolean > state_promise = new Promise<Boolean>()
boolean state_transfer_supported = false

Static Private Attributes

static final long FLUSH_UNBLOCK_TIMEOUT = 5000
static final long GET_STATE_DEFAULT_TIMEOUT = 5000

Classes

class  CloserThread

The documentation for this class was generated from the following file:

Generated by  Doxygen 1.6.0   Back to index