org.jgroups.mux
Class MuxChannel

java.lang.Object
  extended by org.jgroups.Channel
      extended by org.jgroups.JChannel
          extended by org.jgroups.mux.MuxChannel
All Implemented Interfaces:
Transport

Deprecated.

@Deprecated
public class MuxChannel
extends JChannel

Multiplexer channel is a lightweight version of a regular channel where multiple MuxChannel(s) share the same underlying regular channel.

MuxChannel has to be created with a unique application id. The multiplexer keeps track of all registered applications and tags messages belonging to a specific application with that id for sent messages. When receiving a message from a remote peer, the multiplexer will dispatch a message to the appropriate MuxChannel depending on the id attached to the message.

MuxChannel is created using ChannelFactory.createMultiplexerChannel(String, String).

Since:
2.4
Author:
Bela Ban, Vladimir Blagojevic
See Also:
ChannelFactory.createMultiplexerChannel(String, String), JChannelFactory.createMultiplexerChannel(String, String), Multiplexer

Field Summary
 
Fields inherited from class org.jgroups.JChannel
additional_data, address_generator, closed, config, connected, DEFAULT_PROTOCOL_STACK, local_addr, log, name, received_bytes, received_msgs, sent_bytes, sent_msgs, stats
 
Fields inherited from class org.jgroups.Channel
AUTO_GETSTATE, AUTO_RECONNECT, BLOCK, channel_listeners, GET_STATE_EVENTS, LOCAL, receiver, socket_factory, SUSPECT, up_handler, VIEW
 
Method Summary
 void close()
          Deprecated. Destroys the channel.
 void connect(java.lang.String channel_name)
          Deprecated. Connects the channel to a group.
 void connect(java.lang.String cluster_name, Address target, java.lang.String state_id, long timeout)
          Deprecated. Connects this channel to a group and gets a state from a specified state provider.
 void disconnect()
          Deprecated. Disconnects the channel if it is connected.
 void down(Event evt)
          Deprecated. Sends a message through the protocol stack if the stack is available
 java.lang.Object downcall(Event evt)
          Deprecated. Can be used instead of down() when a return value is expected.
 java.util.Map<java.lang.String,java.lang.Object> dumpStats()
          Deprecated. Returns a map of statistics of the various protocols and of the channel itself.
 Address getAddress()
          Deprecated. Returns the local address of the channel (null if the channel is closed)
 JChannel getChannel()
          Deprecated. This should never be used (just for testing) !
 java.lang.String getChannelName()
          Deprecated. returns the name of the channel if the channel is not connected or if it is closed it will return null
 java.lang.String getClusterName()
          Deprecated. Returns the cluster name of the group of which the channel is a member.
 View getClusterView()
          Deprecated. Returns the JGroups view of a cluster, e.g.
 java.lang.String getId()
          Deprecated.  
 Multiplexer getMultiplexer()
          Deprecated.  
 java.lang.String getProperties()
          Deprecated. Returns the protocol stack configuration in string format.
 ProtocolStack getProtocolStack()
          Deprecated. Returns the protocol stack
 java.lang.String getStackName()
          Deprecated.  
 boolean getState(Address target, java.lang.String state_id, long timeout, boolean useFlushIfPresent)
          Deprecated. Retrieves a substate (or partial state) indicated by state_id from the target member.
 View getView()
          Deprecated. Returns the service view, ie.
protected  void notifyServiceDown()
          Deprecated.  
 void open()
          Deprecated. Opens the channel.
 void returnState(byte[] state)
          Deprecated. Called by the application is response to receiving a getState() object when calling receive().
 void returnState(byte[] state, java.lang.String state_id)
          Deprecated. Returns a substate as indicated by state_id
 void send(Address dst, Address src, java.io.Serializable obj)
          Deprecated. creates a new message with the destination address, and the source address and the object as the message value
 void send(Message msg)
          Deprecated. Sends a message through the protocol stack.
protected  void setClosed(boolean f)
          Deprecated.  
protected  void setConnected(boolean f)
          Deprecated.  
 void shutdown()
          Deprecated. Shuts down a channel without disconnecting.
 
Methods inherited from class org.jgroups.JChannel
_close, blockOk, checkClosed, checkClosedOrNotConnected, closeMessageQueue, connect, connect, dumpChannelStats, dumpQueue, dumpStats, dumpStats, dumpTimerQueue, enableStats, flushSupported, getAddressAsString, getAddressAsUUID, getAddressGenerator, getAllStates, getInfo, getLocalAddress, getLog, getName, getName, getNumberOfTasksInTimer, getNumMessages, getOpt, getReceivedBytes, getReceivedMessages, getSentBytes, getSentMessages, getState, getState, getState, getTimerThreads, getVersion, getViewAsString, init, init, isConnected, isOpen, peek, printProtocolSpec, receive, resetStats, send, send, setAddress, setAddressGenerator, setInfo, setName, setOpt, setProtocolStack, startFlush, startFlush, startFlush, statsEnabled, stopFlush, stopFlush, stopStack, toString, up
 
Methods inherited from class org.jgroups.Channel
addChannelListener, clearChannelListeners, getReceiver, getSocketFactory, getUpHandler, notifyChannelClosed, notifyChannelConnected, notifyChannelDisconnected, option2String, removeChannelListener, setChannelListener, setReceiver, setSocketFactory, setUpHandler
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getStackName

public java.lang.String getStackName()
Deprecated. 

getId

public java.lang.String getId()
Deprecated. 

getMultiplexer

public Multiplexer getMultiplexer()
Deprecated. 

getChannelName

public java.lang.String getChannelName()
Deprecated. 
Description copied from class: JChannel
returns the name of the channel if the channel is not connected or if it is closed it will return null

Overrides:
getChannelName in class JChannel
Returns:
The group address

getClusterName

public java.lang.String getClusterName()
Deprecated. 
Description copied from class: Channel
Returns the cluster name of the group of which the channel is a member. This is the object that was the argument to connect(). Calling this method on a closed channel returns null.

Overrides:
getClusterName in class JChannel
Returns:
The cluster name

getAddress

public Address getAddress()
Deprecated. 
Description copied from class: JChannel
Returns the local address of the channel (null if the channel is closed)

Overrides:
getAddress in class JChannel
Returns:
The channel's address (opaque)

getProperties

public java.lang.String getProperties()
Deprecated. 
Description copied from class: JChannel
Returns the protocol stack configuration in string format. An example of this property is
"UDP:PING:FD:STABLE:NAKACK:UNICAST:FRAG:FLUSH:GMS:VIEW_ENFORCER:STATE_TRANSFER:QUEUE"

Overrides:
getProperties in class JChannel

getChannel

public JChannel getChannel()
Deprecated. 
This should never be used (just for testing) !


getView

public View getView()
Deprecated. 
Returns the service view, ie. the cluster view (see getView()) minus the nodes on which this service is not running, e.g. if S1 runs on A and C, and the cluster view is {A,B,C}, then the service view is {A,C}

Overrides:
getView in class JChannel
Returns:
The service view (list of nodes on which this service is running)

getClusterView

public View getClusterView()
Deprecated. 
Returns the JGroups view of a cluster, e.g. if we have nodes A, B and C, then the view will be {A,B,C}

Returns:
The JGroups view

getProtocolStack

public ProtocolStack getProtocolStack()
Deprecated. 
Description copied from class: JChannel
Returns the protocol stack

Overrides:
getProtocolStack in class JChannel

dumpStats

public java.util.Map<java.lang.String,java.lang.Object> dumpStats()
Deprecated. 
Description copied from class: JChannel
Returns a map of statistics of the various protocols and of the channel itself.

Overrides:
dumpStats in class JChannel
Returns:
Map. A map where the keys are the protocols ("channel" pseudo key is used for the channel itself") and the values are property maps.

setClosed

protected void setClosed(boolean f)
Deprecated. 

setConnected

protected void setConnected(boolean f)
Deprecated. 

connect

public void connect(java.lang.String channel_name)
             throws ChannelException,
                    ChannelClosedException
Deprecated. 
Description copied from class: JChannel
Connects the channel to a group. If the channel is already connected, an error message will be printed to the error log. If the channel is closed a ChannelClosed exception will be thrown. This method starts the protocol stack by calling ProtocolStack.start, then it sends an Event.CONNECT event down the stack and waits for the return value. Once the call returns, the channel listeners are notified and the channel is considered connected.

Overrides:
connect in class JChannel
Parameters:
channel_name - A String denoting the group name. Cannot be null.
Throws:
ChannelException - The protocol stack cannot be started
ChannelClosedException - The channel is closed and therefore cannot be used any longer. A new channel has to be created first.
See Also:
Channel.disconnect()

connect

public void connect(java.lang.String cluster_name,
                    Address target,
                    java.lang.String state_id,
                    long timeout)
             throws ChannelException
Deprecated. 
Description copied from class: JChannel
Connects this channel to a group and gets a state from a specified state provider.

This method essentially invokes connect and getState methods successively. If FLUSH protocol is in channel's stack definition only one flush is executed for both connecting and fetching state rather than two flushes if we invoke connect and getState in succesion. If the channel is already connected, an error message will be printed to the error log. If the channel is closed a ChannelClosed exception will be thrown.

Overrides:
connect in class JChannel
Parameters:
cluster_name - the cluster name to connect to. Cannot be null.
target - the state provider. If null state will be fetched from coordinator, unless this channel is coordinator.
state_id - the substate id for partial state transfer. If null entire state will be transferred.
timeout - the timeout for state transfer.
Throws:
ChannelException - The protocol stack cannot be started
ChannelClosedException - The channel is closed and therefore cannot be used any longer. A new channel has to be created first.
StateTransferException - State transfer was not successful

disconnect

public void disconnect()
Deprecated. 
Description copied from class: JChannel
Disconnects the channel if it is connected. If the channel is closed, this operation is ignored
Otherwise the following actions happen in the listed order
  1. The JChannel sends a DISCONNECT event down the protocol stack
  2. Blocks until the event has returned
  3. Sends a STOP_QUEING event down the stack
  4. Stops the protocol stack by calling ProtocolStack.stop()
  5. Notifies the listener, if the listener is available

Overrides:
disconnect in class JChannel
See Also:
Channel.connect(String)

close

public void close()
Deprecated. 
Description copied from class: JChannel
Destroys the channel. After this method has been called, the channel us unusable.
This operation will disconnect the channel and close the channel receive queue immediately

Overrides:
close in class JChannel

notifyServiceDown

protected void notifyServiceDown()
Deprecated. 

open

public void open()
          throws ChannelException
Deprecated. 
Description copied from class: JChannel
Opens the channel. Note that the channel is only open, but not connected. This does the following actions:
  1. Resets the receiver queue by calling Queue.reset
  2. Sets up the protocol stack by calling ProtocolStack.setup
  3. Sets the closed flag to false

Overrides:
open in class JChannel
Throws:
ChannelException

shutdown

public void shutdown()
Deprecated. 
Description copied from class: JChannel
Shuts down a channel without disconnecting. To be used by tests only, don't use for application purposes

Overrides:
shutdown in class JChannel

send

public void send(Message msg)
          throws ChannelNotConnectedException,
                 ChannelClosedException
Deprecated. 
Description copied from class: JChannel
Sends a message through the protocol stack. Implements the Transport interface.

Specified by:
send in interface Transport
Overrides:
send in class JChannel
Parameters:
msg - the message to be sent through the protocol stack, the destination of the message is specified inside the message itself
Throws:
ChannelNotConnectedException - The channel must be connected to send messages.
ChannelClosedException - The channel is closed and therefore cannot be used any longer. A new channel has to be created first.

send

public void send(Address dst,
                 Address src,
                 java.io.Serializable obj)
          throws ChannelNotConnectedException,
                 ChannelClosedException
Deprecated. 
Description copied from class: JChannel
creates a new message with the destination address, and the source address and the object as the message value

Overrides:
send in class JChannel
Parameters:
dst - - the destination address of the message, null for all members
src - - the source address of the message
obj - - the value of the message
Throws:
ChannelNotConnectedException
ChannelClosedException
See Also:
JChannel.send(org.jgroups.Message)

down

public void down(Event evt)
Deprecated. 
Description copied from class: JChannel
Sends a message through the protocol stack if the stack is available

Overrides:
down in class JChannel
Parameters:
evt - the message to send down, encapsulated in an event

downcall

public java.lang.Object downcall(Event evt)
Deprecated. 
Description copied from class: Channel
Can be used instead of down() when a return value is expected. This will be removed in 3.0 when we change the signature of down() to return Object rather than void

Overrides:
downcall in class JChannel
Returns:

getState

public boolean getState(Address target,
                        java.lang.String state_id,
                        long timeout,
                        boolean useFlushIfPresent)
                 throws ChannelNotConnectedException,
                        ChannelClosedException
Deprecated. 
Description copied from class: JChannel
Retrieves a substate (or partial state) indicated by state_id from the target member.

State transfer is initiated by invoking getState on this channel, state receiver, and sending a GET_STATE message to a target member - state provider. State provider passes GET_STATE message to application that is using the state provider channel which in turn provides an application state to a state receiver. Upon successful installation of a state at state receiver this method returns true.

Overrides:
getState in class JChannel
Parameters:
target - State provider. If null, coordinator is used
state_id - The ID of the substate. If null, the entire state will be transferred
timeout - the number of milliseconds to wait for the operation to complete successfully. 0 waits until the state has been received
useFlushIfPresent - whether channel should be flushed prior to state retrieval
Returns:
true if state transfer was successful, false otherwise
Throws:
ChannelNotConnectedException - if channel was not connected at the time state retrieval was initiated
ChannelClosedException - if channel was closed at the time state retrieval was initiated
See Also:
ExtendedMessageListener.getState(OutputStream), ExtendedMessageListener.setState(InputStream), MessageListener.getState(), MessageListener.setState(byte[])

returnState

public void returnState(byte[] state)
Deprecated. 
Description copied from class: JChannel
Called by the application is response to receiving a getState() object when calling receive(). When the application receives a getState() message on the receive() method, it should call returnState() to reply with the state of the application

Overrides:
returnState in class JChannel
Parameters:
state - The state of the application as a byte buffer (to send over the network).

returnState

public void returnState(byte[] state,
                        java.lang.String state_id)
Deprecated. 
Description copied from class: JChannel
Returns a substate as indicated by state_id

Overrides:
returnState in class JChannel


Copyright © 1998-2009 Bela Ban / Red Hat. All Rights Reserved.