User: hiram
Date: 00/12/11 21:59:03
Modified: src/java/org/spydermq SpyMessage.java Mutex.java
SpyBytesMessage.java SpyConnection.java
SpyObjectMessage.java SpyTopicConnection.java
SpyMapMessage.java SpyDistributedConnection.java
SpyTopic.java SpyAcknowledgementItem.java
SpyTopicSession.java SpyQueueSender.java
NoReceiverException.java SpyMessageProducer.java
SpyConnectionMetaData.java SpySession.java
SpyDestination.java SpyTextMessage.java
SpyStreamMessage.java SpyQueue.java
SpyQueueBrowser.java SpyQueueSession.java
SpyQueueConnection.java SpyTemporaryTopic.java
SpyTemporaryQueue.java
Added: src/java/org/spydermq SpyTopicConnectionFactory.java
SpyQueueConnectionFactory.java Transaction.java
Removed: src/java/org/spydermq JMSServer.java JMSServerQueue.java
JMSServerQueueReceiver.java JMSServerMBean.java
Log:
Several Chanages:
- Invocation layer simplified by joing the DistributedQueueConnectionFactory and
DistributedTopicConnectionFactory into DistributedConnectionFactory
- Seperated server code from client code ( server code moved to org.spydermq.server )
- All publish() calls are now sync to the provider.
- Added a Transaction class to better represent a commit/rollback request to the
server.
- Now have a InvocationLayerFactory so that we can potentialy load multiple
invocation layers (OIL/UIL/RMI) at the same time.
Revision Changes Path
1.8 +19 -6 spyderMQ/src/java/org/spydermq/SpyMessage.java
Index: SpyMessage.java
===================================================================
RCS file: /products/cvs/ejboss/spyderMQ/src/java/org/spydermq/SpyMessage.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- SpyMessage.java 2000/11/19 19:59:57 1.7
+++ SpyMessage.java 2000/12/12 05:58:55 1.8
@@ -21,8 +21,9 @@
* This class implements javax.jms.Message
*
* @author Norbert Lataille ([EMAIL PROTECTED])
+ * @author Hiram Chirino ([EMAIL PROTECTED])
*
- * @version $Revision: 1.7 $
+ * @version $Revision: 1.8 $
*/
public class SpyMessage
implements Serializable, Cloneable, Message, Comparable
@@ -425,7 +426,7 @@
msgReadOnly=true;
}
- SpyMessage myClone()
+ public SpyMessage myClone()
{
try {
return (SpyMessage)clone();
@@ -434,7 +435,7 @@
}
}
- boolean isOutdated()
+ public boolean isOutdated()
{
if (jmsExpiration==0) return false;
long ts=System.currentTimeMillis();
@@ -458,18 +459,30 @@
return 1;
}
return (int)(messageId - sm.messageId);
- }
+ }
public void doAcknowledge() throws JMSException
{
- spySession.getConnection().acknowledge(jmsDestination, jmsMessageID,
true);
+
+ SpyAcknowledgementItem item = new SpyAcknowledgementItem();
+ item.jmsDestination = jmsDestination;
+ item.jmsMessageID = jmsMessageID;
+ item.isAck = true;
+
+ spySession.getConnection().send(item);
+
}
public void doNegAcknowledge() throws JMSException
{
- spySession.getConnection().acknowledge(jmsDestination, jmsMessageID,
false);
+ SpyAcknowledgementItem item = new SpyAcknowledgementItem();
+ item.jmsDestination = jmsDestination;
+ item.jmsMessageID = jmsMessageID;
+ item.isAck = false;
+
+ spySession.getConnection().send(item);
}
1.3 +14 -2 spyderMQ/src/java/org/spydermq/Mutex.java
Index: Mutex.java
===================================================================
RCS file: /products/cvs/ejboss/spyderMQ/src/java/org/spydermq/Mutex.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Mutex.java 2000/06/14 22:45:35 1.2
+++ Mutex.java 2000/12/12 05:58:56 1.3
@@ -6,10 +6,22 @@
*/
package org.spydermq;
+/*
+ * spyderMQ, the OpenSource JMS implementation
+ *
+ * Distributable under GPL license.
+ * See terms of license at gnu.org.
+ */
+/*
+ * spyderMQ, the OpenSource JMS implementation
+ *
+ * Distributable under GPL license.
+ * See terms of license at gnu.org.
+ */
/**
* @author Norbert Lataille ([EMAIL PROTECTED])
*
- * @version $Revision: 1.2 $
+ * @version $Revision: 1.3 $
*/
public class Mutex
{
@@ -107,4 +119,4 @@
}
}
-}
\ No newline at end of file
+}
1.2 +32 -35 spyderMQ/src/java/org/spydermq/SpyBytesMessage.java
Index: SpyBytesMessage.java
===================================================================
RCS file: /products/cvs/ejboss/spyderMQ/src/java/org/spydermq/SpyBytesMessage.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SpyBytesMessage.java 2000/05/31 18:06:42 1.1
+++ SpyBytesMessage.java 2000/12/12 05:58:56 1.2
@@ -21,7 +21,7 @@
*
* @author Norbert Lataille ([EMAIL PROTECTED])
*
- * @version $Revision: 1.1 $
+ * @version $Revision: 1.2 $
*/
public class SpyBytesMessage
extends SpyMessage
@@ -47,7 +47,7 @@
// Public --------------------------------------------------------
- public boolean readBoolean() throws JMSException
+ public boolean readBoolean() throws JMSException
{
checkRead();
try {
@@ -57,7 +57,7 @@
}
}
- public byte readByte() throws JMSException
+ public byte readByte() throws JMSException
{
checkRead();
try {
@@ -67,7 +67,7 @@
}
}
- public int readUnsignedByte() throws JMSException
+ public int readUnsignedByte() throws JMSException
{
checkRead();
try {
@@ -77,7 +77,7 @@
}
}
- public short readShort() throws JMSException
+ public short readShort() throws JMSException
{
checkRead();
try {
@@ -87,7 +87,7 @@
}
}
- public int readUnsignedShort() throws JMSException
+ public int readUnsignedShort() throws JMSException
{
checkRead();
try {
@@ -97,7 +97,7 @@
}
}
- public char readChar() throws JMSException
+ public char readChar() throws JMSException
{
checkRead();
try {
@@ -107,7 +107,7 @@
}
}
- public int readInt() throws JMSException
+ public int readInt() throws JMSException
{
checkRead();
try {
@@ -117,7 +117,7 @@
}
}
- public long readLong() throws JMSException
+ public long readLong() throws JMSException
{
checkRead();
try {
@@ -127,7 +127,7 @@
}
}
- public float readFloat() throws JMSException
+ public float readFloat() throws JMSException
{
checkRead();
try {
@@ -136,8 +136,8 @@
throw new JMSException("IOException");
}
}
-
- public double readDouble() throws JMSException
+
+ public double readDouble() throws JMSException
{
checkRead();
try {
@@ -147,7 +147,7 @@
}
}
- public String readUTF() throws JMSException
+ public String readUTF() throws JMSException
{
checkRead();
try {
@@ -156,8 +156,8 @@
throw new JMSException("IOException");
}
}
-
- public int readBytes(byte[] value) throws JMSException
+
+ public int readBytes(byte[] value) throws JMSException
{
checkRead();
try {
@@ -167,7 +167,7 @@
}
}
- public int readBytes(byte[] value, int length) throws JMSException
+ public int readBytes(byte[] value, int length) throws JMSException
{
checkRead();
try {
@@ -177,7 +177,7 @@
}
}
- public void writeBoolean(boolean value) throws JMSException
+ public void writeBoolean(boolean value) throws JMSException
{
if (msgReadOnly) throw new MessageNotWriteableException("the message
body is read-only");
try {
@@ -187,7 +187,7 @@
}
}
- public void writeByte(byte value) throws JMSException
+ public void writeByte(byte value) throws JMSException
{
if (msgReadOnly) throw new MessageNotWriteableException("the message
body is read-only");
try {
@@ -197,7 +197,7 @@
}
}
- public void writeShort(short value) throws JMSException
+ public void writeShort(short value) throws JMSException
{
if (msgReadOnly) throw new MessageNotWriteableException("the message
body is read-only");
try {
@@ -206,8 +206,8 @@
throw new JMSException("IOException");
}
}
-
- public void writeChar(char value) throws JMSException
+
+ public void writeChar(char value) throws JMSException
{
if (msgReadOnly) throw new MessageNotWriteableException("the message
body is read-only");
try {
@@ -217,7 +217,7 @@
}
}
- public void writeInt(int value) throws JMSException
+ public void writeInt(int value) throws JMSException
{
if (msgReadOnly) throw new MessageNotWriteableException("the message
body is read-only");
try {
@@ -227,7 +227,7 @@
}
}
- public void writeLong(long value) throws JMSException
+ public void writeLong(long value) throws JMSException
{
if (msgReadOnly) throw new MessageNotWriteableException("the message
body is read-only");
try {
@@ -237,7 +237,7 @@
}
}
- public void writeFloat(float value) throws JMSException
+ public void writeFloat(float value) throws JMSException
{
if (msgReadOnly) throw new MessageNotWriteableException("the message
body is read-only");
try {
@@ -247,7 +247,7 @@
}
}
- public void writeDouble(double value) throws JMSException
+ public void writeDouble(double value) throws JMSException
{
if (msgReadOnly) throw new MessageNotWriteableException("the message
body is read-only");
try {
@@ -257,7 +257,7 @@
}
}
- public void writeUTF(String value) throws JMSException
+ public void writeUTF(String value) throws JMSException
{
if (msgReadOnly) throw new MessageNotWriteableException("the message
body is read-only");
try {
@@ -267,7 +267,7 @@
}
}
- public void writeBytes(byte[] value) throws JMSException
+ public void writeBytes(byte[] value) throws JMSException
{
if (msgReadOnly) throw new MessageNotWriteableException("the message
body is read-only");
try {
@@ -277,7 +277,7 @@
}
}
- public void writeBytes(byte[] value, int offset, int length) throws
JMSException
+ public void writeBytes(byte[] value, int offset, int length) throws
JMSException
{
if (msgReadOnly) throw new MessageNotWriteableException("the message
body is read-only");
try {
@@ -287,7 +287,7 @@
}
}
- public void writeObject(Object value) throws JMSException
+ public void writeObject(Object value) throws JMSException
{
if (msgReadOnly) throw new MessageNotWriteableException("the message
body is read-only");
try {
@@ -307,7 +307,7 @@
}
- public void reset() throws JMSException
+ public void reset() throws JMSException
{
try {
if (!msgReadOnly) {
@@ -325,7 +325,7 @@
}
}
- public void clearBody() throws JMSException
+ public void clearBody() throws JMSException
{
try {
if (!msgReadOnly) ostream.close();
@@ -346,7 +346,7 @@
// Package protected ---------------------------------------------
//We need to reset() since this message is going to be cloned/serialized
- SpyMessage myClone()
+ public SpyMessage myClone()
{
try {
reset();
@@ -368,8 +368,5 @@
m = new DataInputStream(istream);
}
}
-
-
-
}
1.16 +59 -96 spyderMQ/src/java/org/spydermq/SpyConnection.java
Index: SpyConnection.java
===================================================================
RCS file: /products/cvs/ejboss/spyderMQ/src/java/org/spydermq/SpyConnection.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- SpyConnection.java 2000/11/19 19:59:56 1.15
+++ SpyConnection.java 2000/12/12 05:58:56 1.16
@@ -24,14 +24,15 @@
import java.io.IOException;
import org.spydermq.distributed.interfaces.DistributedJMSServer;
import org.spydermq.distributed.interfaces.ConnectionReceiver;
-import org.spydermq.distributed.ConnectionReceiverFactory;
+
/**
* This class implements javax.jms.Connection
*
* @author Norbert Lataille ([EMAIL PROTECTED])
+ * @author Hiram Chirino ([EMAIL PROTECTED])
*
- * @version $Revision: 1.15 $
+ * @version $Revision: 1.16 $
*/
public class SpyConnection
implements Connection, Serializable
@@ -39,7 +40,7 @@
// Attributes ----------------------------------------------------
- //This is our connection to the JMS server
+ // This is our connection to the JMS server
protected DistributedJMSServer provider;
//This is the clientID
protected String clientID;
@@ -60,8 +61,7 @@
//the exceptionListener
private ExceptionListener exceptionListener;
- // Constructor ---------------------------------------------------
-
+ // Constructor ---------------------------------------------------
SpyConnection(DistributedJMSServer theServer,String cID,String crCN) throws
JMSException
{
//Set the attributes
@@ -147,7 +147,7 @@
if ( ci.getLasListeningState() ) {
try {
-
provider.connectionListening(true,d,distributedConnection);
+
provider.connectionListening(distributedConnection, true,d);
} catch ( Exception e ) {
failureHandler(e, "Cannot contact the JMS
server");
}
@@ -173,7 +173,7 @@
if ( ci.getLasListeningState() ) {
try {
-
provider.connectionListening(false,d,distributedConnection);
+
provider.connectionListening(distributedConnection, false,d);
} catch ( Exception e ) {
failureHandler(e, "Cannot contact the JMS
server");
}
@@ -205,7 +205,7 @@
//Notify the JMSServer that I am closing
try {
provider.connectionClosing(distributedConnection);
- ConnectionReceiverFactory.close(distributedConnection);
+ distributedConnection.close();
} catch (Exception e) {
failureHandler(e,"Cannot close properly the connection");
}
@@ -244,61 +244,14 @@
}
//Ask the broker to delete() this TemporaryDestination
- provider.deleteTemporaryDestination(dest);
+ provider.deleteTemporaryDestination(distributedConnection,
dest);
} catch (Exception e) {
failureHandler(e,"Cannot delete the TemporaryDestination");
}
}
-
- // Package protected ---------------------------------------------
-
- //Send a message to the provider
- //[We should try to locally dispatch the message...]
- void sendToServer(SpyMessage mes[]) throws JMSException
- {
- if (closed) throw new IllegalStateException("The connection is
closed");
- if (distributedConnection==null) createReceiver();
-
- try {
-
- //Log.error("Send "+mes.length+" messages");
-
- /*for(int i=0;i<mes.length;i++) {
-
- SpyMessage message=mes[i];
-
- if (message.isOutdated()) continue;
- Class messageClass=message.jmsDestination.getClass();
-
- if (messageClass==SpyTemporaryTopic.class) {
- if
(((SpyTemporaryTopic)message.jmsDestination).dc.equals(distributedConnection)) {
- Log.log("local");
- }
- } else if (messageClass==SpyTemporaryQueue.class) {
- if
(((SpyTemporaryQueue)message.jmsDestination).dc.equals(distributedConnection)) {
- Log.log("local");
- }
- } else if (messageClass==SpyTopic.class) {
- //Alpha mode test
- } else {
- //Alpha mode test + local delivery
- }
-
- }*/
-
- provider.newMessage(mes,clientID);
-
- } catch (Exception e) {
- failureHandler(e,"Cannot send a message to the JMS provider");
- }
- }
-
-
-
-
//Get a new messageID (creation of a new message)
String getNewMessageID() throws JMSException
{
@@ -334,7 +287,6 @@
//We could check this, though
}
-
// Protected -------------------------------------------------------
@@ -343,7 +295,12 @@
{
try {
if (clientID==null) askForAnID();
-
distributedConnection=ConnectionReceiverFactory.createDistributedConnection(clientID,this,crClassName);
+
+ org.spydermq.distributed.interfaces.ConnectionReceiverSetup cr
=
(org.spydermq.distributed.interfaces.ConnectionReceiverSetup)Class.forName(crClassName).newInstance();
+ cr.setConnection(this);
+ distributedConnection=new
SpyDistributedConnection(clientID,cr);
+
distributedConnection.setConnectionReceiver(cr.createClient());
+
provider.setSpyDistributedConnection(distributedConnection);
} catch (Exception e) {
failureHandler(e,"Cannot create a ConnectionReceiver");
@@ -376,38 +333,11 @@
throw excep;
}
-
-
- protected void acknowledge(Destination dest, String messageId, boolean isAck)
throws JMSException
- {
- try {
- SpyAcknowledgementItem item[] = { new SpyAcknowledgementItem()
};
- item[0].jmsDestination = dest;
- item[0].jmsMessageID = messageId;
- provider.acknowledge(item, isAck,distributedConnection);
- } catch (Exception e) {
- failureHandler(e,"Cannot acknowlege a message.");
- }
- }
-
-
public DistributedJMSServer getProvider() {
return provider;
}
-
- // Used to ack/nak a set of messages.
- protected void acknowledge(SpyAcknowledgementItem[] items, boolean isAck)
throws JMSException {
-
- try {
- provider.acknowledge(items, isAck,distributedConnection);
- } catch (Exception e) {
- failureHandler(e,"Cannot acknowlege a message.");
- }
-
- }
-
// The ConsumerSet inner class is used by:
//
// addConsumer()
@@ -463,7 +393,7 @@
HashMap
newDestinations=(HashMap)destinations.clone();
newDestinations.put(dest,consumerSet);
destinations=newDestinations;
- provider.subscribe(dest,distributedConnection);
+ provider.subscribe(distributedConnection,dest);
} else {
consumerSet.add(consumer);
}
@@ -495,14 +425,14 @@
HashMap
newDestinations=(HashMap)destinations.clone();
newDestinations.remove(dest);
destinations=newDestinations;
-
provider.unsubscribe(dest,distributedConnection);
+
provider.unsubscribe(distributedConnection, dest);
}
} else {
//this should not happen
HashMap
newDestinations=(HashMap)destinations.clone();
newDestinations.remove(dest);
destinations=newDestinations;
-
provider.unsubscribe(dest,distributedConnection);
+ provider.unsubscribe(distributedConnection,
dest);
}
}
@@ -557,10 +487,7 @@
return null;
}
-
-
-
-
+
/**
* Called whenever a consumer changes his listening state on a destination.
* We see if the consumer change, changed the overall listening state for the
destination.
@@ -576,9 +503,9 @@
if( ci.listenStateChanged() ) {
try {
if ( ci.getLasListeningState() ) {
-
provider.connectionListening(true,d,distributedConnection);
+
provider.connectionListening(distributedConnection,true,d);
} else {
-
provider.connectionListening(false,d,distributedConnection);
+
provider.connectionListening(distributedConnection,false,d);
}
} catch ( Exception e ) {
failureHandler(e, "Cannot contact the JMS server");
@@ -589,17 +516,53 @@
/**
- * Creation date: (11/16/2000 2:20:22 PM)
* @return org.spydermq.distributed.interfaces.DistributedJMSServer
*/
SpyMessage queueReceive(Queue queue, long wait) throws JMSException {
try {
- return provider.queueReceive(queue,
wait,distributedConnection);
+ return provider.queueReceive(distributedConnection, queue,
wait);
} catch (Exception e) {
failureHandler(e,"Cannot create a ConnectionReceiver");
return null;
}
}
+ // used to acknowledge a message
+ protected void send(SpyAcknowledgementItem item) throws JMSException
+ {
+ try {
+ provider.acknowledge(distributedConnection, item);
+ } catch (Exception e) {
+ failureHandler(e,"Cannot acknowlege a message.");
+ }
+ }
+
+ // Used to commit/rollback a transaction.
+ protected void send(Transaction transaction) throws JMSException {
+
+ try {
+ provider.transact(distributedConnection, transaction);
+ } catch (Exception e) {
+ failureHandler(e,"Cannot process a transaction.");
+ }
+
+ }
+
+ //Send a message to the provider
+ //[We should try to locally dispatch the message...]
+ void sendToServer(SpyMessage mes) throws JMSException
+ {
+ if (closed) throw new IllegalStateException("The connection is
closed");
+ if (distributedConnection==null) createReceiver();
+
+ try {
+
+ provider.addMessage(distributedConnection, mes);
+
+ } catch (Exception e) {
+ failureHandler(e,"Cannot send a message to the JMS provider");
+ }
+ }
+
}
1.2 +4 -4 spyderMQ/src/java/org/spydermq/SpyObjectMessage.java
Index: SpyObjectMessage.java
===================================================================
RCS file: /products/cvs/ejboss/spyderMQ/src/java/org/spydermq/SpyObjectMessage.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SpyObjectMessage.java 2000/05/31 18:06:44 1.1
+++ SpyObjectMessage.java 2000/12/12 05:58:56 1.2
@@ -23,7 +23,7 @@
*
* @author Norbert Lataille ([EMAIL PROTECTED])
*
- * @version $Revision: 1.1 $
+ * @version $Revision: 1.2 $
*/
public class SpyObjectMessage
extends SpyMessage
@@ -36,7 +36,7 @@
// Public --------------------------------------------------------
- public void setObject(Serializable object) throws JMSException
+ public void setObject(Serializable object) throws JMSException
{
if (msgReadOnly) throw new MessageNotWriteableException("setObject");
try {
@@ -53,7 +53,7 @@
}
}
- public Serializable getObject() throws JMSException
+ public Serializable getObject() throws JMSException
{
try {
ByteArrayInputStream istream = new
ByteArrayInputStream(content);
@@ -73,7 +73,7 @@
}
}
- public void clearBody() throws JMSException
+ public void clearBody() throws JMSException
{
content=null;
super.clearBody();
1.2 +8 -13 spyderMQ/src/java/org/spydermq/SpyTopicConnection.java
Index: SpyTopicConnection.java
===================================================================
RCS file:
/products/cvs/ejboss/spyderMQ/src/java/org/spydermq/SpyTopicConnection.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SpyTopicConnection.java 2000/05/31 18:06:46 1.1
+++ SpyTopicConnection.java 2000/12/12 05:58:56 1.2
@@ -13,15 +13,18 @@
import javax.jms.ConnectionConsumer;
import javax.jms.ServerSessionPool;
import javax.jms.Topic;
+
import java.io.Serializable;
+
import org.spydermq.distributed.interfaces.DistributedJMSServer;
/**
* This class implements javax.jms.TopicConnection
*
* @author Norbert Lataille ([EMAIL PROTECTED])
+ * @author Hiram Chirino ([EMAIL PROTECTED])
*
- * @version $Revision: 1.1 $
+ * @version $Revision: 1.2 $
*/
public class SpyTopicConnection
extends SpyConnection
@@ -41,7 +44,7 @@
// Public --------------------------------------------------------
- public TopicSession createTopicSession(boolean transacted, int acknowledgeMode)
throws JMSException
+ public TopicSession createTopicSession(boolean transacted, int
acknowledgeMode) throws JMSException
{
if (closed) throw new IllegalStateException("The connection is
closed");
if (distributedConnection==null) createReceiver();
@@ -68,9 +71,9 @@
return null;
}
- public ConnectionConsumer createDurableConnectionConsumer(Topic topic,
+ public ConnectionConsumer createDurableConnectionConsumer(Topic topic,
String messageSelector,
- ServerSessionPool sessionPool,
+ ServerSessionPool sessionPool,
int maxMessages) throws
JMSException
{
if (closed) throw new IllegalStateException("The connection is
closed");
@@ -80,14 +83,6 @@
return null;
}
- // Package protected ---------------------------------------------
-
- void sendToServer(SpyMessage[] c) throws JMSException
- {
- Log.log("Connection: sendToServer("+c.length+" msgs)");
- super.sendToServer(c);
- }
-
TemporaryTopic getTemporaryTopic() throws JMSException
{
if (closed) throw new IllegalStateException("The connection is
closed");
@@ -106,7 +101,7 @@
try {
if (closed) throw new IllegalStateException("The connection is
closed");
if (distributedConnection==null) createReceiver();
- return provider.createTopic(name);
+ return provider.createTopic(distributedConnection, name);
} catch (Exception e) {
failureHandler(e,"Cannot get the topic from the provider");
return null;
1.2 +23 -23 spyderMQ/src/java/org/spydermq/SpyMapMessage.java
Index: SpyMapMessage.java
===================================================================
RCS file: /products/cvs/ejboss/spyderMQ/src/java/org/spydermq/SpyMapMessage.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SpyMapMessage.java 2000/05/31 18:06:43 1.1
+++ SpyMapMessage.java 2000/12/12 05:58:56 1.2
@@ -18,7 +18,7 @@
*
* @author Norbert Lataille ([EMAIL PROTECTED])
*
- * @version $Revision: 1.1 $
+ * @version $Revision: 1.2 $
*/
public class SpyMapMessage
extends SpyMessage
@@ -47,7 +47,7 @@
else throw new MessageFormatException("Invalid conversion");
}
- public byte getByte(String name) throws JMSException
+ public byte getByte(String name) throws JMSException
{
Object value=content.get(name);
if (value==null) return Byte.parseByte(null);
@@ -57,7 +57,7 @@
else throw new MessageFormatException("Invalid conversion");
}
- public short getShort(String name) throws JMSException
+ public short getShort(String name) throws JMSException
{
Object value=content.get(name);
if (value==null) return Short.parseShort(null);
@@ -68,7 +68,7 @@
else throw new MessageFormatException("Invalid conversion");
}
- public char getChar(String name) throws JMSException
+ public char getChar(String name) throws JMSException
{
Object value=content.get(name);
if (value==null) throw new NullPointerException("Invalid conversion");
@@ -77,7 +77,7 @@
else throw new MessageFormatException("Invalid conversion");
}
- public int getInt(String name) throws JMSException
+ public int getInt(String name) throws JMSException
{
Object value=content.get(name);
if (value==null) return Integer.parseInt(null);
@@ -89,7 +89,7 @@
else throw new MessageFormatException("Invalid conversion");
}
- public long getLong(String name) throws JMSException
+ public long getLong(String name) throws JMSException
{
Object value=content.get(name);
if (value==null) return Long.parseLong(null);
@@ -102,7 +102,7 @@
else throw new MessageFormatException("Invalid conversion");
}
- public float getFloat(String name) throws JMSException
+ public float getFloat(String name) throws JMSException
{
Object value=content.get(name);
if (value==null) return Float.parseFloat(null);
@@ -112,7 +112,7 @@
else throw new MessageFormatException("Invalid conversion");
}
- public double getDouble(String name) throws JMSException
+ public double getDouble(String name) throws JMSException
{
Object value=content.get(name);
if (value==null) return Double.parseDouble(null);
@@ -123,7 +123,7 @@
else throw new MessageFormatException("Invalid conversion");
}
- public String getString(String name) throws JMSException
+ public String getString(String name) throws JMSException
{
Object value=content.get(name);
if (value==null) return null;
@@ -140,7 +140,7 @@
else throw new MessageFormatException("Invalid conversion");
}
- public byte[] getBytes(String name) throws JMSException
+ public byte[] getBytes(String name) throws JMSException
{
Object value=content.get(name);
if (value==null) return null;
@@ -148,22 +148,22 @@
else throw new MessageFormatException("Invalid conversion");
}
- public Object getObject(String name) throws JMSException
+ public Object getObject(String name) throws JMSException
{
return content.get(name);
}
-
+
public Enumeration getMapNames() throws JMSException
{
return content.keys();
}
-
+
public void setBoolean(String name, boolean value) throws JMSException
{
if (msgReadOnly) throw new MessageNotWriteableException("Message is
ReadOnly !");
content.put(name,new Boolean(value));
}
-
+
public void setByte(String name, byte value) throws JMSException
{
if (msgReadOnly) throw new MessageNotWriteableException("Message is
ReadOnly !");
@@ -175,13 +175,13 @@
if (msgReadOnly) throw new MessageNotWriteableException("Message is
ReadOnly !");
content.put(name,new Short(value));
}
-
+
public void setChar(String name, char value) throws JMSException
{
if (msgReadOnly) throw new MessageNotWriteableException("Message is
ReadOnly !");
content.put(name,new Character(value));
}
-
+
public void setInt(String name, int value) throws JMSException
{
if (msgReadOnly) throw new MessageNotWriteableException("Message is
ReadOnly !");
@@ -200,25 +200,25 @@
content.put(name,new Float(value));
}
- public void setDouble(String name, double value) throws JMSException
+ public void setDouble(String name, double value) throws JMSException
{
if (msgReadOnly) throw new MessageNotWriteableException("Message is
ReadOnly !");
content.put(name,new Double(value));
}
- public void setString(String name, String value) throws JMSException
+ public void setString(String name, String value) throws JMSException
{
if (msgReadOnly) throw new MessageNotWriteableException("Message is
ReadOnly !");
content.put(name,value);
}
- public void setBytes(String name, byte[] value) throws JMSException
+ public void setBytes(String name, byte[] value) throws JMSException
{
if (msgReadOnly) throw new MessageNotWriteableException("Message is
ReadOnly !");
content.put(name,value.clone());
}
- public void setBytes(String name, byte[] value, int offset, int length) throws
JMSException
+ public void setBytes(String name, byte[] value, int offset, int length) throws
JMSException
{
if (msgReadOnly) throw new MessageNotWriteableException("Message is
ReadOnly !");
@@ -230,7 +230,7 @@
content.put(name,temp);
}
- public void setObject(String name, Object value) throws JMSException
+ public void setObject(String name, Object value) throws JMSException
{
if (msgReadOnly) throw new MessageNotWriteableException("Message is
ReadOnly !");
@@ -247,12 +247,12 @@
else throw new MessageFormatException("Invalid object type");
}
- public boolean itemExists(String name) throws JMSException
+ public boolean itemExists(String name) throws JMSException
{
return content.containsKey(name);
}
- public void clearBody() throws JMSException
+ public void clearBody() throws JMSException
{
content=new Hashtable();
super.clearBody();
1.8 +11 -3 spyderMQ/src/java/org/spydermq/SpyDistributedConnection.java
Index: SpyDistributedConnection.java
===================================================================
RCS file:
/products/cvs/ejboss/spyderMQ/src/java/org/spydermq/SpyDistributedConnection.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- SpyDistributedConnection.java 2000/11/19 19:59:57 1.7
+++ SpyDistributedConnection.java 2000/12/12 05:58:57 1.8
@@ -11,13 +11,12 @@
import org.spydermq.distributed.interfaces.ConnectionReceiver;
import org.spydermq.distributed.interfaces.ConnectionReceiverSetup;
-
/**
* This class is the broker point of view on a SpyConnection (it contains a
ConnectionReceiver)
*
* @author Norbert Lataille ([EMAIL PROTECTED])
*
- * @version $Revision: 1.7 $
+ * @version $Revision: 1.8 $
*/
public class SpyDistributedConnection
implements Serializable
@@ -41,7 +40,7 @@
this.cr=cr;
}
- String getClientID()
+ public String getClientID()
{
return clientID;
}
@@ -61,4 +60,13 @@
{
return hash;
}
+
+ public void close() throws Exception {
+ if( cr != null )
+ cr.close();
+
+ if (cr!=null && cr instanceof java.rmi.Remote) {
+
java.rmi.server.UnicastRemoteObject.unexportObject((java.rmi.Remote)cr, true);
+ }
+ }
}
1.3 +3 -2 spyderMQ/src/java/org/spydermq/SpyTopic.java
Index: SpyTopic.java
===================================================================
RCS file: /products/cvs/ejboss/spyderMQ/src/java/org/spydermq/SpyTopic.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SpyTopic.java 2000/06/09 20:03:58 1.2
+++ SpyTopic.java 2000/12/12 05:58:57 1.3
@@ -14,8 +14,9 @@
* This class implements javax.jms.Topic
*
* @author Norbert Lataille ([EMAIL PROTECTED])
+ * @author Hiram Chirino ([EMAIL PROTECTED])
*
- * @version $Revision: 1.2 $
+ * @version $Revision: 1.3 $
*/
public class SpyTopic
extends SpyDestination
@@ -24,7 +25,7 @@
// Constructor ---------------------------------------------------
- SpyTopic(String topicName)
+ public SpyTopic(String topicName)
{
super(topicName);
}
1.2 +7 -9 spyderMQ/src/java/org/spydermq/SpyAcknowledgementItem.java
Index: SpyAcknowledgementItem.java
===================================================================
RCS file:
/products/cvs/ejboss/spyderMQ/src/java/org/spydermq/SpyAcknowledgementItem.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SpyAcknowledgementItem.java 2000/11/19 19:59:57 1.1
+++ SpyAcknowledgementItem.java 2000/12/12 05:58:57 1.2
@@ -9,24 +9,22 @@
import java.io.Serializable;
import javax.jms.Destination;
-import java.lang.Comparable;
/**
* Used to Acknowledge sent messages.
*
* This class holds the minimum abount of information needed to
* identify a message to the JMSServer.
- *
+ *
* @author Hiram Chirino ([EMAIL PROTECTED])
- *
- * @version $Revision: 1.1 $
+ *
+ * @version $Revision: 1.2 $
*/
-public class SpyAcknowledgementItem
- implements java.io.Serializable
+public class SpyAcknowledgementItem
+implements java.io.Serializable
{
public Destination jmsDestination=null;
public String jmsMessageID=null;
-
-
-
+ public boolean isAck;
+
}
1.9 +4 -84 spyderMQ/src/java/org/spydermq/SpyTopicSession.java
Index: SpyTopicSession.java
===================================================================
RCS file: /products/cvs/ejboss/spyderMQ/src/java/org/spydermq/SpyTopicSession.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- SpyTopicSession.java 2000/12/07 19:41:11 1.8
+++ SpyTopicSession.java 2000/12/12 05:58:57 1.9
@@ -13,6 +13,7 @@
import javax.jms.JMSException;
import javax.jms.TopicPublisher;
import javax.jms.TemporaryTopic;
+
import java.util.Collection;
import java.util.HashSet;
import java.util.HashMap;
@@ -20,6 +21,7 @@
import java.io.FileOutputStream;
import java.io.ObjectOutputStream;
import java.io.IOException;
+
import org.spydermq.selectors.Selector;
import org.spydermq.Log;
@@ -27,8 +29,9 @@
* This class implements javax.jms.TopicSession
*
* @author Norbert Lataille ([EMAIL PROTECTED])
+ * @author Hiram Chirino ([EMAIL PROTECTED])
*
- * @version $Revision: 1.8 $
+ * @version $Revision: 1.9 $
*/
public class SpyTopicSession
extends SpySession
@@ -40,7 +43,6 @@
SpyTopicSession(SpyConnection myConnection, boolean transacted, int
acknowledgeMode, boolean stop)
{
super(myConnection,transacted,acknowledgeMode,stop);
- clientPersistence = false;
}
// Public --------------------------------------------------------
@@ -107,87 +109,5 @@
{
//Not yet implemented
}
-
-
-
-
-
- //called by a MessageProducer object which needs to publish a message
- void sendMessage(SpyMessage m) throws JMSException
- {
- if (closed) throw new IllegalStateException("The session is closed");
-
- // If client is not doing persistence then we have to make sure the
server
- // gets the persistent message before we return. (This is done in the
commit for
- // transacted sessions.)
- if( !clientPersistence && !transacted &&
m.getJMSDeliveryMode()==javax.jms.DeliveryMode.PERSISTENT) {
- //Wait for the sending thread to sleep
- synchronized (mutex) {
- mutex.waitToSleep();
-
- SpyMessage job[] = { m };
- connection.sendToServer( job );
-
- //We have finished our work, we can wake up the thread
- mutex.notifyLock();
- }
- return;
- }
-
- //Synchronize with the outgoingQueue
- synchronized (outgoingQueue)
- {
- //Test the priority
- int pri=m.getJMSPriority();
-
- if (pri<=4) {
-
- //normal priority message
- outgoingQueue.addLast(m);
-
- } else {
-
- //expedited priority message
- int size=outgoingQueue.size();
- int i=0;
-
- for(;i<size;i++) {
- if
(((SpyMessage)outgoingQueue.get(i)).getJMSPriority()<pri) break;
- }
-
- outgoingQueue.add(i,m);
-
- }
-
- }
-
- //notify the thread that there is work to do
- mutex.notifyLock();
- //Handle persistence
- //First shot : use a fs based persistence system
- try {
- if (m.persistent && clientPersistence) {
- //Log.log("ADD file "+m.getJMSMessageID());
- if (m.removed==false) {
- ObjectOutputStream output=new
ObjectOutputStream(new FileOutputStream(m.getJMSMessageID()));
- output.writeObject(m);
- output.close();
- m.removed=true;
- }
- }
- } catch (IOException e) {
- Log.log(e);
- }
-
- //DEBUG !
- if (outgoingQueue.size()>9000)
- try {
- Thread.sleep(200);
- } catch (InterruptedException e) {
- }
-
- }
-
-
}
1.3 +5 -5 spyderMQ/src/java/org/spydermq/SpyQueueSender.java
Index: SpyQueueSender.java
===================================================================
RCS file: /products/cvs/ejboss/spyderMQ/src/java/org/spydermq/SpyQueueSender.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SpyQueueSender.java 2000/06/09 20:03:58 1.2
+++ SpyQueueSender.java 2000/12/12 05:58:57 1.3
@@ -17,7 +17,7 @@
*
* @author Norbert Lataille ([EMAIL PROTECTED])
*
- * @version $Revision: 1.2 $
+ * @version $Revision: 1.3 $
*/
public class SpyQueueSender
extends SpyMessageProducer
@@ -40,25 +40,25 @@
// Public --------------------------------------------------------
- public Queue getQueue() throws JMSException
+ public Queue getQueue() throws JMSException
{
return queue;
}
//Send methods
- public void send(Message message) throws JMSException
+ public void send(Message message) throws JMSException
{
if (queue==null) throw new InvalidDestinationException("I do not have
a default Destination !");
send(queue,message,defaultDeliveryMode,defaultPriority,defaultTTL);
}
- public void send(Queue queue, Message message) throws JMSException
+ public void send(Queue queue, Message message) throws JMSException
{
send(queue,message,defaultDeliveryMode,defaultPriority,defaultTTL);
}
- public void send(Message message, int deliveryMode, int priority, long
timeToLive) throws JMSException
+ public void send(Message message, int deliveryMode, int priority, long
timeToLive) throws JMSException
{
if (queue==null) throw new InvalidDestinationException("I do not have
a default Destination !");
send(queue,message,deliveryMode,priority,timeToLive);
1.2 +3 -2 spyderMQ/src/java/org/spydermq/NoReceiverException.java
Index: NoReceiverException.java
===================================================================
RCS file:
/products/cvs/ejboss/spyderMQ/src/java/org/spydermq/NoReceiverException.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- NoReceiverException.java 2000/05/31 18:06:41 1.1
+++ NoReceiverException.java 2000/12/12 05:58:57 1.2
@@ -12,7 +12,7 @@
*
* @author Norbert Lataille ([EMAIL PROTECTED])
*
- * @version $Revision: 1.1 $
+ * @version $Revision: 1.2 $
*/
import javax.jms.JMSException;
@@ -20,7 +20,8 @@
public class NoReceiverException
extends JMSException
{
- public NoReceiverException(String reason, String errorCode)
{
+ public NoReceiverException(String reason, String errorCode)
+ {
super(reason, errorCode);
}
1.2 +12 -12 spyderMQ/src/java/org/spydermq/SpyMessageProducer.java
Index: SpyMessageProducer.java
===================================================================
RCS file:
/products/cvs/ejboss/spyderMQ/src/java/org/spydermq/SpyMessageProducer.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SpyMessageProducer.java 2000/05/31 18:06:44 1.1
+++ SpyMessageProducer.java 2000/12/12 05:58:57 1.2
@@ -16,7 +16,7 @@
*
* @author Norbert Lataille ([EMAIL PROTECTED])
*
- * @version $Revision: 1.1 $
+ * @version $Revision: 1.2 $
*/
public class SpyMessageProducer
implements MessageProducer
@@ -31,63 +31,63 @@
// Public --------------------------------------------------------
- public void setDisableMessageID(boolean value) throws JMSException
+ public void setDisableMessageID(boolean value) throws JMSException
{
disableMessageID=value;
}
- public boolean getDisableMessageID() throws JMSException
+ public boolean getDisableMessageID() throws JMSException
{
return disableMessageID;
}
- public void setDisableMessageTimestamp(boolean value) throws JMSException
+ public void setDisableMessageTimestamp(boolean value) throws JMSException
{
disableTS=value;
}
- public boolean getDisableMessageTimestamp() throws JMSException
+ public boolean getDisableMessageTimestamp() throws JMSException
{
return disableTS;
}
- public void setDeliveryMode(int deli) throws JMSException
+ public void setDeliveryMode(int deli) throws JMSException
{
if (deli==Message.DEFAULT_DELIVERY_MODE)
defaultDeliveryMode=DeliveryMode.NON_PERSISTENT;
else if
(deli!=DeliveryMode.NON_PERSISTENT&&deli!=DeliveryMode.PERSISTENT) throw new
JMSException("Bad DeliveryMode value");
else defaultDeliveryMode=deli;
}
- public int getDeliveryMode() throws JMSException
+ public int getDeliveryMode() throws JMSException
{
return defaultDeliveryMode;
}
- public void setPriority(int pri) throws JMSException
+ public void setPriority(int pri) throws JMSException
{
if (pri==Message.DEFAULT_PRIORITY) defaultPriority=4;
else if (pri<0||pri>9) throw new JMSException("Bad priority value");
else defaultPriority=pri;
}
- public int getPriority() throws JMSException
+ public int getPriority() throws JMSException
{
return defaultPriority;
}
- public void setTimeToLive(int timeToLive) throws JMSException
+ public void setTimeToLive(int timeToLive) throws JMSException
{
if (timeToLive==Message.DEFAULT_TIME_TO_LIVE) timeToLive=0;
else if (timeToLive<0) throw new JMSException("Bad TimeToLive value");
else defaultTTL=timeToLive;
}
- public int getTimeToLive() throws JMSException
+ public int getTimeToLive() throws JMSException
{
return defaultTTL;
}
- public void close() throws JMSException
+ public void close() throws JMSException
{
//Is there anything useful to do ?
//Let the GC do its work !
1.2 +6 -6 spyderMQ/src/java/org/spydermq/SpyConnectionMetaData.java
Index: SpyConnectionMetaData.java
===================================================================
RCS file:
/products/cvs/ejboss/spyderMQ/src/java/org/spydermq/SpyConnectionMetaData.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SpyConnectionMetaData.java 2000/05/31 18:06:43 1.1
+++ SpyConnectionMetaData.java 2000/12/12 05:58:57 1.2
@@ -16,7 +16,7 @@
*
* @author Norbert Lataille ([EMAIL PROTECTED])
*
- * @version $Revision: 1.1 $
+ * @version $Revision: 1.2 $
*/
public class SpyConnectionMetaData
implements ConnectionMetaData
@@ -29,27 +29,27 @@
return "1.0";
}
- public int getJMSMajorVersion() throws JMSException
+ public int getJMSMajorVersion() throws JMSException
{
return 1;
}
- public int getJMSMinorVersion() throws JMSException
+ public int getJMSMinorVersion() throws JMSException
{
return 0;
}
- public String getJMSProviderName() throws JMSException
+ public String getJMSProviderName() throws JMSException
{
return "JBoss";
}
- public String getProviderVersion() throws JMSException
+ public String getProviderVersion() throws JMSException
{
return "0.1";
}
- public int getProviderMajorVersion() throws JMSException
+ public int getProviderMajorVersion() throws JMSException
{
return 0;
}
1.13 +53 -99 spyderMQ/src/java/org/spydermq/SpySession.java
Index: SpySession.java
===================================================================
RCS file: /products/cvs/ejboss/spyderMQ/src/java/org/spydermq/SpySession.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- SpySession.java 2000/11/19 19:59:57 1.12
+++ SpySession.java 2000/12/12 05:58:57 1.13
@@ -16,6 +16,7 @@
import javax.jms.MessageListener;
import javax.jms.StreamMessage;
import javax.jms.TextMessage;
+
import java.io.Serializable;
import java.io.File;
import java.util.LinkedList;
@@ -28,13 +29,13 @@
* This class implements javax.jms.Session
*
* @author Norbert Lataille ([EMAIL PROTECTED])
+ * @author Hiram Chirino ([EMAIL PROTECTED])
*
- * @version $Revision: 1.12 $
+ * @version $Revision: 1.13 $
*/
public class SpySession
implements Runnable, Session
{
-
// Attributes ----------------------------------------------------
//Is this session transacted ?
@@ -45,21 +46,14 @@
private MessageListener messageListener;
//The connection object to which this session is linked
protected SpyConnection connection;
-
//The outgoing message queue
protected LinkedList outgoingQueue;
- //The outgoing message queue for messages that have been commited (if the
session is transacted)
- protected LinkedList outgoingCommitedQueue;
//Is my connection in stopped mode ?
protected boolean modeStop;
//Is the session closed ?
boolean closed;
//This object is the object used to synchronize the session's thread - Need
fixed / improvement
public Mutex mutex;
- //Is this session in alpha mode ?
- public boolean alphaMode;
- // Should we do client side persistence?
- public boolean clientPersistence = true;
//MessageConsumers created by this session
protected HashSet consumers;
@@ -72,12 +66,10 @@
transacted=trans;
acknowledgeMode=acknowledge;
outgoingQueue=new LinkedList();
- outgoingCommitedQueue=new LinkedList();
modeStop=stop;
messageListener=null;
closed=false;
mutex=new Mutex();
- alphaMode=true;
consumers = new HashSet();
//Start my thread
@@ -87,8 +79,7 @@
//Wait for the thread to sleep
mutex.waitLocked();
-
-
+
}
// Public --------------------------------------------------------
@@ -182,61 +173,11 @@
while (true) {
- boolean doneJob=false;
-
+ boolean doneJob=false;
if (closed) break;
-
- //look at outgoing queues
-
- SpyMessage outgoingJob[]=null;
-
- if (transacted) {
- synchronized (outgoingCommitedQueue) {
- //The session is transacted, we take the
outgoing msgs from outgoingCommitedQueue
- if (outgoingCommitedQueue.size()!=0) {
- SpyMessage array[]=new
SpyMessage[outgoingCommitedQueue.size()];
-
outgoingJob=(SpyMessage[])outgoingCommitedQueue.toArray(array);
- outgoingCommitedQueue.clear();
- }
- }
- } else {
- synchronized (outgoingQueue) {
- //The session is not transacted, we take the
outgoing msgs from outgoingQueue
- if (outgoingQueue.size()!=0) {
- SpyMessage array[]=new
SpyMessage[outgoingQueue.size()];
-
outgoingJob=(SpyMessage[])outgoingQueue.toArray(array);
- outgoingQueue.clear();
- }
- }
- }
-
- if (outgoingJob!=null) {
- try {
-
- //Check for outdated messages !
- for(int i=0;i<outgoingJob.length;i++) {
- SpyMessage m=outgoingJob[i];
- if (m.persistent) {
- if (m.removed) {
- //Log.log("DELETE file
"+outgoingJob[i].getJMSMessageID());
- //persitenceList.add();
- if ((new
File(m.getJMSMessageID())).delete()==false)
-
Log.error("Cannot delete file "+m.getJMSMessageID());
- } else m.removed=true;
- }
- }
-
- //Send to the server
- connection.sendToServer(outgoingJob);
- doneJob=true;
- } catch (JMSException e) {
- Log.log("Cannot send
"+outgoingJob.toString()+" to the provider...");
- Log.error(e);
- }
- }
-
+
try {
- //if we are not in stopped mode, look at the incoming
queue
+ //if we are not in stopped mode, look at the incoming
queue
if (!modeStop) {
Iterator i=consumers.iterator();
while (i.hasNext()) {
@@ -302,39 +243,26 @@
//Wait for the thread to sleep
synchronized (mutex) {
mutex.waitToSleep();
-
- // If we are not doing client side persistence, then we have
to send the
- // persistent messages to server and confirm that they have
been received before we return.
- if( !clientPersistence ) {
-
- LinkedList persistentMessages = new LinkedList();
- java.util.ListIterator iter =
outgoingQueue.listIterator();
- while( iter.hasNext() ) {
- SpyMessage sm = (SpyMessage)iter.next();
- if( sm.getJMSDeliveryMode() ==
javax.jms.DeliveryMode.PERSISTENT ) {
- persistentMessages.addLast(sm);
- iter.remove();
- }
- }
- if (persistentMessages.size()!=0) {
- SpyMessage job[]=new
SpyMessage[persistentMessages.size()];
-
job=(SpyMessage[])persistentMessages.toArray(job);
- connection.sendToServer(job);
- }
+ Transaction transaction = new Transaction();
+
+ // Send to server all published messages
+ if (outgoingQueue.size()!=0) {
+ SpyMessage job[]=new SpyMessage[outgoingQueue.size()];
+ job=(SpyMessage[])outgoingQueue.toArray(job);
+ transaction.messages = job;
}
- //Move the outgoing messages from the outgoingQueue to the
outgoingCommitedQueue
- outgoingCommitedQueue.addAll(outgoingQueue);
+ //Clear the outgoing queue
outgoingQueue.clear();
-
+
//Acknowlege all consumed messages
- SpyAcknowledgementItem items[] = removeAcknowledgementItems();
- connection.acknowledge(items, true);
+ transaction.acks = removeAcknowledgementItems();
+
+ connection.send(transaction);
//We have finished our work, we can wake up the thread
modeStop=modeSav;
- mutex.notifyLock();
-
+ mutex.notifyLock();
}
}
@@ -354,14 +282,20 @@
synchronized (mutex) {
mutex.waitToSleep();
-
+
+ Transaction transaction = new Transaction();
+
//Clear the outgoing queue
outgoingQueue.clear();
-
+
//Neg Acknowlege all consumed messages
- SpyAcknowledgementItem items[] = removeAcknowledgementItems();
- connection.acknowledge(items, false);
+ transaction.acks = removeAcknowledgementItems();
+ for( int i=0; i < transaction.acks.length; i++ ) {
+ transaction.acks[i].isAck = false;
+ }
+ connection.send(transaction);
+
//We have finished our work, we can wake up the thread
modeStop=modeSav;
mutex.notifyLock();
@@ -382,11 +316,17 @@
synchronized (mutex) {
mutex.waitToSleep();
-
+
+ Transaction transaction = new Transaction();
+
//Neg Acknowlege all consumed messages
- SpyAcknowledgementItem items[] = removeAcknowledgementItems();
- connection.acknowledge(items, false);
+ transaction.acks = removeAcknowledgementItems();
+ for( int i=0; i < transaction.acks.length; i++ ) {
+ transaction.acks[i].isAck = false;
+ }
+ connection.send(transaction);
+
//We have finished our work, we can wake up the thread
modeStop=modeSav;
mutex.notifyLock();
@@ -492,6 +432,7 @@
SpyAcknowledgementItem item = new
SpyAcknowledgementItem();
item.jmsDestination = mc.destination;
item.jmsMessageID = messageId;
+ item.isAck = true;
items[i++] = item;
}
mc.messagesConsumed.clear();
@@ -500,4 +441,17 @@
return items;
}
+ //called by a MessageProducer object which needs to publish a message
+ void sendMessage(SpyMessage m) throws JMSException {
+ if (closed)
+ throw new IllegalStateException("The session is closed");
+
+ if( transacted ) {
+ outgoingQueue.add(m);
+ } else {
+ connection.sendToServer(m);
+ }
+
+ }
+
}
1.3 +9 -1 spyderMQ/src/java/org/spydermq/SpyDestination.java
Index: SpyDestination.java
===================================================================
RCS file: /products/cvs/ejboss/spyderMQ/src/java/org/spydermq/SpyDestination.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SpyDestination.java 2000/06/09 20:03:57 1.2
+++ SpyDestination.java 2000/12/12 05:58:58 1.3
@@ -14,8 +14,9 @@
* This class implements javax.jms.Destination
*
* @author Norbert Lataille ([EMAIL PROTECTED])
+ * @author Hiram Chirino ([EMAIL PROTECTED])
*
- * @version $Revision: 1.2 $
+ * @version $Revision: 1.3 $
*/
public class SpyDestination
implements Destination, Serializable
@@ -36,4 +37,11 @@
return hash;
}
+ /**
+ * gets the name of the destination.
+ * @return java.lang.String
+ */
+ public java.lang.String getName() {
+ return name;
+ }
}
1.2 +3 -3 spyderMQ/src/java/org/spydermq/SpyTextMessage.java
Index: SpyTextMessage.java
===================================================================
RCS file: /products/cvs/ejboss/spyderMQ/src/java/org/spydermq/SpyTextMessage.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SpyTextMessage.java 2000/05/31 18:06:46 1.1
+++ SpyTextMessage.java 2000/12/12 05:58:58 1.2
@@ -15,7 +15,7 @@
*
* @author Norbert Lataille ([EMAIL PROTECTED])
*
- * @version $Revision: 1.1 $
+ * @version $Revision: 1.2 $
*/
public class SpyTextMessage
extends SpyMessage
@@ -34,12 +34,12 @@
content=string;
}
- public String getText() throws JMSException
+ public String getText() throws JMSException
{
return content;
}
- public void clearBody() throws JMSException
+ public void clearBody() throws JMSException
{
content=null;
super.clearBody();
1.2 +24 -24 spyderMQ/src/java/org/spydermq/SpyStreamMessage.java
Index: SpyStreamMessage.java
===================================================================
RCS file: /products/cvs/ejboss/spyderMQ/src/java/org/spydermq/SpyStreamMessage.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SpyStreamMessage.java 2000/05/31 18:06:45 1.1
+++ SpyStreamMessage.java 2000/12/12 05:58:58 1.2
@@ -18,7 +18,7 @@
*
* @author Norbert Lataille ([EMAIL PROTECTED])
*
- * @version $Revision: 1.1 $
+ * @version $Revision: 1.2 $
*/
public class SpyStreamMessage
extends SpyMessage
@@ -63,7 +63,7 @@
}
- public byte readByte() throws JMSException
+ public byte readByte() throws JMSException
{
if (!msgReadOnly) throw new MessageNotWriteableException("The message
body is writeonly");
@@ -80,7 +80,7 @@
}
}
- public short readShort() throws JMSException
+ public short readShort() throws JMSException
{
if (!msgReadOnly) throw new MessageNotWriteableException("The message
body is writeonly");
try {
@@ -98,7 +98,7 @@
}
}
- public char readChar() throws JMSException
+ public char readChar() throws JMSException
{
if (!msgReadOnly) throw new MessageNotWriteableException("The message
body is writeonly");
try {
@@ -114,7 +114,7 @@
}
}
- public int readInt() throws JMSException
+ public int readInt() throws JMSException
{
if (!msgReadOnly) throw new MessageNotWriteableException("The message
body is writeonly");
@@ -134,7 +134,7 @@
}
}
- public long readLong() throws JMSException
+ public long readLong() throws JMSException
{
if (!msgReadOnly) throw new MessageNotWriteableException("The message
body is writeonly");
try {
@@ -154,7 +154,7 @@
}
}
- public float readFloat() throws JMSException
+ public float readFloat() throws JMSException
{
if (!msgReadOnly) throw new MessageNotWriteableException("The message
body is writeonly");
try {
@@ -171,7 +171,7 @@
}
}
- public double readDouble() throws JMSException
+ public double readDouble() throws JMSException
{
if (!msgReadOnly) throw new MessageNotWriteableException("The message
body is writeonly");
try {
@@ -189,7 +189,7 @@
}
}
- public String readString() throws JMSException
+ public String readString() throws JMSException
{
if (!msgReadOnly) throw new MessageNotWriteableException("The message
body is writeonly");
try {
@@ -213,7 +213,7 @@
}
}
- public int readBytes(byte[] value) throws JMSException
+ public int readBytes(byte[] value) throws JMSException
{
if (!msgReadOnly) throw new MessageNotWriteableException("The message
body is writeonly");
try {
@@ -249,7 +249,7 @@
}
}
- public Object readObject() throws JMSException
+ public Object readObject() throws JMSException
{
if (!msgReadOnly) throw new MessageNotWriteableException("The message
body is writeonly");
try {
@@ -264,37 +264,37 @@
}
}
- public void writeBoolean(boolean value) throws JMSException
+ public void writeBoolean(boolean value) throws JMSException
{
if (msgReadOnly) throw new MessageNotWriteableException("The message
body is readonly");
content.add(new Boolean(value));
}
- public void writeByte(byte value) throws JMSException
+ public void writeByte(byte value) throws JMSException
{
if (msgReadOnly) throw new MessageNotWriteableException("The message
body is readonly");
content.add(new Byte(value));
}
- public void writeShort(short value) throws JMSException
+ public void writeShort(short value) throws JMSException
{
if (msgReadOnly) throw new MessageNotWriteableException("The message
body is readonly");
content.add(new Short(value));
}
- public void writeChar(char value) throws JMSException
+ public void writeChar(char value) throws JMSException
{
if (msgReadOnly) throw new MessageNotWriteableException("The message
body is readonly");
content.add(new Character(value));
}
- public void writeInt(int value) throws JMSException
+ public void writeInt(int value) throws JMSException
{
if (msgReadOnly) throw new MessageNotWriteableException("The message
body is readonly");
content.add(new Integer(value));
}
- public void writeLong(long value) throws JMSException
+ public void writeLong(long value) throws JMSException
{
if (msgReadOnly) throw new MessageNotWriteableException("The message
body is readonly");
content.add(new Long(value));
@@ -305,25 +305,25 @@
content.add(new Float(value));
}
- public void writeDouble(double value) throws JMSException
+ public void writeDouble(double value) throws JMSException
{
if (msgReadOnly) throw new MessageNotWriteableException("The message
body is readonly");
content.add(new Double(value));
}
- public void writeString(String value) throws JMSException
+ public void writeString(String value) throws JMSException
{
if (msgReadOnly) throw new MessageNotWriteableException("The message
body is readonly");
content.add(new String(value));
}
- public void writeBytes(byte[] value) throws JMSException
+ public void writeBytes(byte[] value) throws JMSException
{
if (msgReadOnly) throw new MessageNotWriteableException("The message
body is readonly");
content.add(value.clone());
}
- public void writeBytes(byte[] value, int offset, int length) throws JMSException
+ public void writeBytes(byte[] value, int offset, int length) throws
JMSException
{
if (msgReadOnly) throw new MessageNotWriteableException("The message
body is readonly");
@@ -335,7 +335,7 @@
content.add(temp);
}
- public void writeObject(Object value) throws JMSException
+ public void writeObject(Object value) throws JMSException
{
if (msgReadOnly) throw new MessageNotWriteableException("The message
body is readonly");
if (value instanceof Boolean) content.add(value);
@@ -351,7 +351,7 @@
else throw new MessageFormatException("Invalid object type");
}
- public void reset() throws JMSException
+ public void reset() throws JMSException
{
msgReadOnly=true;
position=0;
@@ -359,7 +359,7 @@
offset=0;
}
- public void clearBody() throws JMSException
+ public void clearBody() throws JMSException
{
content=new Vector();
position=0;
1.3 +3 -2 spyderMQ/src/java/org/spydermq/SpyQueue.java
Index: SpyQueue.java
===================================================================
RCS file: /products/cvs/ejboss/spyderMQ/src/java/org/spydermq/SpyQueue.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SpyQueue.java 2000/06/09 20:03:58 1.2
+++ SpyQueue.java 2000/12/12 05:58:58 1.3
@@ -14,8 +14,9 @@
* This class implements javax.jms.Queue
*
* @author Norbert Lataille ([EMAIL PROTECTED])
+ * @author Hiram Chirino ([EMAIL PROTECTED])
*
- * @version $Revision: 1.2 $
+ * @version $Revision: 1.3 $
*/
public class SpyQueue
extends SpyDestination
@@ -24,7 +25,7 @@
// Constructor ---------------------------------------------------
- SpyQueue(String queueName)
+ public SpyQueue(String queueName)
{
super(queueName);
hash++;
1.2 +5 -5 spyderMQ/src/java/org/spydermq/SpyQueueBrowser.java
Index: SpyQueueBrowser.java
===================================================================
RCS file: /products/cvs/ejboss/spyderMQ/src/java/org/spydermq/SpyQueueBrowser.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SpyQueueBrowser.java 2000/05/31 18:06:45 1.1
+++ SpyQueueBrowser.java 2000/12/12 05:58:58 1.2
@@ -16,7 +16,7 @@
*
* @author Norbert Lataille ([EMAIL PROTECTED])
*
- * @version $Revision: 1.1 $
+ * @version $Revision: 1.2 $
*/
public class SpyQueueBrowser
implements QueueBrowser
@@ -24,27 +24,27 @@
//Public
- public Queue getQueue() throws JMSException
+ public Queue getQueue() throws JMSException
{
//Nor implemented yet
return null;
}
- public String getMessageSelector() throws JMSException
+ public String getMessageSelector() throws JMSException
{
//Nor implemented yet
return null;
}
- public Enumeration getEnumeration() throws JMSException
+ public Enumeration getEnumeration() throws JMSException
{
//Nor implemented yet
return null;
}
- public void close() throws JMSException
+ public void close() throws JMSException
{
//Nor implemented yet
return;
}
-}
\ No newline at end of file
+}
1.7 +6 -62 spyderMQ/src/java/org/spydermq/SpyQueueSession.java
Index: SpyQueueSession.java
===================================================================
RCS file: /products/cvs/ejboss/spyderMQ/src/java/org/spydermq/SpyQueueSession.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- SpyQueueSession.java 2000/12/07 19:41:11 1.6
+++ SpyQueueSession.java 2000/12/12 05:58:58 1.7
@@ -14,16 +14,20 @@
import javax.jms.QueueSender;
import javax.jms.TemporaryQueue;
import javax.jms.QueueBrowser;
+import javax.jms.DeliveryMode;
+
import java.util.HashSet;
import java.util.HashMap;
import java.util.Iterator;
+
-import javax.jms.DeliveryMode;/**
+/**
* This class implements javax.jms.QueueSession
*
* @author Norbert Lataille ([EMAIL PROTECTED])
+ * @author Hiram Chirino ([EMAIL PROTECTED])
*
- * @version $Revision: 1.6 $
+ * @version $Revision: 1.7 $
*/
public class SpyQueueSession
extends SpySession
@@ -35,7 +39,6 @@
SpyQueueSession(SpyConnection myConnection, boolean transacted, int
acknowledgeMode, boolean stop)
{
super(myConnection,transacted,acknowledgeMode,stop);
- clientPersistence = false;
}
// Public --------------------------------------------------------
@@ -94,63 +97,4 @@
return ((SpyQueueConnection)connection).getTemporaryQueue();
}
-
-
-
-
- // Package protected ---------------------------------------------
-
- //called by a MessageProducer object which needs to send a message
- void sendMessage(SpyMessage m) throws JMSException
- {
- if (closed) throw new IllegalStateException("The session is closed");
-
- // If client is not doing persistence then we have to make sure the
server
- // gets the persistent message before we return. (This is done in the
commit for
- // transacted sessions.)
- if( !clientPersistence && !transacted &&
m.getJMSDeliveryMode()==DeliveryMode.PERSISTENT) {
- //Wait for the sending thread to sleep
- synchronized (mutex) {
- mutex.waitToSleep();
-
- SpyMessage job[] = { m };
- connection.sendToServer( job );
-
- //We have finished our work, we can wake up the thread
- mutex.notifyLock();
- }
- return;
- }
-
- //Synchronize with the outgoingQueue
- synchronized (outgoingQueue)
- {
- //Test the priority
- int pri=m.getJMSPriority();
-
- if (pri<=4) {
-
- //normal priority message
- outgoingQueue.addLast(m);
-
- } else {
-
- //expedited priority message
- int size=outgoingQueue.size();
- int i=0;
-
- for(;i<size;i++) {
- if
(((SpyMessage)outgoingQueue.get(i)).getJMSPriority()<pri) break;
- }
-
- outgoingQueue.add(i,m);
-
- }
-
- }
-
- //Notify the [sleeping ?] thread that there is work to do
- mutex.notifyLock();
- }
-
}
1.2 +6 -16 spyderMQ/src/java/org/spydermq/SpyQueueConnection.java
Index: SpyQueueConnection.java
===================================================================
RCS file:
/products/cvs/ejboss/spyderMQ/src/java/org/spydermq/SpyQueueConnection.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SpyQueueConnection.java 2000/05/31 18:06:45 1.1
+++ SpyQueueConnection.java 2000/12/12 05:58:58 1.2
@@ -20,20 +20,16 @@
* This class implements javax.jms.QueueConnection
*
* @author Norbert Lataille ([EMAIL PROTECTED])
+ * @author Hiram Chirino ([EMAIL PROTECTED])
*
- * @version $Revision: 1.1 $
+ * @version $Revision: 1.2 $
*/
public class SpyQueueConnection
extends SpyConnection
implements Serializable, QueueConnection
{
-
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
// Constructor ---------------------------------------------------
-
+
public SpyQueueConnection(DistributedJMSServer theServer,String cID,String
crCN) throws JMSException
{
super(theServer,cID,crCN);
@@ -41,7 +37,7 @@
// Public --------------------------------------------------------
- public QueueSession createQueueSession(boolean transacted, int acknowledgeMode)
throws JMSException
+ public QueueSession createQueueSession(boolean transacted, int
acknowledgeMode) throws JMSException
{
if (closed) throw new IllegalStateException("The connection is
closed");
if (distributedConnection==null) createReceiver();
@@ -68,13 +64,7 @@
return null;
}
- // Package protected ---------------------------------------------
-
- void sendToServer(SpyMessage[] c) throws JMSException
- {
- Log.log("Connection: sendToServer("+c.length+" msgs)");
- super.sendToServer(c);
- }
+
TemporaryQueue getTemporaryQueue() throws JMSException
{
@@ -95,7 +85,7 @@
try {
if (closed) throw new IllegalStateException("The connection is
closed");
if (distributedConnection==null) createReceiver();
- return provider.createQueue(name);
+ return provider.createQueue(distributedConnection, name);
} catch (Exception e) {
failureHandler(e,"Cannot get the Queue from the provider");
return null;
1.2 +4 -3 spyderMQ/src/java/org/spydermq/SpyTemporaryTopic.java
Index: SpyTemporaryTopic.java
===================================================================
RCS file:
/products/cvs/ejboss/spyderMQ/src/java/org/spydermq/SpyTemporaryTopic.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SpyTemporaryTopic.java 2000/05/31 18:06:46 1.1
+++ SpyTemporaryTopic.java 2000/12/12 05:58:59 1.2
@@ -13,8 +13,9 @@
* This class implements javax.jms.TemporaryTopic
*
* @author Norbert Lataille ([EMAIL PROTECTED])
+ * @author Hiram Chirino ([EMAIL PROTECTED])
*
- * @version $Revision: 1.1 $
+ * @version $Revision: 1.2 $
*/
public class SpyTemporaryTopic
extends SpyTopic
@@ -26,7 +27,7 @@
// Constructor ---------------------------------------------------
- SpyTemporaryTopic(String topicName, SpyDistributedConnection dc_)
+ public SpyTemporaryTopic(String topicName, SpyDistributedConnection dc_)
{
super(topicName);
dc=dc_;
@@ -34,7 +35,7 @@
// Public --------------------------------------------------------
- public void delete() throws JMSException
+ public void delete() throws JMSException
{
try {
dc.cr.deleteTemporaryDestination(this);
1.2 +4 -3 spyderMQ/src/java/org/spydermq/SpyTemporaryQueue.java
Index: SpyTemporaryQueue.java
===================================================================
RCS file:
/products/cvs/ejboss/spyderMQ/src/java/org/spydermq/SpyTemporaryQueue.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SpyTemporaryQueue.java 2000/05/31 18:06:46 1.1
+++ SpyTemporaryQueue.java 2000/12/12 05:58:59 1.2
@@ -13,8 +13,9 @@
* This class implements javax.jms.TemporaryQueue
*
* @author Norbert Lataille ([EMAIL PROTECTED])
+ * @author Hiram Chirino ([EMAIL PROTECTED])
*
- * @version $Revision: 1.1 $
+ * @version $Revision: 1.2 $
*/
public class SpyTemporaryQueue
extends SpyQueue
@@ -26,7 +27,7 @@
// Constructor ---------------------------------------------------
- SpyTemporaryQueue(String queueName,SpyDistributedConnection dc_)
+ public SpyTemporaryQueue(String queueName,SpyDistributedConnection dc_)
{
super(queueName);
dc=dc_;
@@ -34,7 +35,7 @@
// Public --------------------------------------------------------
- public void delete() throws JMSException
+ public void delete() throws JMSException
{
try {
dc.cr.deleteTemporaryDestination(this);
1.1 spyderMQ/src/java/org/spydermq/SpyTopicConnectionFactory.java
Index: SpyTopicConnectionFactory.java
===================================================================
/*
* spyderMQ, the OpenSource JMS implementation
*
* Distributable under GPL license.
* See terms of license at gnu.org.
*/
package org.spydermq;
import javax.jms.TopicConnection;
import javax.jms.TopicConnectionFactory;
import javax.jms.JMSException;
import org.spydermq.Log;
import org.spydermq.security.SecurityManager;
import org.spydermq.distributed.interfaces.DistributedJMSServer;
import org.spydermq.distributed.interfaces.DistributedConnectionFactory;
import java.io.Serializable;
import java.util.Properties;
/**
* This class implements javax.jms.TopicConnectionFactory
*
* @author Norbert Lataille ([EMAIL PROTECTED])
* @author Hiram Chirino ([EMAIL PROTECTED])
*
* @version $Revision: 1.1 $
*/
public class SpyTopicConnectionFactory
implements TopicConnectionFactory, Serializable
{
// Attributes ----------------------------------------------------
private DistributedConnectionFactory factory;
// Constructor ---------------------------------------------------
public SpyTopicConnectionFactory(DistributedConnectionFactory factory) throws
Exception
{
this.factory = factory;
}
// Public --------------------------------------------------------
public TopicConnection createTopicConnection() throws JMSException
{
try {
return factory.createTopicConnection();
} catch (JMSException e) {
throw e;
} catch (Exception e) {
failureHandler(e,"createTopicConnection has failed !");
return null;
}
}
public TopicConnection createTopicConnection(String userName, String password)
throws JMSException
{
try {
if (userName==null||password==null) throw new
JMSException("Invalid login or password !");
return factory.createTopicConnection(userName,password);
} catch (JMSException e) {
throw e;
} catch (Exception e) {
failureHandler(e,"createTopicConnection has failed !");
return null;
}
}
// Private ------------------------------------------------------
private void failureHandler(Exception e,String reason) throws JMSException
{
Log.error(e);
throw new JMSException(reason);
}
}
1.1 spyderMQ/src/java/org/spydermq/SpyQueueConnectionFactory.java
Index: SpyQueueConnectionFactory.java
===================================================================
/*
* spyderMQ, the OpenSource JMS implementation
*
* Distributable under GPL license.
* See terms of license at gnu.org.
*/
package org.spydermq;
import javax.jms.QueueConnection;
import javax.jms.QueueConnectionFactory;
import javax.jms.JMSException;
import org.spydermq.Log;
import org.spydermq.security.SecurityManager;
import org.spydermq.distributed.interfaces.DistributedJMSServer;
import org.spydermq.distributed.interfaces.DistributedConnectionFactory;
import java.io.Serializable;
import java.util.Properties;
/**
* This class implements javax.jms.QueueConnectionFactory
*
* @author Norbert Lataille ([EMAIL PROTECTED])
* @author Hiram Chirino ([EMAIL PROTECTED])
*
* @version $Revision: 1.1 $
*/
public class SpyQueueConnectionFactory
implements QueueConnectionFactory, Serializable
{
// Attributes ----------------------------------------------------
private DistributedConnectionFactory factory;
// Constructor ---------------------------------------------------
public SpyQueueConnectionFactory( DistributedConnectionFactory factory) throws
Exception
{
this.factory = factory;
}
// Public --------------------------------------------------------
public QueueConnection createQueueConnection() throws JMSException
{
try {
return factory.createQueueConnection();
} catch (JMSException e) {
throw e;
} catch (Exception e) {
failureHandler(e,"createQueueConnection has failed !");
return null;
}
}
public QueueConnection createQueueConnection(String userName, String password)
throws JMSException
{
try {
if (userName==null||password==null) throw new
JMSException("Invalid login or password !");
return factory.createQueueConnection(userName,password);
} catch (JMSException e) {
throw e;
} catch (Exception e) {
failureHandler(e,"createQueueConnection has failed !");
return null;
}
}
//private
private void failureHandler(Exception e,String reason) throws JMSException
{
Log.error(e);
throw new JMSException(reason);
}
}
1.1 spyderMQ/src/java/org/spydermq/Transaction.java
Index: Transaction.java
===================================================================
/*
* spyderMQ, the OpenSource JMS implementation
*
* Distributable under GPL license.
* See terms of license at gnu.org.
*/
package org.spydermq;
import java.io.Serializable;
/**
* This class contians all the data needed to perform a JMS transaction
*
* @author Hiram Chirino ([EMAIL PROTECTED])
*
* @version $Revision: 1.1 $
*/
public class Transaction
implements Serializable
{
// messages sent in the transaction
public SpyMessage[] messages;
// messages acknowleged in the transaction
public SpyAcknowledgementItem[] acks;
}