Java Doc for BasicQueue.java in  » EJB-Server-JBoss-4.2.1 » messaging » org » jboss » mq » server » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » EJB Server JBoss 4.2.1 » messaging » org.jboss.mq.server 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.jboss.mq.server.BasicQueue

All known Subclasses:   org.jboss.mq.server.ExclusiveQueue,  org.jboss.mq.server.PersistentQueue,
BasicQueue
public class BasicQueue (Code)
This class represents a queue which provides it's messages exclusively to one consumer at a time.

Notes about synchronization: Much of the work is synchronized on the receivers or messages depending on the work performed. However, anything to do with unacknowledged messages and removed subscriptions must be done synchronized on both (receivers first). This is because there are multiple entry points with the possibility that a message acknowledgement (or NACK) is being processed at the same time as a network failure removes the subscription.
author:
   Hiram Chirino (Cojonudo14@hotmail.com)
author:
   Norbert Lataille (Norbert.Lataille@m4x.org)
author:
   David Maplesden (David.Maplesden@orion.co.nz)
author:
   Adrian Brock (Adrian@jboss.org)
version:
   $Revision: 61446 $


Inner Class :class AddMessagePostRollBackTask implements Runnable
Inner Class :class AddMessagePostCommitTask implements Runnable
Inner Class :class RestoreMessageTask implements Runnable
Inner Class :class RemoveMessageTask implements Runnable

Field Summary
 MessageCountercounter
    
 Stringdescription
    
 ConcurrentHashMapevents
    
final static  Loggerlog
    
 SortedSetmessages
    
 BasicQueueParametersparameters
    
 Receiversreceivers
    
 HashSetremovedSubscribers
    
 CopyOnWriteArraySetscheduledMessages
    
 JMSDestinationManagerserver
    
 booleanstopped
    
 HashSetsubscribers
    
 HashMapunackedByMessageRef
    
 HashMapunackedBySubscription
    
 HashMapunacknowledgedMessages
    

Constructor Summary
public  BasicQueue(JMSDestinationManager server, String description, BasicQueueParameters parameters)
    

Method Summary
public  voidacknowledge(AcknowledgementRequest item, Tx txId)
    
public  voidaddMessage(MessageReference mes, Tx txId)
    
public  voidaddReceiver(Subscription sub)
    
public  voidaddSubscriber(Subscription sub)
    
protected  voidaddToReceivers(Subscription sub)
    
public  SpyMessage[]browse(String selector)
    
public  ListbrowseInProcess(String selector)
    
public  ListbrowseScheduled(String selector)
    
protected  voidclearEvent(MessageReference message)
    
protected  voidclearEvents()
    
public  voidcreateMessageCounter(String name, String subscription, boolean topic, boolean durable, int daycountmax)
    
protected  voiddropMessage(MessageReference message)
    
protected  voiddropMessage(MessageReference message, Tx txid)
    
protected  voidexpireMessage(MessageReference messageRef)
    
protected  voidexpireMessageAsync(MessageReference messageRef)
     Expire a message asynchronously.
public  StringgetDescription()
    
public  intgetInProcessMessageCount()
    
public  MessageCountergetMessageCounter()
    
public  intgetQueueDepth()
    
public  ArrayListgetReceivers()
    
public  intgetReceiversCount()
    
public  intgetScheduledMessageCount()
    
public  SetgetSubscribers()
    
public  booleanisInUse()
    
protected  voidnackMessage(MessageReference message)
     Nacks a message.
public  voidnackMessages(Subscription sub)
    
protected  voidperformOrPrepareAcknowledgeMessage(MessageReference mes, Tx txId)
    
protected  voidperformOrPrepareAddMessage(MessageReference mes, Tx txId)
    
protected  voidqueueMessageForSending(Subscription sub, MessageReference message)
    
public  SpyMessagereceive(Subscription sub, boolean wait)
    
public  voidremoveAllMessages()
    
protected  voidremoveReceiver(Subscription sub)
    
public  voidremoveSubscriber(Subscription sub)
    
public  voidrestoreMessage(MessageReference mes)
     Restores a message.
public  voidrestoreMessage(MessageReference mes, Tx txid, int type)
     Restores a message.
protected  voidsetupMessageAcknowledgement(Subscription sub, MessageReference messageRef)
    
public  voidstop()
    
public  StringtoString()
    

Field Detail
counter
MessageCounter counter(Code)
Simple Counter for gathering message add statistic data



description
String description(Code)
The description used to seperate persistence for multiple subscriptions to a topic



events
ConcurrentHashMap events(Code)
Events by message id



log
final static Logger log(Code)



messages
SortedSet messages(Code)
List of messages waiting to be dispatched

synchronized access on itself




parameters
BasicQueueParameters parameters(Code)
The basic queue parameters



receivers
Receivers receivers(Code)
The subscribers waiting for messages - synchronized access on itself



removedSubscribers
HashSet removedSubscribers(Code)
Removed subscribers

synchronized access on receivers and messages




scheduledMessages
CopyOnWriteArraySet scheduledMessages(Code)
The scheduled messages



server
JMSDestinationManager server(Code)
The JMSServer object



stopped
boolean stopped(Code)
Have we been stopped



subscribers
HashSet subscribers(Code)
Subscribers

synchronized access on receivers




unackedByMessageRef
HashMap unackedByMessageRef(Code)
Unacknowledged messages MessageRef -> UnackedMessageInfo

synchronized access on receivers and messages




unackedBySubscription
HashMap unackedBySubscription(Code)
Unacknowledged messages Subscription -> UnackedMessageInfo

synchronized access on receivers and messages




unacknowledgedMessages
HashMap unacknowledgedMessages(Code)
Unacknowledged messages AcknowledgementRequest -> UnackedMessageInfo

synchronized access on receivers and messages





Constructor Detail
BasicQueue
public BasicQueue(JMSDestinationManager server, String description, BasicQueueParameters parameters) throws JMSException(Code)
Construct a new basic queue
Parameters:
  server - the destination manager
Parameters:
  description - a description to uniquely identify the queue
Parameters:
  parameters - the basic queue parameters
throws:
  JMSException - for any error




Method Detail
acknowledge
public void acknowledge(AcknowledgementRequest item, Tx txId) throws JMSException(Code)
Acknowledge a message
Parameters:
  item - the acknowledgement request
Parameters:
  txId - the transaction
throws:
  JMSException - for any error



addMessage
public void addMessage(MessageReference mes, Tx txId) throws JMSException(Code)
Add a message to the queue
Parameters:
  mes - the message reference
Parameters:
  txId - the transaction
throws:
  JMSException - for any error



addReceiver
public void addReceiver(Subscription sub) throws JMSException(Code)
Add a receiver to the queue
Parameters:
  sub - the subscription to add
throws:
  JMSException - for any error



addSubscriber
public void addSubscriber(Subscription sub) throws JMSException(Code)
Add a subscription from the queue
Parameters:
  sub - the subscription to add
throws:
  JMSException - for any error



addToReceivers
protected void addToReceivers(Subscription sub) throws JMSException(Code)
Add a receiver
Parameters:
  sub - the receiver to add



browse
public SpyMessage[] browse(String selector) throws JMSException(Code)
Browse the queue
Parameters:
  selector - the selector to apply, pass null forall messages the messages
throws:
  JMSException - for any error



browseInProcess
public List browseInProcess(String selector) throws JMSException(Code)
Browse the in process messages
Parameters:
  selector - the selector to apply, pass null forall messages the messages
throws:
  JMSException - for any error



browseScheduled
public List browseScheduled(String selector) throws JMSException(Code)
Browse the scheduled messages
Parameters:
  selector - the selector to apply, pass null forall messages the messages
throws:
  JMSException - for any error



clearEvent
protected void clearEvent(MessageReference message)(Code)
Clear the event for a message
Parameters:
  message - the message reference



clearEvents
protected void clearEvents()(Code)
Clear all the events



createMessageCounter
public void createMessageCounter(String name, String subscription, boolean topic, boolean durable, int daycountmax)(Code)
Create message counter object
Parameters:
  name - topic/queue name
Parameters:
  subscription - topic subscription
Parameters:
  topic - topic flag
Parameters:
  durable - durable subscription flag
Parameters:
  daycountmax - message history day count limit0: disabled,>0: max day count,<0: unlimited



dropMessage
protected void dropMessage(MessageReference message)(Code)
Remove a message
Parameters:
  message - the message to remove



dropMessage
protected void dropMessage(MessageReference message, Tx txid)(Code)
Remove a message
Parameters:
  message - the message to remove
Parameters:
  txid - the transaction context for the removal



expireMessage
protected void expireMessage(MessageReference messageRef)(Code)
Expire a message
Parameters:
  messageRef - the message to remove



expireMessageAsync
protected void expireMessageAsync(MessageReference messageRef)(Code)
Expire a message asynchronously.
Parameters:
  messageRef - the message to remove



getDescription
public String getDescription()(Code)
Retrieve the unique description for this queue the description



getInProcessMessageCount
public int getInProcessMessageCount()(Code)
Returns the number of in process messages for the queue the in process count



getMessageCounter
public MessageCounter getMessageCounter()(Code)
Get message counter object MessageCounter message counter object or null



getQueueDepth
public int getQueueDepth()(Code)
Retrieve the queue depth the number of messages in the queue



getReceivers
public ArrayList getReceivers()(Code)
Retrieve the receivers waiting for a message an array of subscriptions



getReceiversCount
public int getReceiversCount()(Code)
Retrieve the number of receivers waiting for a message the number of receivers



getScheduledMessageCount
public int getScheduledMessageCount()(Code)
Returns the number of scheduled messages in the queue the scheduled message count



getSubscribers
public Set getSubscribers()(Code)
Get the subscribers the subscribers



isInUse
public boolean isInUse()(Code)
Test whether the queue is in use true when there are subscribers



nackMessage
protected void nackMessage(MessageReference message)(Code)
Nacks a message.



nackMessages
public void nackMessages(Subscription sub)(Code)
Nack all messages for a subscription
Parameters:
  sub - the subscription



performOrPrepareAcknowledgeMessage
protected void performOrPrepareAcknowledgeMessage(MessageReference mes, Tx txId) throws JMSException(Code)
Either perform or prepare the acknowledge message
Parameters:
  mes - the message reference
Parameters:
  txId - the transaction id
throws:
  Exception - for any error



performOrPrepareAddMessage
protected void performOrPrepareAddMessage(MessageReference mes, Tx txId) throws Exception(Code)
Either perform or prepare the add message
Parameters:
  mes - the message reference
Parameters:
  txId - the transaction id
throws:
  Exception - for any error



queueMessageForSending
protected void queueMessageForSending(Subscription sub, MessageReference message)(Code)
Queue a message for sending through the client consumer
Parameters:
  sub - the subscirption to receive the message
Parameters:
  message - the message reference to queue



receive
public SpyMessage receive(Subscription sub, boolean wait) throws JMSException(Code)
Receive a message from the queue
Parameters:
  sub - the subscription requiring a message
Parameters:
  wait - whether to wait for a message the message
throws:
  JMSException - for any error



removeAllMessages
public void removeAllMessages() throws JMSException(Code)



removeReceiver
protected void removeReceiver(Subscription sub)(Code)
Remove a receiver
Parameters:
  sub - the receiver to remove



removeSubscriber
public void removeSubscriber(Subscription sub)(Code)
Removes a subscription from the queue
Parameters:
  sub - the subscription to remove



restoreMessage
public void restoreMessage(MessageReference mes)(Code)
Restores a message.
Parameters:
  mes - the message reference



restoreMessage
public void restoreMessage(MessageReference mes, Tx txid, int type)(Code)
Restores a message.
Parameters:
  mes - the message reference
Parameters:
  txid - the transaction id
Parameters:
  type - the type of restoration



setupMessageAcknowledgement
protected void setupMessageAcknowledgement(Subscription sub, MessageReference messageRef) throws JMSException(Code)
Setup a message acknowledgement
Parameters:
  sub - the subscription receiving the message
Parameters:
  messageRef - the message to be acknowledged
throws:
  JMSException - for any error



stop
public void stop()(Code)



toString
public String toString()(Code)



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.