Java Doc for EventSupport.java in  » 6.0-JDK-Modules-com.sun » jndi » com » sun » jndi » ldap » 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 » 6.0 JDK Modules com.sun » jndi » com.sun.jndi.ldap 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.sun.jndi.ldap.EventSupport

EventSupport
final class EventSupport (Code)
This is a utility class that can be used by a context that supports event notification. You can use an instance of this class as a member field of your context and delegate various work to it. It is currently structured so that each context should have its own EventSupport (instead of static version shared by all contexts of a service provider).

This class supports two types of listeners: those that register for NamingEvents, and those for UnsolicitedNotificationEvents (they can be mixed into the same listener). For NamingEvent listeners, it maintains a hashtable that maps registration requests--the key--to notifiers--the value. Each registration request consists of:

  • The name argument of the registration.
  • The filter (default is "(objectclass=*)").
  • The search controls (default is null SearchControls).
  • The events that the listener is interested in. This is determined by finding out which NamingListener interface the listener supports.

A notifier (NamingEventNotifier) is a worker thread that is responsible for gathering information for generating events requested by its listeners. Each notifier maintains its own list of listeners; these listeners have all made the same registration request (at different times) and implements the same NamingListener interfaces.

For unsolicited listeners, this class maintains a vector, unsolicited. When an unsolicited listener is registered, this class adds itself to the context's LdapClient. When LdapClient receives an unsolicited notification, it notifies this EventSupport to fire an event to the the listeners. Special handling in LdapClient is done for the DISCONNECT notification. [It results in the EventSupport firing also a NamingExceptionEvent to the unsolicited listeners.]

When a context no longer needs this EventSupport, it should invoke cleanup() on it.

Registration

When a registration request is made, this class attempts to find an existing notifier that's already working on the request. If one is found, the listener is added to the notifier's list. If one is not found, a new notifier is created for the listener.

Deregistration

When a deregistration request is made, this class attemps to find its corresponding notifier. If the notifier is found, the listener is removed from the notifier's list. If the listener is the last listener on the list, the notifier's thread is terminated and removed from this class's hashtable. Nothing happens if the notifier is not found.

Event Dispatching

The notifiers are responsible for gather information for generating events requested by their respective listeners. When a notifier gets sufficient information to generate an event, it creates invokes the appropriate fireXXXEvent on this class with the information and list of listeners. This causes an event and the list of listeners to be added to the event queue. This class maintains an event queue and a dispatching thread that dequeues events from the queue and dispatches them to the listeners.

Synchronization

This class is used by the main thread (LdapCtx) to add/remove listeners. It is also used asynchronously by NamingEventNotifiers threads and the context's Connection thread. It is used by the notifier threads to queue events and to update the notifiers list when the notifiers exit. It is used by the Connection thread to fire unsolicited notifications. Methods that access/update the 'unsolicited' and 'notifiers' lists are thread-safe.
author:
   Rosanna Lee



Constructor Summary
 EventSupport(LdapCtx ctx)
     Constructs EventSupport for ctx.

Method Summary
synchronized  voidaddNamingListener(String nm, int scope, NamingListener l)
     Adds l to list of listeners interested in nm.
synchronized  voidaddNamingListener(String nm, String filter, SearchControls ctls, NamingListener l)
     Adds l to list of listeners interested in nm and filter.
synchronized  voidcleanup()
     Stops notifier threads that are collecting event data and stops the event queue from dispatching events.
synchronized  voidfireUnsolicited(Object obj)
     Fire an event to unsolicited listeners.
synchronized  booleanhasUnsolicited()
    
synchronized  voidqueueEvent(EventObject event, Vector vector)
     Add the event and vector of listeners to the queue to be delivered.
synchronized  voidremoveDeadNotifier(NotifierArgs info)
     package private; Called by NamingEventNotifier to remove itself when it encounters a NamingException.
synchronized  voidremoveNamingListener(NamingListener l)
     Removes l from all notifiers in this context.


Constructor Detail
EventSupport
EventSupport(LdapCtx ctx)(Code)
Constructs EventSupport for ctx. Do we need to record the name of the target context? Or can we assume that EventSupport is called on a resolved context? Do we need other add/remove-NamingListener methods? package private;




Method Detail
addNamingListener
synchronized void addNamingListener(String nm, int scope, NamingListener l) throws NamingException(Code)
Adds l to list of listeners interested in nm.



addNamingListener
synchronized void addNamingListener(String nm, String filter, SearchControls ctls, NamingListener l) throws NamingException(Code)
Adds l to list of listeners interested in nm and filter.



cleanup
synchronized void cleanup()(Code)
Stops notifier threads that are collecting event data and stops the event queue from dispatching events. Package private; used by LdapCtx.



fireUnsolicited
synchronized void fireUnsolicited(Object obj)(Code)
Fire an event to unsolicited listeners. package private; Called by LdapCtx when its clnt receives an unsolicited notification.



hasUnsolicited
synchronized boolean hasUnsolicited()(Code)



queueEvent
synchronized void queueEvent(EventObject event, Vector vector)(Code)
Add the event and vector of listeners to the queue to be delivered. An event dispatcher thread dequeues events from the queue and dispatches them to the registered listeners. Package private; used by NamingEventNotifier to fire events



removeDeadNotifier
synchronized void removeDeadNotifier(NotifierArgs info)(Code)
package private; Called by NamingEventNotifier to remove itself when it encounters a NamingException.



removeNamingListener
synchronized void removeNamingListener(NamingListener l)(Code)
Removes l from all notifiers in this context.



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.