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


java.lang.Object
   org.jgroups.stack.NakReceiverWindow

All known Subclasses:   org.jgroups.protocols.pbcast.NAKACK,
NakReceiverWindow
public class NakReceiverWindow (Code)
Keeps track of messages according to their sequence numbers. Allows messages to be added out of order, and with gaps between sequence numbers. Method remove() removes the first message with a sequence number that is 1 higher than next_to_remove (this variable is then incremented), or it returns null if no message is present, or if no message's sequence number is 1 higher.

When there is a gap upon adding a message, its seqno will be added to the Retransmitter, which (using a timer) requests retransmissions of missing messages and keeps on trying until the message has been received, or the member who sent the message is suspected.

Started out as a copy of SlidingWindow. Main diff: RetransmitCommand is different, and retransmission thread is only created upon detection of a gap.

Change Nov 24 2000 (bela): for PBCAST, which has its own retransmission (via gossip), the retransmitter thread can be turned off

Change April 25 2001 (igeorg):
i. Restructuring: placed all nested class definitions at the top, then class static/non-static variables, then class private/public methods.
ii. Class and all nested classes are thread safe. Readers/writer lock added on NakReceiverWindow for finer grained locking.
iii. Internal or externally provided retransmission scheduler thread.
iv. Exponential backoff in time for retransmissions.

author:
   Bela Ban May 27 1999, May 2004
author:
   John Georgiadis May 8 2001


Inner Class :public interface Listener

Field Summary
final protected static  Loglog
    

Constructor Summary
public  NakReceiverWindow(Address sender, Retransmitter.RetransmitCommand cmd, long start_seqno, TimeScheduler sched)
     Creates a new instance with the given retransmit command
Parameters:
  sender - The sender associated with this instance
Parameters:
  cmd - The command used to retransmit a missing message, willbe invoked by the table.
public  NakReceiverWindow(Address sender, Retransmitter.RetransmitCommand cmd, long start_seqno)
     Creates a new instance with the given retransmit command
Parameters:
  sender - The sender associated with this instance
Parameters:
  cmd - The command used to retransmit a missing message, willbe invoked by the table.
public  NakReceiverWindow(Address sender, long start_seqno)
    

Method Summary
public  voidadd(long seqno, Message msg)
     Adds a message according to its sequence number (ordered).

Variables head and tail mark the start and end of the messages received, but not delivered yet.

public  voiddestroy()
    
public  Messageget(long sequence_num)
     Returns the message from received_msgs or delivered_msgs.
public  longgetHighestDelivered()
    
public  longgetHighestReceived()
     Returns the highest sequence number received so far (which may be higher than the highest seqno delivered so far; e.g., for 1,2,3,5,6 it would be 6.
public  longgetHighestSeen()
     Returns the highest deliverable seqno; e.g., for 1,2,3,5,6 it would be 3.
public  longgetLowestSeen()
    
public  intgetMaxXmitBufSize()
    
public  ListgetMessagesHigherThan(long seqno)
     Return messages that are higher than seqno (excluding seqno).
public  ListgetMessagesInList(List missing_msgs)
     Return a list of all messages for which there is a seqno in missing_msgs.
public  ListgetMessagesInRange(long lower, long upper)
     Return all messages m for which the following holds: m > lower && m <= upper (excluding lower, including upper).
public  ListgetMissingMessages(long low, long high)
     Find all messages between 'low' and 'high' (including 'low' and 'high') that have a null msg. Return them as a list of longs List.
 StringprintDeliveredMessages()
     Prints delivered_msgs.
 StringprintReceivedMessages()
     Prints received_msgs.
public  Messageremove()
    
public  voidreset()
    
public  voidsetDiscardDeliveredMessages(boolean flag)
    
public  voidsetListener(Listener l)
    
public  voidsetMaxXmitBufSize(int max_xmit_buf_size)
    
public  voidsetRetransmitTimeouts(long[] timeouts)
    
public  intsize()
    
public  voidstable(long seqno)
     Delete all messages <= seqno (they are stable, that is, have been received at all members).
public  StringtoString()
    
 voidupdateHighestSeen()
    

Field Detail
log
final protected static Log log(Code)




Constructor Detail
NakReceiverWindow
public NakReceiverWindow(Address sender, Retransmitter.RetransmitCommand cmd, long start_seqno, TimeScheduler sched)(Code)
Creates a new instance with the given retransmit command
Parameters:
  sender - The sender associated with this instance
Parameters:
  cmd - The command used to retransmit a missing message, willbe invoked by the table. If null, the retransmit thread will not bestarted
Parameters:
  start_seqno - The first sequence number to be received
Parameters:
  sched - the external scheduler to use for retransmissionrequests of missing msgs. If it's not provided or is null, an internalone is created



NakReceiverWindow
public NakReceiverWindow(Address sender, Retransmitter.RetransmitCommand cmd, long start_seqno)(Code)
Creates a new instance with the given retransmit command
Parameters:
  sender - The sender associated with this instance
Parameters:
  cmd - The command used to retransmit a missing message, willbe invoked by the table. If null, the retransmit thread will not bestarted
Parameters:
  start_seqno - The first sequence number to be received



NakReceiverWindow
public NakReceiverWindow(Address sender, long start_seqno)(Code)
Creates a new instance without a retransmission thread
Parameters:
  sender - The sender associated with this instance
Parameters:
  start_seqno - The first sequence number to be received




Method Detail
add
public void add(long seqno, Message msg)(Code)
Adds a message according to its sequence number (ordered).

Variables head and tail mark the start and end of the messages received, but not delivered yet. When a message is received, if its seqno is smaller than head, it is discarded (already received). If it is bigger than tail, we advance tail and add empty elements. If it is between head and tail, we set the corresponding missing (or already present) element. If it is equal to tail, we advance the latter by 1 and add the message (default case).




destroy
public void destroy()(Code)
Stop the retransmitter and reset the nak window



get
public Message get(long sequence_num)(Code)
Returns the message from received_msgs or delivered_msgs.
Parameters:
  sequence_num - Message from received_msgs or delivered_msgs.



getHighestDelivered
public long getHighestDelivered()(Code)
the highest sequence number of a message consumed by theapplication (by remove())



getHighestReceived
public long getHighestReceived()(Code)
Returns the highest sequence number received so far (which may be higher than the highest seqno delivered so far; e.g., for 1,2,3,5,6 it would be 6.
See Also:   NakReceiverWindow.getHighestSeen



getHighestSeen
public long getHighestSeen()(Code)
Returns the highest deliverable seqno; e.g., for 1,2,3,5,6 it would be 3.
See Also:   NakReceiverWindow.getHighestReceived



getLowestSeen
public long getLowestSeen()(Code)
the lowest sequence number of a message that has beendelivered or is a candidate for delivery (by the next call toremove())



getMaxXmitBufSize
public int getMaxXmitBufSize()(Code)



getMessagesHigherThan
public List getMessagesHigherThan(long seqno)(Code)
Return messages that are higher than seqno (excluding seqno). Check both received and delivered messages. List. All messages that have a seqno greater than seqno



getMessagesInList
public List getMessagesInList(List missing_msgs)(Code)
Return a list of all messages for which there is a seqno in missing_msgs. The seqnos of the argument list are supposed to be in ascending order
Parameters:
  missing_msgs - A List of seqnos List



getMessagesInRange
public List getMessagesInRange(long lower, long upper)(Code)
Return all messages m for which the following holds: m > lower && m <= upper (excluding lower, including upper). Check both received_msgs and delivered_msgs.



getMissingMessages
public List getMissingMessages(long low, long high)(Code)
Find all messages between 'low' and 'high' (including 'low' and 'high') that have a null msg. Return them as a list of longs List. A list of seqnos, sorted in ascending order.E.g. [1, 4, 7, 8]



printDeliveredMessages
String printDeliveredMessages()(Code)
Prints delivered_msgs. Requires read lock present. String



printReceivedMessages
String printReceivedMessages()(Code)
Prints received_msgs. Requires read lock to be present String



remove
public Message remove()(Code)



reset
public void reset()(Code)
Reset the retransmitter and the nak window



setDiscardDeliveredMessages
public void setDiscardDeliveredMessages(boolean flag)(Code)



setListener
public void setListener(Listener l)(Code)



setMaxXmitBufSize
public void setMaxXmitBufSize(int max_xmit_buf_size)(Code)



setRetransmitTimeouts
public void setRetransmitTimeouts(long[] timeouts)(Code)



size
public int size()(Code)



stable
public void stable(long seqno)(Code)
Delete all messages <= seqno (they are stable, that is, have been received at all members). Stop when a number > seqno is encountered (all messages are ordered on seqnos).



toString
public String toString()(Code)



updateHighestSeen
void updateHighestSeen()(Code)
Start from the current sequence number and set highest_seen until we find a gap (null value in the entry)



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.