Source Code Cross Referenced for NakAckHeader.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 Referenced  Class Diagram Java Document (Java Doc) 


001:        // $Id: NakAckHeader.java,v 1.4 2004/07/05 14:17:15 belaban Exp $
002:
003:        package org.jgroups.protocols;
004:
005:        import org.jgroups.Address;
006:        import org.jgroups.Header;
007:        import org.jgroups.ViewId;
008:
009:        import java.io.IOException;
010:        import java.io.ObjectInput;
011:        import java.io.ObjectOutput;
012:        import java.util.Vector;
013:
014:        public class NakAckHeader extends Header {
015:            public static final int NAK_MSG = 1; // asynchronous msg
016:            public static final int NAK_ACK_MSG = 2; // synchronous msg
017:            public static final int WRAPPED_MSG = 3; // a wrapped msg, needs to be ACKed
018:            public static final int RETRANSMIT_MSG = 4; // retransmit msg
019:            public static final int NAK_ACK_RSP = 5; // ack to NAK_ACK_MSG, seqno contains ACKed
020:            public static final int OUT_OF_BAND_MSG = 6; // out-of-band msg
021:            public static final int OUT_OF_BAND_RSP = 7; // ack for out-of-band msg
022:
023:            int type = 0;
024:            long seqno = -1; // either reg. NAK_ACK_MSG or first_seqno in retransmissions
025:            long last_seqno = -1; // used for retransmissions
026:            ViewId vid = null;
027:
028:            // the messages from this sender can be deleted safely (OutOfBander). Contains seqnos (Longs)
029:            Vector stable_msgs = null;
030:            Address sender = null; // In case of WRAPPED_MSG: the address to which an ACK has to be sent
031:
032:            public NakAckHeader() {
033:            }
034:
035:            public NakAckHeader(int type, long seqno, ViewId vid) {
036:                this .type = type;
037:                this .seqno = seqno;
038:                this .vid = vid;
039:            }
040:
041:            public long size() {
042:                return 512;
043:            }
044:
045:            public void writeExternal(ObjectOutput out) throws IOException {
046:                out.writeInt(type);
047:                out.writeLong(seqno);
048:                out.writeLong(last_seqno);
049:                out.writeObject(vid);
050:                out.writeObject(stable_msgs);
051:                out.writeObject(sender);
052:            }
053:
054:            public void readExternal(ObjectInput in) throws IOException,
055:                    ClassNotFoundException {
056:                type = in.readInt();
057:                seqno = in.readLong();
058:                last_seqno = in.readLong();
059:                vid = (ViewId) in.readObject();
060:                stable_msgs = (Vector) in.readObject();
061:                sender = (Address) in.readObject();
062:            }
063:
064:            public NakAckHeader copy() {
065:                NakAckHeader ret = new NakAckHeader(type, seqno, vid);
066:                ret.last_seqno = last_seqno;
067:                ret.stable_msgs = stable_msgs != null ? (Vector) stable_msgs
068:                        .clone() : null;
069:                ret.sender = sender;
070:                return ret;
071:            }
072:
073:            public static String type2Str(int t) {
074:                switch (t) {
075:                case NAK_MSG:
076:                    return "NAK_MSG";
077:                case NAK_ACK_MSG:
078:                    return "NAK_ACK_MSG";
079:                case WRAPPED_MSG:
080:                    return "WRAPPED_MSG";
081:                case RETRANSMIT_MSG:
082:                    return "RETRANSMIT_MSG";
083:                case NAK_ACK_RSP:
084:                    return "NAK_ACK_RSP";
085:                case OUT_OF_BAND_MSG:
086:                    return "OUT_OF_BAND_MSG";
087:                case OUT_OF_BAND_RSP:
088:                    return "OUT_OF_BAND_RSP";
089:                default:
090:                    return "<undefined>";
091:                }
092:            }
093:
094:            public String toString() {
095:                StringBuffer ret = new StringBuffer();
096:                ret.append("[NAKACK: " + type2Str(type) + ", seqno=" + seqno
097:                        + ", last_seqno=" + last_seqno + ", vid=" + vid);
098:                if (type == WRAPPED_MSG)
099:                    ret.append(", sender=" + sender);
100:                ret.append(']');
101:
102:                return ret.toString();
103:            }
104:
105:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.