Class Draw
java.lang.Object
org.jgroups.demos.Draw
- All Implemented Interfaces:
ActionListener, EventListener, ChannelListener, Receiver
Shared whiteboard, each new instance joins the same group. Each instance chooses a random color,
mouse moves are broadcast to all group members, which then apply them to their canvas
- Author:
- Bela Ban, Oct 17 2001
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidchannelConnected(JChannel channel) Channel has been connected notification callbackvoidchannelDisconnected(JChannel channel) Channel has been disconnected notification callbackvoidvoidgetState(OutputStream ostream) Allows an application to write the state to an OutputStream.voidgo()static voidvoidCalled when a message is received.voidprotected voidsendOwnState(Map<Point, Color> copy) voidsetClusterName(String clustername) voidsetState(InputStream istream) Allows an application to read the state from an InputStream.voidstop()voidviewAccepted(View v) Called when a change in membership has occurred.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ChannelListener
channelClosed
-
Field Details
-
cluster_name
-
send_own_state_on_merge
protected boolean send_own_state_on_merge
-
-
Constructor Details
-
Draw
public Draw(String props, boolean no_channel, boolean jmx, boolean use_state, long state_timeout, boolean use_unicasts, String name, boolean send_own_state_on_merge, AddressGenerator gen) throws Exception - Throws:
Exception
-
Draw
-
Draw
-
-
Method Details
-
getClusterName
-
setClusterName
-
main
-
go
-
receive
-
viewAccepted
Description copied from interface:ReceiverCalled when a change in membership has occurred. No long running actions, sending of messages or anything that could block should be done in this callback. If some long running action needs to be performed, it should be done in a separate thread.
Note that on reception of the first view (a new member just joined), the channel will not yet be in the connected state. This only happens whenJChannel.connect(String)returns.- Specified by:
viewAcceptedin interfaceReceiver
-
getState
Description copied from interface:ReceiverAllows an application to write the state to an OutputStream. After the state has been written, the OutputStream doesn't need to be closed as stream closing is automatically done when a calling thread returns from this callback. -
setState
Description copied from interface:ReceiverAllows an application to read the state from an InputStream. After the state has been read, the InputStream doesn't need to be closed as stream closing is automatically done when a calling thread returns from this callback. -
clearPanel
public void clearPanel() -
sendClearPanelMsg
public void sendClearPanelMsg() -
actionPerformed
- Specified by:
actionPerformedin interfaceActionListener
-
stop
public void stop() -
sendOwnState
-
channelConnected
Description copied from interface:ChannelListenerChannel has been connected notification callback- Specified by:
channelConnectedin interfaceChannelListener- Parameters:
channel- the channel that has been connected
-
channelDisconnected
Description copied from interface:ChannelListenerChannel has been disconnected notification callback- Specified by:
channelDisconnectedin interfaceChannelListener- Parameters:
channel- the disconnected channel
-