[Spread-users] [PATCH] Java documentation

Daniel Rall dlr at finemaltcoding.com
Wed Jul 25 17:36:14 EDT 2001


This is a minor patch for the Java documentation at:
http://www.spread.org/docs/javadocs/java.html

o Corrected sytax of import statement.

o Corrected SpreadMessage method name...as catchy as it was, it didn't
match the API (setDelfDiscared -> setSelfDiscard).

o Removed the comparison to true in an if statement.

o Changed some wording to read a little better.

This is a great document for immediately getting started using Spread!

- Dan


--- java.html-ORIG	Wed Jul 25 12:44:24 2001
+++ java.html	Wed Jul 25 14:00:56 2001
@@ -211,7 +211,7 @@
 should be in your classpath.  For Java 1.1, this is done by making sure the directory containing spread.jar
 is in the CLASSPATH enviornment variable.  For Java2 this is done by using the "-classpath" option on the command line when compiling or running any classes that user Spread.  For applets, simply put spread.jar in the same directory as the applet class. To access the Spread classes from any classes you write, simply include the following line at the top of the .java file:
 <P><CODE>
-import spread;
+import spread.*;
 </CODE><P>
 <P>
 
@@ -270,7 +270,7 @@
 message.addGroup("group");<BR>
 message.setReliable();
 </CODE><P>
-The setData() method sets the message's data to an array of bytes.  Alternatives to setData() are setObject() and digest(), each of which takes an object that implements the Serializable interface.  setObject() is used for sending one Java object, while repeatedly calling digest() can be used to send multiple objects in one message.  The addGroup() method is used to specify a group to send the message to.  The setReliable() is used to set the delivery method.  Possible delivery methods are: unreliable, reliable, fifo, causal, agreed, and safe.  The setDelfDiscard() method can be used to specify that this message should not be sent back to the user who is sending it.
+The setData() method sets the message's data to an array of bytes.  Alternatives to setData() are setObject() and digest(), each of which takes an object that implements the Serializable interface.  setObject() is used for sending one Java object, while repeatedly calling digest() can be used to send multiple objects in one message.  The addGroup() method is used to specify a group to send the message to.  The setReliable() is used to set the delivery method.  Possible delivery methods are: unreliable, reliable, fifo, causal, agreed, and safe.  The setSelfDiscard() method can be used to specify that this message should not be sent back to the user who is sending it.
 To actually send the message, use SpreadConnection's multicast() method:
 <P><CODE>
 connection.multicast(message);
@@ -288,7 +288,7 @@
 <BR>
 The isRegular() method can be used to check if the message is a regular message.  Otherwise, it is a membership message.  Membership messages will only be received if they are request by passing true as the final arguement to SpreadConnection's connect() method.  If the message is a regular message, the get*() methods in SpreadMessage will provide more information about the message.  If the message is a membership message, the getMembershipInfo() method can be used to return a MembershipInfo object, which provides information about the membership change.
 <P><CODE>
-if(message.isRegular() == true)<BR>
+if(message.isRegular())<BR>
 &nbsp;&nbsp;&nbsp;&nbsp;System.out.println("New message from " + message.getSender());<BR>
 else<BR>
 &nbsp;&nbsp;&nbsp;&nbsp;System.out.println("New membership message from " + message.getMembershipInfo().getGroup());
@@ -327,7 +327,7 @@
 <P>
 <A NAME="listeners">
 <H3><EM>Listeners</EM></H3>
-In addition to using SpreadConnection's receive() method, there is another way to receive messages.  This is by the use of two interfaces: BasicMessageListener and AdvancedMessageListener.  To use a listener, first implement one of these two interfaces.  Then add them to a connection with one of SpreadConnection's add() methods:
+In addition to using SpreadConnection's receive() method, there is another way to receive messages.  This is by the use of two interfaces: BasicMessageListener and AdvancedMessageListener.  To use a listener, first implement one of these two interfaces.  Then add an instance of your implementation to a connection with one of SpreadConnection's add() methods:
 <P><CODE>
 connection.add(listener);
 </CODE><P>





More information about the Spread-users mailing list