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


java.lang.Object
   org.jgroups.Message

Message
public class Message implements Externalizable,Streamable(Code)
A Message encapsulates data sent to members of a group. It contains among other things the address of the sender, the destination address, a payload (byte buffer) and a list of headers. Headers are added by protocols on the sender side and removed by protocols on the receiver's side.

The byte buffer can point to a reference, and we can subset it using index and length. However, when the message is serialized, we only write the bytes between index and length.
author:
   Bela Ban



Field Summary
final static  byteBUF_SET
    
final static  byteDEST_SET
    
final static  byteIPADDR_DEST
    
final static  byteIPADDR_SRC
    
final static  byteSRC_HOST_NULL
    
final static  byteSRC_SET
    
protected  Addressdest_addr
    
protected  Mapheaders
    
protected transient  intlength
     The number of bytes in the buffer (usually buf.length is buf not equal to null).
final protected static  Loglog
    
final static  HashSetnonStreamableHeaders
    
protected transient  intoffset
    
protected  Addresssrc_addr
    

Constructor Summary
public  Message(Address dest)
     Public constructor
Parameters:
  dest - Address of receiver.
public  Message(Address dest, Address src, byte[] buf)
     Public constructor
Parameters:
  dest - Address of receiver.
public  Message(Address dest, Address src, byte[] buf, int offset, int length)
     Constructs a message.
public  Message(Address dest, Address src, Serializable obj)
     Public constructor
Parameters:
  dest - Address of receiver.
public  Message()
    
public  Message(boolean create_headers)
    

Method Summary
protected  Objectclone()
    
public  Messagecopy()
    
public  Messagecopy(boolean copy_buffer)
     Create a copy of the message.
final public  byte[]getBuffer()
     Returns a copy of the buffer if offset and length are used, otherwise a reference.
public  AddressgetDest()
    
public  HeadergetHeader(String key)
    
public  MapgetHeaders()
    
public  intgetLength()
    
final public  ObjectgetObject()
    
public  intgetOffset()
    
public  byte[]getRawBuffer()
     Returns a reference to the payload (byte buffer).
public  AddressgetSrc()
    
public  MessagemakeReply()
    
public  StringprintObjectHeaders()
    
public  voidputHeader(String key, Header hdr)
     Puts a header given a key into the hashmap.
public  voidreadExternal(ObjectInput in)
    
public  voidreadFrom(DataInputStream in)
    
public  HeaderremoveHeader(String key)
    
public  voidremoveHeaders()
    
public  voidreset()
     Nulls all fields of this message so that the message can be reused.
final public  voidsetBuffer(byte[] b)
    
final public  voidsetBuffer(byte[] b, int offset, int length)
     Set the internal buffer to point to a subset of a given buffer
Parameters:
  b - The reference to a given buffer.
public  voidsetDest(Address new_dest)
    
final public  voidsetObject(Serializable obj)
    
public  voidsetSrc(Address new_src)
    
public  longsize()
     Returns the exact size of the marshalled message.
public  StringtoString()
    
public  StringtoStringAsObject()
    
public  voidwriteExternal(ObjectOutput out)
    
public  voidwriteTo(DataOutputStream out)
     Streams all members (dest and src addresses, buffer and headers) to the output stream.

Field Detail
BUF_SET
final static byte BUF_SET(Code)



DEST_SET
final static byte DEST_SET(Code)



IPADDR_DEST
final static byte IPADDR_DEST(Code)



IPADDR_SRC
final static byte IPADDR_SRC(Code)



SRC_HOST_NULL
final static byte SRC_HOST_NULL(Code)



SRC_SET
final static byte SRC_SET(Code)



dest_addr
protected Address dest_addr(Code)



headers
protected Map headers(Code)
Map



length
protected transient int length(Code)
The number of bytes in the buffer (usually buf.length is buf not equal to null).



log
final protected static Log log(Code)



nonStreamableHeaders
final static HashSet nonStreamableHeaders(Code)



offset
protected transient int offset(Code)
The index into the payload (usually 0)



src_addr
protected Address src_addr(Code)




Constructor Detail
Message
public Message(Address dest)(Code)
Public constructor
Parameters:
  dest - Address of receiver. If it is null or a string, thenit is sent to the group (either to current group or to the group as givenin the string). If it is a Vector, then it contains a number of addressesto which it must be sent. Otherwise, it contains a single destination.

Addresses are generally untyped (all are of type Object. A channelinstance must know what types of addresses it expects and downcastaccordingly.




Message
public Message(Address dest, Address src, byte[] buf)(Code)
Public constructor
Parameters:
  dest - Address of receiver. If it is null or a string, thenit is sent to the group (either to current group or to the group as givenin the string). If it is a Vector, then it contains a number of addressesto which it must be sent. Otherwise, it contains a single destination.

Addresses are generally untyped (all are of type Object. A channelinstance must know what types of addresses it expects and downcastaccordingly.
Parameters:
  src - Address of sender
Parameters:
  buf - Message to be sent. Note that this buffer must not be modified (e.g. buf[0]=0 isnot allowed), since we don't copy the contents on clopy() or clone().




Message
public Message(Address dest, Address src, byte[] buf, int offset, int length)(Code)
Constructs a message. The index and length parameters allow to provide a reference to a byte buffer, rather than a copy, and refer to a subset of the buffer. This is important when we want to avoid copying. When the message is serialized, only the subset is serialized.
Parameters:
  dest - Address of receiver. If it is null or a string, thenit is sent to the group (either to current group or to the group as givenin the string). If it is a Vector, then it contains a number of addressesto which it must be sent. Otherwise, it contains a single destination.

Addresses are generally untyped (all are of type Object. A channelinstance must know what types of addresses it expects and downcastaccordingly.
Parameters:
  src - Address of sender
Parameters:
  buf - A reference to a byte buffer
Parameters:
  offset - The index into the byte buffer
Parameters:
  length - The number of bytes to be used from buf. Both index and length are checked forarray index violations and an ArrayIndexOutOfBoundsException will be thrown if invalid




Message
public Message(Address dest, Address src, Serializable obj)(Code)
Public constructor
Parameters:
  dest - Address of receiver. If it is null or a string, thenit is sent to the group (either to current group or to the group as givenin the string). If it is a Vector, then it contains a number of addressesto which it must be sent. Otherwise, it contains a single destination.

Addresses are generally untyped (all are of type Object. A channelinstance must know what types of addresses it expects and downcastaccordingly.
Parameters:
  src - Address of sender
Parameters:
  obj - The object will be serialized into the byte buffer. Objecthas to be serializable ! Note that the resulting buffer must not be modified(e.g. buf[0]=0 is not allowed), since we don't copy the contents on clopy() or clone().




Message
public Message()(Code)



Message
public Message(boolean create_headers)(Code)




Method Detail
clone
protected Object clone() throws CloneNotSupportedException(Code)



copy
public Message copy()(Code)



copy
public Message copy(boolean copy_buffer)(Code)
Create a copy of the message. If offset and length are used (to refer to another buffer), the copy will contain only the subset offset and length point to, copying the subset into the new copy.
Parameters:
  copy_buffer - Message with specified data



getBuffer
final public byte[] getBuffer()(Code)
Returns a copy of the buffer if offset and length are used, otherwise a reference. byte array with a copy of the buffer.



getDest
public Address getDest()(Code)



getHeader
public Header getHeader(String key)(Code)



getHeaders
public Map getHeaders()(Code)



getLength
public int getLength()(Code)
Returns the number of bytes in the buffer



getObject
final public Object getObject()(Code)



getOffset
public int getOffset()(Code)
Returns the offset into the buffer at which the data starts



getRawBuffer
public byte[] getRawBuffer()(Code)
Returns a reference to the payload (byte buffer). Note that this buffer should not be modified as we do not copy the buffer on copy() or clone(): the buffer of the copied message is simply a reference to the old buffer.
Even if offset and length are used: we return the entire buffer, not a subset.



getSrc
public Address getSrc()(Code)



makeReply
public Message makeReply()(Code)



printObjectHeaders
public String printObjectHeaders()(Code)



putHeader
public void putHeader(String key, Header hdr)(Code)
Puts a header given a key into the hashmap. Overwrites potential existing entry.



readExternal
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException(Code)



readFrom
public void readFrom(DataInputStream in) throws IOException, IllegalAccessException, InstantiationException(Code)



removeHeader
public Header removeHeader(String key)(Code)



removeHeaders
public void removeHeaders()(Code)



reset
public void reset()(Code)
Nulls all fields of this message so that the message can be reused. Removes all headers from the hashmap, but keeps the hashmap



setBuffer
final public void setBuffer(byte[] b)(Code)



setBuffer
final public void setBuffer(byte[] b, int offset, int length)(Code)
Set the internal buffer to point to a subset of a given buffer
Parameters:
  b - The reference to a given buffer. If null, we'll reset the buffer to null
Parameters:
  offset - The initial position
Parameters:
  length - The number of bytes



setDest
public void setDest(Address new_dest)(Code)



setObject
final public void setObject(Serializable obj)(Code)



setSrc
public void setSrc(Address new_src)(Code)



size
public long size()(Code)
Returns the exact size of the marshalled message. Uses method size() of each header to compute the size, so if a Header subclass doesn't implement size() we will use an approximation. However, most relevant header subclasses have size() implemented correctly. (See org.jgroups.tests.SizeTest). The number of bytes for the marshalled message



toString
public String toString()(Code)



toStringAsObject
public String toStringAsObject()(Code)
Tries to read an object from the message's buffer and prints it



writeExternal
public void writeExternal(ObjectOutput out) throws IOException(Code)



writeTo
public void writeTo(DataOutputStream out) throws IOException(Code)
Streams all members (dest and src addresses, buffer and headers) to the output stream.
Parameters:
  out -
throws:
  IOException -



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.