Java Doc for PullPushAdapter.java in  » Net » JGroups-2.4.1-sp3 » org » jgroups » blocks » 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 » Net » JGroups 2.4.1 sp3 » org.jgroups.blocks 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.jgroups.blocks.PullPushAdapter

PullPushAdapter
public class PullPushAdapter implements Runnable,ChannelListener(Code)
Allows a client of org.jgroups.Channel to be notified when messages have been received instead of having to actively poll the channel for new messages. Typically used in the client role (receive()). As this class does not implement interface org.jgroups.Transport , but uses it for receiving messages, an underlying object has to be used to send messages (e.g. the channel on which an object of this class relies).

Multiple MembershipListeners can register with the PullPushAdapter; when a view is received, they will all be notified. There is one main message listener which sends and receives message. In addition, MessageListeners can register with a certain tag (identifier), and then send messages tagged with this identifier. When a message with such an identifier is received, the corresponding MessageListener will be looked up and the message dispatched to it. If no tag is found (default), the main MessageListener will receive the message.
author:
   Bela Ban
version:
   $Revision


Inner Class :final public static class PullHeader extends Header

Field Summary
final static  StringPULL_HEADER
    
protected  MessageListenerlistener
    
final protected  HashMaplisteners
    
final protected  Loglog
    
final protected  Listmembership_listeners
    
protected  Threadreceiver_thread
    
protected  Transporttransport
    

Constructor Summary
public  PullPushAdapter(Transport transport)
    
public  PullPushAdapter(Transport transport, MessageListener l)
    
public  PullPushAdapter(Transport transport, MembershipListener ml)
    
public  PullPushAdapter(Transport transport, MessageListener l, MembershipListener ml)
    
public  PullPushAdapter(Transport transport, MessageListener l, MembershipListener ml, boolean start)
    

Method Summary
final public  voidaddMembershipListener(MembershipListener l)
    
public  voidchannelClosed(Channel channel)
    
public  voidchannelConnected(Channel channel)
    
public  voidchannelDisconnected(Channel channel)
    
public  voidchannelReconnected(Address addr)
    
public  voidchannelShunned()
    
public  MessageListenergetListener()
    
public  TransportgetTransport()
    
protected  voidhandleMessage(Message msg)
     Check whether the message has an identifier.
protected  voidnotifyBlock()
    
protected  voidnotifySuspect(Address suspected_mbr)
    
protected  voidnotifyUnblock()
    
protected  voidnotifyViewChange(View v)
    
public  voidregisterListener(Serializable identifier, MessageListener l)
     Sets a listener to messages with a given identifier.
public  voidremoveMembershipListener(MembershipListener l)
    
public  voidrun()
    
public  voidsend(Serializable identifier, Message msg)
     Sends a message to the group - listeners to this identifier will receive the messages.
public  voidsend(Message msg)
     Sends a message with no identifier; listener member will get this message on the other group members.
final public  voidsetListener(MessageListener l)
    
public  voidsetMembershipListener(MembershipListener ml)
    
final public  voidstart()
    
public  voidstop()
    
public  voidunregisterListener(Serializable identifier)
     Removes a message listener to a given identifier from the message listeners map.

Field Detail
PULL_HEADER
final static String PULL_HEADER(Code)



listener
protected MessageListener listener(Code)



listeners
final protected HashMap listeners(Code)



log
final protected Log log(Code)



membership_listeners
final protected List membership_listeners(Code)



receiver_thread
protected Thread receiver_thread(Code)



transport
protected Transport transport(Code)




Constructor Detail
PullPushAdapter
public PullPushAdapter(Transport transport)(Code)



PullPushAdapter
public PullPushAdapter(Transport transport, MessageListener l)(Code)



PullPushAdapter
public PullPushAdapter(Transport transport, MembershipListener ml)(Code)



PullPushAdapter
public PullPushAdapter(Transport transport, MessageListener l, MembershipListener ml)(Code)



PullPushAdapter
public PullPushAdapter(Transport transport, MessageListener l, MembershipListener ml, boolean start)(Code)




Method Detail
addMembershipListener
final public void addMembershipListener(MembershipListener l)(Code)



channelClosed
public void channelClosed(Channel channel)(Code)



channelConnected
public void channelConnected(Channel channel)(Code)



channelDisconnected
public void channelDisconnected(Channel channel)(Code)



channelReconnected
public void channelReconnected(Address addr)(Code)



channelShunned
public void channelShunned()(Code)



getListener
public MessageListener getListener()(Code)
Returns the listener.



getTransport
public Transport getTransport()(Code)



handleMessage
protected void handleMessage(Message msg)(Code)
Check whether the message has an identifier. If yes, lookup the MessageListener associated with the given identifier in the hashtable and dispatch to it. Otherwise just use the main (default) message listener



notifyBlock
protected void notifyBlock()(Code)



notifySuspect
protected void notifySuspect(Address suspected_mbr)(Code)



notifyUnblock
protected void notifyUnblock()(Code)



notifyViewChange
protected void notifyViewChange(View v)(Code)



registerListener
public void registerListener(Serializable identifier, MessageListener l)(Code)
Sets a listener to messages with a given identifier. Messages sent with this identifier in their headers will be routed to this listener. Note: there can be only one listener for one identifier; if you want to register a different listener to an already registered identifier, then unregister first.
Parameters:
  identifier - - messages sent on the group with this object will be received by this listener
Parameters:
  l - - the listener that will get the message



removeMembershipListener
public void removeMembershipListener(MembershipListener l)(Code)



run
public void run()(Code)
Reentrant run(): message reception is serialized, then the listener is notified of the message reception



send
public void send(Serializable identifier, Message msg) throws Exception(Code)
Sends a message to the group - listeners to this identifier will receive the messages.
Parameters:
  identifier - the key that the proper listeners are listenting on
Parameters:
  msg - the Message to be sent
See Also:   PullPushAdapter.registerListener



send
public void send(Message msg) throws Exception(Code)
Sends a message with no identifier; listener member will get this message on the other group members.
Parameters:
  msg - the Message to be sent
throws:
  Exception -



setListener
final public void setListener(MessageListener l)(Code)



setMembershipListener
public void setMembershipListener(MembershipListener ml)(Code)
PullPushAdapter.addMembershipListener



start
final public void start()(Code)



stop
public void stop()(Code)



unregisterListener
public void unregisterListener(Serializable identifier)(Code)
Removes a message listener to a given identifier from the message listeners map.
Parameters:
  identifier - - the key to whom we do not want to listen any more



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.