Java Doc for Connection.java in  » EJB-Server-JBoss-4.2.1 » messaging » org » jboss » mq » 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 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.jboss.mq.Connection

All known Subclasses:   org.jboss.mq.SpyConnection,
Connection
abstract public class Connection implements Serializable,javax.jms.Connection(Code)
This class implements javax.jms.Connection.

It is also the gateway through wich all calls to the JMS server is done. To do its work it needs a ServerIL to invoke (@see org.jboss.mq.server.ServerIL).

The (new from february 2002) logic for clientID is the following: if logging in with a user and passwork a preconfigured clientID may be automatically delivered from the server.

If the client wants to set it's own clientID it must do so on a connection wich does not have a prefonfigured clientID and it must do so before it calls any other methods on the connection (even getClientID()). It is not allowable to use a clientID that either looks like JBossMQ internal one (beginning with ID) or a clientID that is allready in use by someone, or a clientID that is already preconfigured in the server.

If a preconfigured ID is not get, or a valid one is not set, the server will set an internal ID. This ID is NEVER possible to use for durable subscriptions. If a prefconfigured ID or one manually set is possible to use to create a durable subscriptions is governed by the security configuration of JBossMQ. In the default setup, only preconfigured clientID's are possible to use. If using a SecurityManager, permissions to create a surable subscriptions is * the resiult of a combination of the following:

- The clientID is not one of JBossMQ's internal.

- The user is authenticated and has a role that has create set to true in the security config of the destination.

Notes for JBossMQ developers: All calls, except close(), that is possible to do on a connection must call checkClientID()


author:
   Norbert Lataille (Norbert.Lataille@m4x.org)
author:
   Hiram Chirino (Cojonudo14@hotmail.com)
author:
   Peter Antman
author:
   Adrian Brock
version:
   $Revision: 61739 $

Inner Class :class PingTask implements Runnable
Inner Class :class ExceptionListenerRunnable implements Runnable

Field Summary
protected  StringclientID
    
protected  ClientILServiceclientILService
    
protected static  ClockDaemonclockDaemon
    
protected  ConnectionTokenconnectionToken
     The connection token is used to identify our connection to the server.
 HashSetcreatedSessions
    
public  HashMapdestinationSubscriptions
    
 GenericConnectionFactorygenericConnectionFactory
    
static  Loggerlog
    
public  booleanmodeStop
    
protected  longpingPeriod
    
 ObjectpingTaskId
    
 SemaphorepingTaskSemaphore
    
protected  booleanponged
     This field is reset when a ping is sent, set when ponged.
protected  ServerILserverIL
    
 StringsessionId
    
 SpyXAResourceManagerspyXAResourceManager
    
 ObjectsubCountLock
    
 intsubscriptionCounter
    
public  HashMapsubscriptions
    
protected  HashSettemps
    
static  booleantrace
    

Constructor Summary
 Connection(String userName, String password, GenericConnectionFactory genericConnectionFactory)
    
 Connection(GenericConnectionFactory genericConnectionFactory)
    

Method Summary
 voidaddConsumer(SpyConsumer consumer)
     A new Consumer has been created.
protected  voidaskForAnID()
    
protected  voidaskForAnID(String userName, String password)
    
public  voidasynchClose()
    
public  voidasynchDeleteTemporaryDestination(SpyDestination dest)
    
public  voidasynchDeliver(ReceiveRequest requests)
     Gets the first consumer that is listening to a destination.
public  voidasynchFailure(String reason, Throwable t)
    
public  voidasynchPong(long serverTime)
    
protected  voidauthenticate(String userName, String password)
    
 SpyMessage[]browse(Queue queue, String selector)
    
protected synchronized  voidcheckClientID()
     Check that a clientID exists.
protected  voidcheckClosed()
    
 voidcheckTemporary(Destination destination)
    
public synchronized  voidclose()
    
public  voiddeleteTemporaryDestination(SpyDestination dest)
    
public  voiddoStop()
    
public  StringgetClientID()
    
public  ExceptionListenergetExceptionListener()
    
public  ConnectionMetaDatagetMetaData()
    
 StringgetNewMessageID()
     Get the next message id

All longs are less than 22 digits long

Note that in this routine we assume that System.currentTimeMillis() is non-negative always be non-negative (so don't set lastMessageID to a positive for a start).

public  ServerILgetServerIL()
    
public static  ThreadGroupgetThreadGroup()
    
 voidpingServer(long clientTime)
    
 SpyMessagereceive(Subscription sub, long wait)
    
protected  Xid[]recover(int flags)
    
 voidremoveConsumer(SpyConsumer consumer)
    
protected  voidsend(AcknowledgementRequest item)
    
protected  voidsend(TransactionRequest transaction)
    
 voidsendToServer(SpyMessage mes)
    
 voidsessionClosing(SpySession who)
    
public  voidsetClientID(String cID)
    
public  voidsetExceptionListener(ExceptionListener listener)
    
public  voidstart()
    
protected  voidstartILService()
    
public  voidstop()
    
protected  voidstopILService()
    
public  StringtoString()
    
 voidunsubscribe(DurableSubscriptionID id)
    

Field Detail
clientID
protected String clientID(Code)
This is the clientID



clientILService
protected ClientILService clientILService(Code)
The object that sets up the client IL



clockDaemon
protected static ClockDaemon clockDaemon(Code)
Manages the thread that pings the connection to see if it is 'alive'



connectionToken
protected ConnectionToken connectionToken(Code)
The connection token is used to identify our connection to the server.



createdSessions
HashSet createdSessions(Code)
LinkedList of all created sessions by this connection



destinationSubscriptions
public HashMap destinationSubscriptions(Code)
Maps a destination to a LinkedList of Subscriptions



genericConnectionFactory
GenericConnectionFactory genericConnectionFactory(Code)
The class that created this connection



log
static Logger log(Code)
The log



modeStop
public boolean modeStop(Code)
Is the connection stopped ?



pingPeriod
protected long pingPeriod(Code)
How often to ping the connection



pingTaskId
Object pingTaskId(Code)
Identifies the PinkTask in the ClockDaemon



pingTaskSemaphore
Semaphore pingTaskSemaphore(Code)
This is used to know when the PingTask is running



ponged
protected boolean ponged(Code)
This field is reset when a ping is sent, set when ponged.



serverIL
protected ServerIL serverIL(Code)
This is our connection to the JMS server



sessionId
String sessionId(Code)
The next session id



spyXAResourceManager
SpyXAResourceManager spyXAResourceManager(Code)
Used to control tranactions



subCountLock
Object subCountLock(Code)
The lock for subscriptionCounter



subscriptionCounter
int subscriptionCounter(Code)
Numbers subscriptions



subscriptions
public HashMap subscriptions(Code)
Maps a subscription id to a Subscription



temps
protected HashSet temps(Code)
Temporary destinations created by this connection



trace
static boolean trace(Code)
Whether trace is enabled




Constructor Detail
Connection
Connection(String userName, String password, GenericConnectionFactory genericConnectionFactory) throws JMSException(Code)
Create a new Connection
Parameters:
  userName - the username
Parameters:
  password - the password
Parameters:
  genericConnectionFactory - the constructing class
throws:
  JMSException - for any error



Connection
Connection(GenericConnectionFactory genericConnectionFactory) throws JMSException(Code)
Create a new Connection
Parameters:
  genericConnectionFactory - the constructing class
throws:
  JMSException - for any error




Method Detail
addConsumer
void addConsumer(SpyConsumer consumer) throws JMSException(Code)
A new Consumer has been created.

We have to handle security issues, a consumer may actually not be allowed to be created
Parameters:
  consumer - the consumer added
throws:
  JMSException - for any error




askForAnID
protected void askForAnID() throws JMSException(Code)
Ask the server for an id
exception:
  JMSException - for any error



askForAnID
protected void askForAnID(String userName, String password) throws JMSException(Code)
Ask the server for an id
Parameters:
  userName - the user
Parameters:
  password - the password
exception:
  JMSException - for any error



asynchClose
public void asynchClose()(Code)
Notification from the server that the connection is closed



asynchDeleteTemporaryDestination
public void asynchDeleteTemporaryDestination(SpyDestination dest)(Code)
Called by a TemporaryDestination which is going to be deleted()
Parameters:
  dest - the temporary destination



asynchDeliver
public void asynchDeliver(ReceiveRequest requests)(Code)
Gets the first consumer that is listening to a destination.
Parameters:
  requests - the receive requests



asynchFailure
public void asynchFailure(String reason, Throwable t)(Code)
Notification of a failure on this connection
Parameters:
  reason - the reason for the failure
Parameters:
  t - the throwable



asynchPong
public void asynchPong(long serverTime)(Code)
Invoked when the server pong us
Parameters:
  serverTime - the server time



authenticate
protected void authenticate(String userName, String password) throws JMSException(Code)
Authenticate a user
Parameters:
  userName - the user
Parameters:
  password - the password
throws:
  JMSException - for any error



browse
SpyMessage[] browse(Queue queue, String selector) throws JMSException(Code)
Browse a queue
Parameters:
  queue - the queue
Parameters:
  selector - the selector an array of messages
exception:
  JMSException - for any error



checkClientID
protected synchronized void checkClientID() throws JMSException(Code)
Check that a clientID exists. If not get one from server. Also sets the setClientIdAllowed to false. Check clientId, must be called by all public methods on the jacax.jmx.Connection interface and its children.
exception:
  JMSException - if clientID is null as post condition



checkClosed
protected void checkClosed() throws IllegalStateException(Code)
Check whether we are closed
throws:
  IllegalStateException - when the session is closed



checkTemporary
void checkTemporary(Destination destination) throws JMSException(Code)
Check a tempoary destination
Parameters:
  destination - the destination



close
public synchronized void close() throws JMSException(Code)



deleteTemporaryDestination
public void deleteTemporaryDestination(SpyDestination dest) throws JMSException(Code)
Called by a TemporaryDestination which is going to be deleted
Parameters:
  dest - the temporary destination
exception:
  JMSException - for any error



doStop
public void doStop() throws JMSException(Code)
Stop delivery
Parameters:
  consumer - the consumer



getClientID
public String getClientID() throws JMSException(Code)



getExceptionListener
public ExceptionListener getExceptionListener() throws JMSException(Code)



getMetaData
public ConnectionMetaData getMetaData() throws JMSException(Code)



getNewMessageID
String getNewMessageID() throws JMSException(Code)
Get the next message id

All longs are less than 22 digits long

Note that in this routine we assume that System.currentTimeMillis() is non-negative always be non-negative (so don't set lastMessageID to a positive for a start). the next message id
throws:
  JMSException - for any error




getServerIL
public ServerIL getServerIL()(Code)
Gets the ServerIL attribute of the Connection object The ServerIL value



getThreadGroup
public static ThreadGroup getThreadGroup()(Code)



pingServer
void pingServer(long clientTime) throws JMSException(Code)
Ping the server
Parameters:
  clientTime - the start of the ping
throws:
  JMSException - for any error



receive
SpyMessage receive(Subscription sub, long wait) throws JMSException(Code)
Receive a message
Parameters:
  sub - the subscription
Parameters:
  wait - the wait time the message or null if there isn't one
throws:
  JMSException - for any error



recover
protected Xid[] recover(int flags) throws JMSException(Code)
Recover
Parameters:
  flags - the flags
throws:
  JMSException - for any error



removeConsumer
void removeConsumer(SpyConsumer consumer) throws JMSException(Code)
Remove a consumer
Parameters:
  consumer - the consumer
throws:
  JMSException - for any error



send
protected void send(AcknowledgementRequest item) throws JMSException(Code)
Acknowledge/Nack a message
Parameters:
  item - the acknowledgement
exception:
  JMSException - for any error



send
protected void send(TransactionRequest transaction) throws JMSException(Code)
Commit/rollback
Parameters:
  transaction - the transaction request
exception:
  JMSException - for any error



sendToServer
void sendToServer(SpyMessage mes) throws JMSException(Code)
Send a message to the server
Parameters:
  mes - the message
throws:
  JMSException - for any error



sessionClosing
void sessionClosing(SpySession who)(Code)
Closing a session
Parameters:
  who - the session



setClientID
public void setClientID(String cID) throws JMSException(Code)



setExceptionListener
public void setExceptionListener(ExceptionListener listener) throws JMSException(Code)



start
public void start() throws JMSException(Code)



startILService
protected void startILService() throws JMSException(Code)
Start the il
exception:
  JMSException - for any error



stop
public void stop() throws JMSException(Code)



stopILService
protected void stopILService() throws JMSException(Code)
Stop the il
exception:
  JMSException - for any error



toString
public String toString()(Code)



unsubscribe
void unsubscribe(DurableSubscriptionID id) throws JMSException(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.