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


java.lang.Object
   java.lang.Thread
      org.jgroups.stack.UpHandler
         org.jgroups.protocols.pbcast.GMS

GMS
public class GMS extends Protocol (Code)
Group membership protocol. Handles joins/leaves/crashes (suspicions) and emits new views accordingly. Use VIEW_ENFORCER on top of this layer to make sure new members don't receive any messages until they are members
author:
   Bela Ban
version:
   $Id: GMS.java,v 1.68.2.5 2007/04/27 08:03:55 belaban Exp $

Inner Class :public static class GmsHeader extends Header implements Streamable
Inner Class :public static class Request
Inner Class :class ViewHandler implements Runnable
Inner Class :static class Resumer implements TimeScheduler.CancellableTask

Field Summary
final static  StringCLIENT
    
final static  StringCOORD
    
final static  StringPART
    
final  AckCollectorack_collector
    
 booleandisable_initial_coord
    
 booleanflushProtocolInStack
    
 longflush_timeout
    
 booleanhandle_concurrent_startup
     Setting this to false disables concurrent startups.
 longjoin_retry_timeout
    
 longjoin_timeout
    
 longleave_timeout
    
 Addresslocal_addr
    
final  Membershipmembers
    
 booleanmerge_leader
    
 longmerge_timeout
    
final public static  Stringname
    
protected  intnum_prev_mbrs
    
 intnum_views
    
 BoundedListprev_members
    
 BoundedListprev_views
    
 longresume_task_timeout
    
 TimeSchedulertimer
    
 booleanuse_flush
    
 Viewview
    
 longview_ack_collection_timeout
    
 ViewIdview_id
    

Constructor Summary
public  GMS()
    

Method Summary
public  voidbecomeClient()
    
public  voidbecomeCoordinator()
    
public  voidbecomeParticipant()
    
public  voidcastViewChange(Vector new_mbrs, Vector old_mbrs, Vector suspected_mbrs)
     Compute a new view, given the current view, the new members and the suspected/left members.
public  voidcastViewChange(View new_view, Digest digest)
    
public  voidcastViewChangeWithDest(View new_view, Digest digest, java.util.List members)
     Broadcasts the new view and digest, and waits for acks from all members in the list given as argument.
protected  booleancheckSelfInclusion(Vector mbrs)
    
protected  AddressdetermineCoordinator()
    
public  voiddown(Event evt)
    
public  StringdumpViewHandlerHistory()
    
public  StringdumpViewHandlerQueue()
    
public  DigestgetDigest()
    
public  GmsImplgetImpl()
    
public  longgetJoinRetryTimeout()
    
public  longgetJoinTimeout()
    
public  StringgetLocalAddress()
    
 LoggetLog()
    
public  StringgetMembers()
    
public  StringgetName()
    
public  ViewgetNextView(Collection new_mbrs, Collection old_mbrs, Collection suspected_mbrs)
     Computes the next view.
public  intgetNumMembers()
    
public  intgetNumberOfViews()
    
public  StringgetView()
    
 ViewHandlergetViewHandler()
    
 booleanhaveCoordinatorRole()
    
public  voidinit()
    
final  voidinitState()
    
public  voidinstallView(View new_view, Digest digest)
     Sets the new view and sends a VIEW_CHANGE event up and down the stack.
public  voidinstallView(View new_view)
     Sets the new view and sends a VIEW_CHANGE event up and down the stack.
public  booleanisCoordinator()
    
public  booleanisShun()
    
public  booleanisViewHandlerSuspended()
    
public  ViewmakeView(Vector mbrs)
    
public  ViewmakeView(Vector mbrs, ViewId vid)
    
public  voidmergeDigest(Digest d)
    
public  StringprintPreviousMembers()
    
public  StringprintPreviousViews()
    
public  voidreceiveUpEvent(Event evt)
     This method is overridden to avoid hanging on getDigest(): when a JOIN is received, the coordinator needs to retrieve the digest from the NAKACK layer.
public  VectorrequiredDownServices()
    
public  voidresetStats()
    
public  voidresumeViewHandler()
    
public  voidsetDigest(Digest d)
    
public  voidsetImpl(GmsImpl new_impl)
    
public  voidsetJoinRetryTimeout(long t)
    
public  voidsetJoinTimeout(long t)
    
public  booleansetProperties(Properties props)
    
public  voidsetShun(boolean s)
    
public  voidstart()
    
 booleanstartFlush(View new_view, int numberOfAttempts)
    
public  voidstop()
    
 voidstopFlush(View view)
    
public  voidsuspendViewHandler()
    
public  voidup(Event evt)
    
public  intviewHandlerSize()
    
protected  booleanwouldBeNewCoordinator(Address potential_new_coord)
    

Field Detail
CLIENT
final static String CLIENT(Code)



COORD
final static String COORD(Code)



PART
final static String PART(Code)



ack_collector
final AckCollector ack_collector(Code)
To collect VIEW_ACKs from all members



disable_initial_coord
boolean disable_initial_coord(Code)



flushProtocolInStack
boolean flushProtocolInStack(Code)



flush_timeout
long flush_timeout(Code)



handle_concurrent_startup
boolean handle_concurrent_startup(Code)
Setting this to false disables concurrent startups. This is only used by unit testing code for testing merging. To everybody else: don't change it to false !



join_retry_timeout
long join_retry_timeout(Code)



join_timeout
long join_timeout(Code)



leave_timeout
long leave_timeout(Code)



local_addr
Address local_addr(Code)



members
final Membership members(Code)



merge_leader
boolean merge_leader(Code)



merge_timeout
long merge_timeout(Code)



name
final public static String name(Code)



num_prev_mbrs
protected int num_prev_mbrs(Code)
Max number of old members to keep in history



num_views
int num_views(Code)



prev_members
BoundedList prev_members(Code)
Keeps track of old members (up to num_prev_mbrs)



prev_views
BoundedList prev_views(Code)
Stores the last 20 views



resume_task_timeout
long resume_task_timeout(Code)
How long should a Resumer wait until resuming the ViewHandler



timer
TimeScheduler timer(Code)



use_flush
boolean use_flush(Code)



view
View view(Code)



view_ack_collection_timeout
long view_ack_collection_timeout(Code)
Time in ms to wait for all VIEW acks (0 == wait forever)



view_id
ViewId view_id(Code)




Constructor Detail
GMS
public GMS()(Code)




Method Detail
becomeClient
public void becomeClient()(Code)



becomeCoordinator
public void becomeCoordinator()(Code)



becomeParticipant
public void becomeParticipant()(Code)



castViewChange
public void castViewChange(Vector new_mbrs, Vector old_mbrs, Vector suspected_mbrs)(Code)
Compute a new view, given the current view, the new members and the suspected/left members. Then simply mcast the view to all members. This is different to the VS GMS protocol, in which we run a FLUSH protocol which tries to achive consensus on the set of messages mcast in the current view before proceeding to install the next view. The members for the new view are computed as follows:
 existing          leaving        suspected          joining
 1. new_view      y                 n               n                 y
 2. tmp_view      y                 y               n                 y
 (view_dest)
 
  1. The new view to be installed includes the existing members plus the joining ones and excludes the leaving and suspected members.
  2. A temporary view is sent down the stack as an event. This allows the bottom layer (e.g. UDP or TCP) to determine the members to which to send a multicast message. Compared to the new view, leaving members are included since they have are waiting for a view in which they are not members any longer before they leave. So, if we did not set a temporary view, joining members would not receive the view (signalling that they have been joined successfully). The temporary view is essentially the current view plus the joining members (old members are still part of the current view).



castViewChange
public void castViewChange(View new_view, Digest digest)(Code)



castViewChangeWithDest
public void castViewChangeWithDest(View new_view, Digest digest, java.util.List members)(Code)
Broadcasts the new view and digest, and waits for acks from all members in the list given as argument. If the list is null, we take the members who are part of new_view
Parameters:
  new_view -
Parameters:
  digest -
Parameters:
  members -



checkSelfInclusion
protected boolean checkSelfInclusion(Vector mbrs)(Code)
Returns true if local_addr is member of mbrs, else false



determineCoordinator
protected Address determineCoordinator()(Code)



down
public void down(Event evt)(Code)



dumpViewHandlerHistory
public String dumpViewHandlerHistory()(Code)



dumpViewHandlerQueue
public String dumpViewHandlerQueue()(Code)



getDigest
public Digest getDigest()(Code)
Sends down a GET_DIGEST event and waits for the GET_DIGEST_OK response, or timeout, whichever occurs first



getImpl
public GmsImpl getImpl()(Code)



getJoinRetryTimeout
public long getJoinRetryTimeout()(Code)



getJoinTimeout
public long getJoinTimeout()(Code)



getLocalAddress
public String getLocalAddress()(Code)



getLog
Log getLog()(Code)



getMembers
public String getMembers()(Code)



getName
public String getName()(Code)



getNextView
public View getNextView(Collection new_mbrs, Collection old_mbrs, Collection suspected_mbrs)(Code)
Computes the next view. Returns a copy that has old_mbrs and suspected_mbrs removed and new_mbrs added.



getNumMembers
public int getNumMembers()(Code)



getNumberOfViews
public int getNumberOfViews()(Code)



getView
public String getView()(Code)



getViewHandler
ViewHandler getViewHandler()(Code)



haveCoordinatorRole
boolean haveCoordinatorRole()(Code)



init
public void init() throws Exception(Code)



initState
final void initState()(Code)



installView
public void installView(View new_view, Digest digest)(Code)
Sets the new view and sends a VIEW_CHANGE event up and down the stack. If the view is a MergeView (subclass of View), then digest will be non-null and has to be set before installing the view.



installView
public void installView(View new_view)(Code)
Sets the new view and sends a VIEW_CHANGE event up and down the stack.



isCoordinator
public boolean isCoordinator()(Code)



isShun
public boolean isShun()(Code)



isViewHandlerSuspended
public boolean isViewHandlerSuspended()(Code)



makeView
public View makeView(Vector mbrs)(Code)



makeView
public View makeView(Vector mbrs, ViewId vid)(Code)



mergeDigest
public void mergeDigest(Digest d)(Code)
Send down a MERGE_DIGEST event



printPreviousMembers
public String printPreviousMembers()(Code)



printPreviousViews
public String printPreviousViews()(Code)



receiveUpEvent
public void receiveUpEvent(Event evt)(Code)
This method is overridden to avoid hanging on getDigest(): when a JOIN is received, the coordinator needs to retrieve the digest from the NAKACK layer. It therefore sends down a GET_DIGEST event, to which the NAKACK layer responds with a GET_DIGEST_OK event.

However, the GET_DIGEST_OK event will not be processed because the thread handling the JOIN request won't process the GET_DIGEST_OK event until the JOIN event returns. The receiveUpEvent() method is executed by the up-handler thread of the lower protocol and therefore can handle the event. All we do here is unblock the mutex on which JOIN is waiting, allowing JOIN to return with a valid digest. The GET_DIGEST_OK event is then discarded, because it won't be processed twice.




requiredDownServices
public Vector requiredDownServices()(Code)



resetStats
public void resetStats()(Code)



resumeViewHandler
public void resumeViewHandler()(Code)



setDigest
public void setDigest(Digest d)(Code)
Send down a SET_DIGEST event



setImpl
public void setImpl(GmsImpl new_impl)(Code)



setJoinRetryTimeout
public void setJoinRetryTimeout(long t)(Code)



setJoinTimeout
public void setJoinTimeout(long t)(Code)



setProperties
public boolean setProperties(Properties props)(Code)
Setup the Protocol instance according to the configuration string



setShun
public void setShun(boolean s)(Code)



start
public void start() throws Exception(Code)



startFlush
boolean startFlush(View new_view, int numberOfAttempts)(Code)



stop
public void stop()(Code)



stopFlush
void stopFlush(View view)(Code)



suspendViewHandler
public void suspendViewHandler()(Code)



up
public void up(Event evt)(Code)



viewHandlerSize
public int viewHandlerSize()(Code)



wouldBeNewCoordinator
protected boolean wouldBeNewCoordinator(Address potential_new_coord)(Code)
Checks whether the potential_new_coord would be the new coordinator (2nd in line)



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.