@Deprecated public class MuxChannel extends JChannel
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)
.
ChannelFactory.createMultiplexerChannel(String, String)
,
JChannelFactory.createMultiplexerChannel(String, String)
,
Multiplexer
additional_data, address_generator, closed, config, connected, DEFAULT_PROTOCOL_STACK, local_addr, log, name, received_bytes, received_msgs, sent_bytes, sent_msgs, stats
AUTO_GETSTATE, AUTO_RECONNECT, BLOCK, channel_listeners, GET_STATE_EVENTS, LOCAL, receiver, socket_factory, SUSPECT, up_handler, VIEW
Modifier and Type | Method and Description |
---|---|
void |
close()
Deprecated.
Destroys the channel.
|
void |
connect(String channel_name)
Deprecated.
Connects the channel to a group.
|
void |
connect(String cluster_name,
Address target,
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
|
Object |
downcall(Event evt)
Deprecated.
Can be used instead of down() when a return value is expected.
|
Map<String,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) !
|
String |
getChannelName()
Deprecated.
returns the name of the channel
if the channel is not connected or if it is closed it will return null
|
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.
|
String |
getId()
Deprecated.
|
Multiplexer |
getMultiplexer()
Deprecated.
|
String |
getProperties()
Deprecated.
Returns the protocol stack configuration in string format.
|
ProtocolStack |
getProtocolStack()
Deprecated.
Returns the protocol stack
|
String |
getStackName()
Deprecated.
|
boolean |
getState(Address target,
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,
String state_id)
Deprecated.
Returns a substate as indicated by state_id
|
void |
send(Address dst,
Address src,
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.
|
_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
addChannelListener, clearChannelListeners, getReceiver, getSocketFactory, getUpHandler, notifyChannelClosed, notifyChannelConnected, notifyChannelDisconnected, option2String, removeChannelListener, setChannelListener, setReceiver, setSocketFactory, setUpHandler
public String getStackName()
public String getId()
public Multiplexer getMultiplexer()
public String getChannelName()
JChannel
getChannelName
in class JChannel
public String getClusterName()
Channel
connect()
. Calling this method on a closed
channel returns null
.getClusterName
in class JChannel
public Address getAddress()
JChannel
getAddress
in class JChannel
public String getProperties()
JChannel
getProperties
in class JChannel
public JChannel getChannel()
public View getView()
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}public View getClusterView()
public ProtocolStack getProtocolStack()
JChannel
getProtocolStack
in class JChannel
public Map<String,Object> dumpStats()
JChannel
protected void setClosed(boolean f)
protected void setConnected(boolean f)
public void connect(String channel_name) throws ChannelException, ChannelClosedException
JChannel
connect
in class JChannel
channel_name
- A String
denoting the group name. Cannot be null.ChannelException
- The protocol stack cannot be startedChannelClosedException
- The channel is closed and therefore cannot be used any longer.
A new channel has to be created first.Channel.disconnect()
public void connect(String cluster_name, Address target, String state_id, long timeout) throws ChannelException
JChannel
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.
connect
in class JChannel
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.ChannelException
- The protocol stack cannot be startedChannelClosedException
- The channel is closed and therefore cannot be used any longer.
A new channel has to be created first.StateTransferException
- State transfer was not successfulpublic void disconnect()
JChannel
disconnect
in class JChannel
Channel.connect(String)
public void close()
JChannel
protected void notifyServiceDown()
public void open() throws ChannelException
JChannel
open
in class JChannel
ChannelException
public void shutdown()
JChannel
public void send(Message msg) throws ChannelNotConnectedException, ChannelClosedException
JChannel
send
in interface Transport
send
in class JChannel
msg
- the message to be sent through the protocol stack,
the destination of the message is specified inside the message itselfChannelNotConnectedException
- 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.public void send(Address dst, Address src, Serializable obj) throws ChannelNotConnectedException, ChannelClosedException
JChannel
send
in class JChannel
dst
- - the destination address of the message, null for all memberssrc
- - the source address of the messageobj
- - the value of the messageChannelNotConnectedException
ChannelClosedException
JChannel.send(org.jgroups.Message)
public void down(Event evt)
JChannel
public Object downcall(Event evt)
Channel
public boolean getState(Address target, String state_id, long timeout, boolean useFlushIfPresent) throws ChannelNotConnectedException, ChannelClosedException
JChannel
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.
getState
in class JChannel
target
- State provider. If null, coordinator is usedstate_id
- The ID of the substate. If null, the entire state will be
transferredtimeout
- the number of milliseconds to wait for the operation to
complete successfully. 0 waits until the state has been
receiveduseFlushIfPresent
- whether channel should be flushed prior to state retrievalChannelNotConnectedException
- if channel was not connected at the time state retrieval
was initiatedChannelClosedException
- if channel was closed at the time state retrieval was
initiatedExtendedMessageListener.getState(OutputStream)
,
ExtendedMessageListener.setState(InputStream)
,
MessageListener.getState()
,
MessageListener.setState(byte[])
public void returnState(byte[] state)
JChannel
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 applicationreturnState
in class JChannel
state
- The state of the application as a byte buffer
(to send over the network).public void returnState(byte[] state, String state_id)
JChannel
returnState
in class JChannel
Copyright © 2013 JBoss, a division of Red Hat. All Rights Reserved.