|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jgroups.Channel org.jgroups.JChannel org.jgroups.mux.MuxChannel
@Deprecated public class MuxChannel
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)
.
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.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 |
---|
public java.lang.String getStackName()
public java.lang.String getId()
public Multiplexer getMultiplexer()
public java.lang.String getChannelName()
JChannel
getChannelName
in class JChannel
public java.lang.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 java.lang.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}
getView
in class JChannel
public View getClusterView()
public ProtocolStack getProtocolStack()
JChannel
getProtocolStack
in class JChannel
public java.util.Map<java.lang.String,java.lang.Object> dumpStats()
JChannel
dumpStats
in class JChannel
protected void setClosed(boolean f)
protected void setConnected(boolean f)
public void connect(java.lang.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 started
ChannelClosedException
- The channel is closed and therefore cannot be used any longer.
A new channel has to be created first.Channel.disconnect()
public void connect(java.lang.String cluster_name, Address target, java.lang.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.
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 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
public void disconnect()
JChannel
disconnect
in class JChannel
Channel.connect(String)
public void close()
JChannel
close
in class JChannel
protected void notifyServiceDown()
public void open() throws ChannelException
JChannel
open
in class JChannel
ChannelException
public void shutdown()
JChannel
shutdown
in class 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 itself
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.public void send(Address dst, Address src, java.io.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 message
ChannelNotConnectedException
ChannelClosedException
JChannel.send(org.jgroups.Message)
public void down(Event evt)
JChannel
down
in class JChannel
evt
- the message to send down, encapsulated in an eventpublic java.lang.Object downcall(Event evt)
Channel
downcall
in class JChannel
public boolean getState(Address target, java.lang.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 retrieval
ChannelNotConnectedException
- if channel was not connected at the time state retrieval
was initiated
ChannelClosedException
- 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 application
returnState
in class JChannel
state
- The state of the application as a byte buffer
(to send over the network).public void returnState(byte[] state, java.lang.String state_id)
JChannel
returnState
in class JChannel
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |