From 568b4e92244a0491e1761bfa42baeed9d8a99431 Mon Sep 17 00:00:00 2001
From: Arnaud Simon The retuned session is suspended
- * (i.e. this session is not attached with an underlying channel)
+ * The returned session is suspended
+ * (i.e. this session is not attached to an underlying channel)
*
- * @param expiryInSeconds Expiry time expressed in seconds, if the value is <= 0 then the session does not expire.
- * @return A Newly created (suspended) session.
+ * @param expiryInSeconds Expiry time expressed in seconds, if the value is less than
+ * or equal to 0 then the session does not expire.
+ * @return A newly created (suspended) session.
*/
public Session createSession(long expiryInSeconds);
@@ -70,17 +70,17 @@ public interface Connection
* The retuned DtxSession is suspended
* (i.e. this session is not attached with an underlying channel)
*
- * @param expiryInSeconds Expiry time expressed in seconds, if the value is <= 0 then the session does not expire.
- * @return A Newly created (suspended) DtxSession.
+ * @param expiryInSeconds Expiry time expressed in seconds, if the value is less than or equal
+ * to 0 then the session does not expire.
+ * @return A newly created (suspended) DtxSession.
*/
public DtxSession createDTXSession(int expiryInSeconds);
/**
* If the communication layer detects a serious problem with a connection, it
- * informs the connection's ExceptionListener
+ * informs the connection's ClosedListener
*
- * @param exceptionListner The execptionListener
+ * @param exceptionListner The ClosedListener
*/
-
public void setClosedListener(ClosedListener exceptionListner);
}
diff --git a/java/client/src/main/java/org/apache/qpidity/nclient/DtxSession.java b/java/client/src/main/java/org/apache/qpidity/nclient/DtxSession.java
index 6bf351a014..6f15f16470 100644
--- a/java/client/src/main/java/org/apache/qpidity/nclient/DtxSession.java
+++ b/java/client/src/main/java/org/apache/qpidity/nclient/DtxSession.java
@@ -26,7 +26,7 @@ import org.apache.qpidity.transport.XaResult;
import org.apache.qpidity.transport.Xid;
/**
- * This session�s resources are control under the scope of a distributed transaction.
+ * The resources for this session are controlled under the scope of a distributed transaction.
*/
public interface DtxSession extends Session
{
@@ -47,7 +47,7 @@ public interface DtxSession extends Session
public Future A session is associated with a connection.
- * When created a Session is not attached with an underlying channel.
- * Session is single threaded This is a convinience method for providing a complete message
- * using a single method which internaly is mapped to messageTransfer(), headers() followed
- * by data() and an endData().
- * This method should only be used by small messages This transfer provides a complete message
+ * using a single method. The method is internally mapped to messageTransfer() and headers() followed
+ * by data() and endData().
+ * This method should only be used by small messages. This is a convinience method for streaming a message using pull semantics
- * using a single method as opposed to doing a push using messageTransfer(), headers() followed
- * by a series of data() and an endData(). Internally data will be pulled from Message object(which wrap's a data stream) using it's read()
- * and pushed using messageTransfer(), headers() followed by a series of data() and an endData().
+ * This transfer streams a complete message using a single method.
+ * It uses pull-semantics instead of doing a push. Data is pulled from a Message object using read()
+ * and pushed using messageTransfer() and headers() followed by data() and endData().
*
@@ -60,21 +60,21 @@ public interface DtxSession extends Session
*
* @param xid Specifies the xid of the transaction branch to be ended.
* @param options Available options are: {@link Option#FAIL} and {@link Option#SUSPEND}.
- * @return Confirms to the client that the transaction branch is ended or specify the error condition.
+ * @return Confirms to the client that the transaction branch is ended or specifies the error condition.
*/
public Future
- * This is up to the implementation to assembled the message when the different parts
+ * It is up to the implementation to assemble the message once the different parts
* are transferred.
*/
public interface MessagePartListener
@@ -37,22 +37,21 @@ public interface MessagePartListener
/**
* Indicates the Message transfer has started.
*
- * @param transferId
+ * @param transferId The message transfer ID.
*/
public void messageTransfer(int transferId);
/**
- * Add the following headers ( {@link org.apache.qpidity.DeliveryProperties}
- * or {@link org.apache.qpidity.ApplicationProperties} ) to the message being received.
+ * Add the following a header to the message being received.
*
- * @param headers Either
- *
*
* @param xid Specifies the xid of the transaction branch to be committed.
* @param options Available option is: {@link Option#ONE_PHASE}
- * @return Confirms to the client that the transaction branch is committed or specify the error condition.
+ * @return Confirms to the client that the transaction branch is committed or specifies the error condition.
*/
public FutureDeliveryProperties or ApplicationProperties
+ * @param header Either DeliveryProperties or ApplicationProperties
*/
public void messageHeader(Header header);
/**
* Add the following byte array to the content of the message being received
*
- * @param data Data to be added or streamed.
+ * @param src Data to be added or streamed.
*/
public void data(ByteBuffer src);
diff --git a/java/client/src/main/java/org/apache/qpidity/nclient/Session.java b/java/client/src/main/java/org/apache/qpidity/nclient/Session.java
index e2dcd53854..65b3685f86 100644
--- a/java/client/src/main/java/org/apache/qpidity/nclient/Session.java
+++ b/java/client/src/main/java/org/apache/qpidity/nclient/Session.java
@@ -27,11 +27,11 @@ import org.apache.qpidity.api.Message;
/**
* command1 will be synchronously invoked using the following sequence:
+ * All the Session commands are asynchronous. Synchronous behavior is achieved through invoking the sync method.
+ * For example, command1 will be synchronously invoked by using the following sequence:
*
*
* @param acquireMode session.command1()
* session.sync()
@@ -58,7 +58,7 @@ public interface Session
//------------------------------------------------------
/**
- * Sync method will block until all outstanding commands
+ * Sync method will block the session until all outstanding commands
* are executed.
*/
public void sync();
@@ -74,125 +74,102 @@ public interface Session
// Producer
//------------------------------------------------------
/**
- * Transfer the given
- *
- * to a specified exchange.
+ * Transfer a message to a specified exchange.
*
- *
*
- * @throws java.io.IOException If transferring a message fails due to some internal communication error.
+ * @throws java.io.IOException If transferring a message fails due to some internal communication error, an exception is thrown.
*/
public void messageTransfer(String destination, Message msg, short confirmMode, short acquireMode)
throws IOException;
/**
- *
This method should only be used by large messages
- * There are two convinience Message classes provided to facilitate this.
+ * There are two convenience Message classes to do this.
*
*
- * You could also implement a the {@link org.apache.qpidity.nclient.util.FileMessage}
* {@link org.apache.qpidity.nclient.util.StreamingMessage}
* Message interface to and wrap any
- * data stream you want.
+ * You can also implement a Message interface to wrap any
+ * data stream.
*
This way of transferring messages is useful when streaming large messages - *
In the interval [messageTransfer endData] any attempt to call a method other than - * {@link Session#header}, {@link Session#endData} ore {@link Session#sessionClose} - * will result in an exception being thrown. + * This command transfers a message between two peers. * - * @param destination The exchange the message is being sent. - * @param confirmMode
{@link org.apache.qpidity.transport.DeliveryProperties}
- * or {@link org.apache.qpidity.transport.MessageProperties}
+ * @param headers headers to be added
* @see org.apache.qpidity.transport.DeliveryProperties
* @see org.apache.qpidity.transport.MessageProperties
+ * @return The added headers.
*/
public Header header(Struct... headers);
/**
- * Add the following byte array to the content of the message being sent.
+ * Add a byte array to the content of the message being sent.
*
* @param data Data to be added.
*/
public void data(byte[] data);
/**
- * Add the following ByteBuffer to the content of the message being sent.
- * Note that only the data between the buffer current position and the + * A Add a ByteBuffer to the content of the message being sent. + *
Note that only the data between the buffer's current position and the * buffer limit is added. * It is therefore recommended to flip the buffer before adding it to the message, * @@ -201,7 +178,7 @@ public interface Session public void data(ByteBuffer buf); /** - * Add the following String to the content of the message being sent. + * Add a string to the content of the message being sent. * * @param str String to be added. */ @@ -219,61 +196,58 @@ public interface Session /** * Associate a message listener with a destination. - *
The destination is bound to a queue and messages are filtered based - * on the provider filter map (message filtering is specific to the provider and may not be handled). - *
Following are valid options: + *
The destination is bound to a queue, and messages are filtered based + * on the provider filter map (message filtering is specific to the provider and in some cases might not be handled). + *
The valid options are: *
If the no-local field is set the server will not send - * messages to the connection that - * published them. - *
Request exclusive subscription access, meaning only this - * ubscription can access the queue. - *
Has no effect as it represents an �empty� option. + *
Requests exclusive subscription access, so that only this + * subscription can access the queue. + *
This is an empty option, and has no effect. *
Only one listerner per destination is allowed. This means - * that the previous message listener is replaced. This is done gracefully i.e. the message - * listener is replaced once it return from the processing of a message. + * Associate a message listener with a destination. + *
Only one listener is permitted for each destination. When a new listener is created, + * it replaces the previous message listener. To prevent message loss, this occurs only when the original listener + * has completed processing a message. * * @param destination The destination the listener is associated with. * @param listener The new listener for this destination. @@ -320,39 +294,39 @@ public interface Session /** * Forces the broker to exhaust its credit supply. - *
The broker's credit will always be zero when - * this method completes. + *
The credit on the broker will remain at zero once + * this method is completed. * - * @param destination The destination to call flush on. + * @param destination The destination on which the credit supply is to be exhausted. */ public void messageFlush(String destination); /** - * On receipt of this method, the brokers MUST set his credit to zero for the given - * destination. This obeys the generic semantics of command completion, i.e. when confirmation - * is issued credit MUST be zero and no further messages will be sent until such a time as + * On receipt of this method, the brokers set credit to zero for a given + * destination. When confirmation of this method + * is issued credit is set to zero. No further messages will be sent until * further credit is received. * - * @param destination The destination to stop. + * @param destination The destination on which to reset credit. */ public void messageStop(String destination); /** - * Acknowledge the receipt of ranges of messages. - *
Message must have been previously acquired either by receiving them in + * Acknowledge the receipt of a range of messages. + *
Messages must already be acquired, either by receiving them in * pre-acquire mode or by explicitly acquiring them. * - * @param ranges Range of acknowledged messages. + * @param ranges Range of messages to be acknowledged. */ public void messageAcknowledge(RangeSet ranges); /** - * Reject ranges of acquired messages. - *
The broker MUST deliver rejected messages to the - * alternate-exchange on the queue from which it was delivered. If no alternate-exchange is - * defined for that queue the broker MAY discard the message. + * Reject a range of acquired messages. + *
The broker will deliver rejected messages to the + * alternate-exchange on the queue from which it came. If no alternate-exchange is + * defined for that queue the broker will discard the message. * - * @param ranges Range of rejected messages. + * @param ranges Range of messages to be rejected. * @param code The reject code must be one of {@link Session#MESSAGE_REJECT_CODE_GENERIC} or * {@link Session#MESSAGE_REJECT_CODE_IMMEDIATE_DELIVERY_FAILED} (immediate delivery was attempted but * failed). @@ -385,6 +359,7 @@ public interface Session *
This method should only be called on non-acquired messages.
*
* @param ranges Ranges of messages to be acquired.
+ * @return Indicates the acquired messages
*/
public Future Released messages are re-enqueued.
*
* @param ranges Ranges of messages to be released.
+ * @param options Valid option is: {@link Option#SET_REDELIVERED})
*/
public void messageRelease(RangeSet ranges, Option ... options);
@@ -405,16 +381,16 @@ public interface Session
public void txSelect();
/**
- * Commit the receipt and the delivery of all messages exchanged by this session resources.
+ * Commit the receipt and delivery of all messages exchanged by this session's resources.
*
- * @throws IllegalStateException If this session is not transacted.
+ * @throws IllegalStateException If this session is not transacted, an exception will be thrown.
*/
public void txCommit() throws IllegalStateException;
/**
- * Rollback the receipt and the delivery of all messages exchanged by this session resources.
+ * Roll back the receipt and delivery of all messages exchanged by this session's resources.
*
- * @throws IllegalStateException If this session is not transacted.
+ * @throws IllegalStateException If this session is not transacted, an exception will be thrown.
*/
public void txRollback() throws IllegalStateException;
@@ -544,17 +520,17 @@ public interface Session
// --------------------------------------
/**
- * This method creates an exchange if it does not already exist, and if the exchange exists,
- * verifies that it is of the correct and expected class.
- * Following are the valid options:
+ * This method creates an exchange. If the exchange already exists,
+ * the method verifies the class and checks the details are correct.
+ * Valid options are:
* If set, the exchange is deleted when all queues have finished using it.
- * If set when creating a new exchange, the exchange will
+ * If set, the exchange is deleted when all queues have finished using it.
+ * If set, the exchange will
* be marked as durable. Durable exchanges remain active when a server restarts. Non-durable exchanges (transient
- * exchanges) are purged if/when a server restarts.
- * If set, the server will not create the exchange.
+ * exchanges) are purged when a server restarts.
+ * If set, the server will not create the exchange.
* The client can use this to check whether an exchange exists without modifying the server state.
- * Has no effect as it represents an �empty� option.
+ * This option is an empty option, and has no effect.
* In the absence of a particular option, the defaul value is false for each option If set, the server will only delete the exchange if it has no queue bindings. If the
* exchange has queue bindings the server does not delete it but raises a channel exception
* instead.
- * Has no effect as it represents an �empty� option.
+ * Has no effect as it represents an empty option.
*
- *
*
In the absence of a particular option, the defaul value is false for each option + *
Note that if an option is not set, it will default to false.
*
* @param exchangeName The name of exchange to be deleted.
- * @param options Set of options (valid options are: {@link Option#IF_UNUSED}, {@link Option#NO_OPTION})
+ * @param options Set of options. Valid options are: {@link Option#IF_UNUSED}, {@link Option#NO_OPTION}.
* @see Option
*/
public void exchangeDelete(String exchangeName, Option... options);
/**
- * This method is used to request information on a particular exchange.
+ * This method is used to request information about a particular exchange.
*
- * @param exchangeName The name of the exchange for which information is requested. If not specified explicitly
- * the default exchange is implied.
+ * @param exchangeName The name of the exchange about which information is requested. If not set, the method will
+ * return information about the default exchange.
* @return Information on the specified exchange.
*/
public Future