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


java.lang.Object
   java.lang.Thread
      org.jgroups.stack.UpHandler
         org.jgroups.protocols.Discovery

All known Subclasses:   org.jgroups.protocols.WANPING,  org.jgroups.protocols.TCPPING,  org.jgroups.protocols.PING,  org.jgroups.protocols.TCPGOSSIP,
Discovery
abstract public class Discovery extends Protocol (Code)
The Discovery protocol layer retrieves the initial membership (used by the GMS when started by sending event FIND_INITIAL_MBRS down the stack). We do this by specific subclasses, e.g. by mcasting PING requests to an IP MCAST address or, if gossiping is enabled, by contacting the GossipRouter. The responses should allow us to determine the coordinator whom we have to contact, e.g. in case we want to join the group. When we are a server (after having received the BECOME_SERVER event), we'll respond to PING requests with a PING response.

The FIND_INITIAL_MBRS event will eventually be answered with a FIND_INITIAL_MBRS_OK event up the stack. The following properties are available

  • timeout - the timeout (ms) to wait for the initial members, default is 3000=3 secs
  • num_initial_members - the minimum number of initial members for a FIND_INITAL_MBRS, default is 2
  • num_ping_requests - the number of GET_MBRS_REQ messages to be sent (min=1), distributed over timeout ms

author:
   Bela Ban
version:
   $Id: Discovery.java,v 1.16.2.1 2007/04/27 08:03:51 belaban Exp $


Field Summary
 Stringgroup_addr
    
 booleanis_server
    
 Addresslocal_addr
    
final  Vectormembers
    
 intnum_discovery_requests
    
 intnum_initial_members
    
 intnum_ping_requests
    
 PingWaiterping_waiter
    
 longtimeout
    


Method Summary
public  voiddown(Event evt)
     An event is to be sent down the stack.
public  VectorfindInitialMembers()
    
public  StringfindInitialMembersAsString()
    
public  intgetNumInitialMembers()
    
public  intgetNumPingRequests()
    
public  intgetNumberOfDiscoveryRequestsSent()
    
public  longgetTimeout()
    
public  voidhandleConnect()
    
public  voidhandleConnectOK()
    
public  voidhandleDisconnect()
    
public  voidlocalAddressSet(Address addr)
    
final protected  ViewmakeView(Vector mbrs)
    
public  VectorprovidedUpServices()
    
public  voidresetStats()
    
abstract public  voidsendGetMembersRequest()
    
public  voidsetNumInitialMembers(int num_initial_members)
    
public  voidsetNumPingRequests(int num_ping_requests)
    
public  booleansetProperties(Properties props)
     sets the properties of the PING protocol.
public  voidsetTimeout(long timeout)
    
public  voidstart()
    
public  voidstop()
    
public  voidup(Event evt)
     An event was received from the layer below.

Field Detail
group_addr
String group_addr(Code)



is_server
boolean is_server(Code)



local_addr
Address local_addr(Code)



members
final Vector members(Code)



num_discovery_requests
int num_discovery_requests(Code)



num_initial_members
int num_initial_members(Code)



num_ping_requests
int num_ping_requests(Code)
Number of GET_MBRS_REQ messages to be sent (min=1), distributed over timeout ms



ping_waiter
PingWaiter ping_waiter(Code)



timeout
long timeout(Code)





Method Detail
down
public void down(Event evt)(Code)
An event is to be sent down the stack. The layer may want to examine its type and perform some action on it, depending on the event's type. If the event is a message MSG, then the layer may need to add a header to it (or do nothing at all) before sending it down the stack using PassDown. In case of a GET_ADDRESS event (which tries to retrieve the stack's address from one of the bottom layers), the layer may need to send a new response event back up the stack using passUp(). The PING protocol is interested in several different down events, Event.FIND_INITIAL_MBRS - sent by the GMS layer and expecting a GET_MBRS_OK Event.TMP_VIEW and Event.VIEW_CHANGE - a view change event Event.BECOME_SERVER - called after client has joined and is fully working group member Event.CONNECT, Event.DISCONNECT.



findInitialMembers
public Vector findInitialMembers()(Code)
Finds the initial membership Vector



findInitialMembersAsString
public String findInitialMembersAsString()(Code)



getNumInitialMembers
public int getNumInitialMembers()(Code)



getNumPingRequests
public int getNumPingRequests()(Code)



getNumberOfDiscoveryRequestsSent
public int getNumberOfDiscoveryRequestsSent()(Code)



getTimeout
public long getTimeout()(Code)



handleConnect
public void handleConnect()(Code)



handleConnectOK
public void handleConnectOK()(Code)
Called when CONNECT_OK has been received



handleDisconnect
public void handleDisconnect()(Code)



localAddressSet
public void localAddressSet(Address addr)(Code)
Called after local_addr was set



makeView
final protected View makeView(Vector mbrs)(Code)



providedUpServices
public Vector providedUpServices()(Code)



resetStats
public void resetStats()(Code)



sendGetMembersRequest
abstract public void sendGetMembersRequest()(Code)



setNumInitialMembers
public void setNumInitialMembers(int num_initial_members)(Code)



setNumPingRequests
public void setNumPingRequests(int num_ping_requests)(Code)



setProperties
public boolean setProperties(Properties props)(Code)
sets the properties of the PING protocol. The following properties are available property: timeout - the timeout (ms) to wait for the initial members, default is 3000=3 secs property: num_initial_members - the minimum number of initial members for a FIND_INITAL_MBRS, default is 2
Parameters:
  props - - a property set returns true if all properties were parsed properlyreturns false if there are unrecnogized properties in the property set



setTimeout
public void setTimeout(long timeout)(Code)



start
public void start() throws Exception(Code)



stop
public void stop()(Code)



up
public void up(Event evt)(Code)
An event was received from the layer below. Usually the current layer will want to examine the event type and - depending on its type - perform some computation (e.g. removing headers from a MSG event type, or updating the internal membership list when receiving a VIEW_CHANGE event). Finally the event is either a) discarded, or b) an event is sent down the stack using PassDown or c) the event (or another event) is sent up the stack using PassUp.

For the PING protocol, the Up operation does the following things. 1. If the event is a Event.MSG then PING will inspect the message header. If the header is null, PING simply passes up the event If the header is PingHeader.GET_MBRS_REQ then the PING protocol will PassDown a PingRequest message If the header is PingHeader.GET_MBRS_RSP we will add the message to the initial members vector and wake up any waiting threads. 2. If the event is Event.SET_LOCAL_ADDR we will simple set the local address of this protocol 3. For all other messages we simple pass it up to the protocol above
Parameters:
  evt - - the event that has been sent from the layer below




Fields inherited from org.jgroups.stack.UpHandler
final protected Log log(Code)(Java Doc)

Methods inherited from org.jgroups.stack.UpHandler
public void run()(Code)(Java Doc)
public void setObserver(ProtocolObserver observer)(Code)(Java Doc)

Fields inherited from java.lang.Thread
final public static int MAX_PRIORITY(Code)(Java Doc)
final public static int MIN_PRIORITY(Code)(Java Doc)
final public static int NORM_PRIORITY(Code)(Java Doc)

Methods inherited from java.lang.Thread
public static int activeCount()(Code)(Java Doc)
final public void checkAccess()(Code)(Java Doc)
native public int countStackFrames()(Code)(Java Doc)
native public static Thread currentThread()(Code)(Java Doc)
public void destroy()(Code)(Java Doc)
public static void dumpStack()(Code)(Java Doc)
public static int enumerate(Thread tarray)(Code)(Java Doc)
public static Map<Thread, StackTraceElement[]> getAllStackTraces()(Code)(Java Doc)
public ClassLoader getContextClassLoader()(Code)(Java Doc)
public static UncaughtExceptionHandler getDefaultUncaughtExceptionHandler()(Code)(Java Doc)
public long getId()(Code)(Java Doc)
final public String getName()(Code)(Java Doc)
final public int getPriority()(Code)(Java Doc)
public StackTraceElement[] getStackTrace()(Code)(Java Doc)
public State getState()(Code)(Java Doc)
final public ThreadGroup getThreadGroup()(Code)(Java Doc)
public UncaughtExceptionHandler getUncaughtExceptionHandler()(Code)(Java Doc)
native public static boolean holdsLock(Object obj)(Code)(Java Doc)
public void interrupt()(Code)(Java Doc)
public static boolean interrupted()(Code)(Java Doc)
final native public boolean isAlive()(Code)(Java Doc)
final public boolean isDaemon()(Code)(Java Doc)
public boolean isInterrupted()(Code)(Java Doc)
final public synchronized void join(long millis) throws InterruptedException(Code)(Java Doc)
final public synchronized void join(long millis, int nanos) throws InterruptedException(Code)(Java Doc)
final public void join() throws InterruptedException(Code)(Java Doc)
final public void resume()(Code)(Java Doc)
public void run()(Code)(Java Doc)
public void setContextClassLoader(ClassLoader cl)(Code)(Java Doc)
final public void setDaemon(boolean on)(Code)(Java Doc)
public static void setDefaultUncaughtExceptionHandler(UncaughtExceptionHandler eh)(Code)(Java Doc)
final public void setName(String name)(Code)(Java Doc)
final public void setPriority(int newPriority)(Code)(Java Doc)
public void setUncaughtExceptionHandler(UncaughtExceptionHandler eh)(Code)(Java Doc)
native public static void sleep(long millis) throws InterruptedException(Code)(Java Doc)
public static void sleep(long millis, int nanos) throws InterruptedException(Code)(Java Doc)
public synchronized void start()(Code)(Java Doc)
final public void stop()(Code)(Java Doc)
final public synchronized void stop(Throwable obj)(Code)(Java Doc)
final public void suspend()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
native public static void yield()(Code)(Java Doc)

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.