Java Doc for UDP.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) 


org.jgroups.protocols.TP
   org.jgroups.protocols.UDP

UDP
public class UDP extends TP implements Runnable(Code)
IP multicast transport based on UDP. Messages to the group (msg.dest == null) will be multicast (to all group members), whereas point-to-point messages (msg.dest != null) will be unicast to a single member. Uses a multicast and a unicast socket.

The following properties are read by the UDP protocol:

  • param mcast_addr - the multicast address to use; default is 228.8.8.8.
  • param mcast_port - (int) the port that the multicast is sent on; default is 7600
  • param ip_mcast - (boolean) flag whether to use IP multicast; default is true.
  • param ip_ttl - the default time-to-live for multicast packets sent out on this socket; default is 32.
  • param use_packet_handler - boolean, defaults to false. If set, the mcast and ucast receiver threads just put the datagram's payload (a byte buffer) into a queue, from where a separate thread will dequeue and handle them (unmarshal and pass up). This frees the receiver threads from having to do message unmarshalling; this time can now be spent receiving packets. If you have lots of retransmissions because of network input buffer overflow, consider setting this property to true.

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

Inner Class :public class UcastReceiver implements Runnable

Field Summary
 booleanip_mcast
     Whether to enable IP multicasting.
 intip_ttl
    
 IpAddressmcast_addr
    
 Stringmcast_addr_name
    
 intmcast_port
    
 Threadmcast_receiver
    
 intmcast_recv_buf_size
    
 MulticastSocketmcast_recv_sock
    
 intmcast_send_buf_size
    
 MulticastSocketmcast_send_sock
    
 MulticastSocket[]mcast_send_sockets
     If we have multiple mcast send sockets, e.g.
 intnum_last_ports
     Maintain a list of local ports opened by DatagramSocket.
 DatagramSocketsock
    
 inttos
     Traffic class for sending unicast and multicast datagrams.
 UcastReceiverucast_receiver
    
 intucast_recv_buf_size
    
 intucast_send_buf_size
    

Constructor Summary
public  UDP()
     Creates the UDP protocol, and initializes the state variables, does however not start any sockets or threads.

Method Summary
 voidcloseMulticastSocket()
    
 voidcloseSockets()
    
protected  DatagramSocketcreateDatagramSocketWithBindPort()
     Creates a DatagramSocket when bind_port > 0.
protected  DatagramSocketcreateEphemeralDatagramSocket()
     Creates a DatagramSocket with a random port.
public  StringgetInfo()
    
public  StringgetName()
    
protected  voidhandleConfigEvent(HashMap map)
    
public  voidpostUnmarshalling(Message msg, Address dest, Address src, boolean multicast)
    
public  voidpostUnmarshallingList(Message msg, Address dest, boolean multicast)
    
public  voidrun()
    
public  voidsendToAllMembers(byte[] data, int offset, int length)
    
public  voidsendToSingleMember(Address dest, byte[] data, int offset, int length)
    
 voidsetBufferSizes()
    
public  booleansetProperties(Properties props)
     Setup the Protocol instance acording to the configuration string. The following properties are read by the UDP protocol:
  • param mcast_addr - the multicast address to use default is 228.8.8.8
  • param mcast_port - (int) the port that the multicast is sent on default is 7600
  • param ip_mcast - (boolean) flag whether to use IP multicast - default is true
  • param ip_ttl - Set the default time-to-live for multicast packets sent out on this socket.
protected  voidsetThreadNames()
    
public  voidstart()
    
 voidstartThreads()
    
public  voidstop()
    
 voidstopThreads()
    
protected  voidunsetThreadNames()
    

Field Detail
ip_mcast
boolean ip_mcast(Code)
Whether to enable IP multicasting. If false, multiple unicast datagram packets are sent rather than one multicast packet



ip_ttl
int ip_ttl(Code)
The time-to-live (TTL) for multicast datagram packets



mcast_addr
IpAddress mcast_addr(Code)
The multicast address (mcast address and port) this member uses



mcast_addr_name
String mcast_addr_name(Code)
The multicast address used for sending and receiving packets



mcast_port
int mcast_port(Code)
The multicast port used for sending and receiving packets



mcast_receiver
Thread mcast_receiver(Code)
The multicast receiver thread



mcast_recv_buf_size
int mcast_recv_buf_size(Code)
Receive buffer size of the multicast datagram socket



mcast_recv_sock
MulticastSocket mcast_recv_sock(Code)
IP multicast socket for receiving multicast packets



mcast_send_buf_size
int mcast_send_buf_size(Code)
Send buffer size of the multicast datagram socket



mcast_send_sock
MulticastSocket mcast_send_sock(Code)
IP multicast socket for sending multicast packets



mcast_send_sockets
MulticastSocket[] mcast_send_sockets(Code)
If we have multiple mcast send sockets, e.g. send_interfaces or send_on_all_interfaces enabled



num_last_ports
int num_last_ports(Code)
Maintain a list of local ports opened by DatagramSocket. If this is 0, this option is turned off. If bind_port is > 0, then this option will be ignored



sock
DatagramSocket sock(Code)
Socket used for
  1. sending unicast packets and
  2. receiving unicast packets
The address of this socket will be our local address (local_addr)



tos
int tos(Code)
Traffic class for sending unicast and multicast datagrams. Valid values are (check DatagramSocket.setTrafficClass(int) ); for details):
  • IPTOS_LOWCOST (0x02), decimal 2
  • IPTOS_RELIABILITY (0x04)<, decimal 4/LI>
  • IPTOS_THROUGHPUT (0x08), decimal 8
  • IPTOS_LOWDELAY (0x10), decimal 16



ucast_receiver
UcastReceiver ucast_receiver(Code)
The unicast receiver thread



ucast_recv_buf_size
int ucast_recv_buf_size(Code)
Receive buffer size of the unicast datagram socket



ucast_send_buf_size
int ucast_send_buf_size(Code)
Send buffer size of the unicast datagram socket




Constructor Detail
UDP
public UDP()(Code)
Creates the UDP protocol, and initializes the state variables, does however not start any sockets or threads.




Method Detail
closeMulticastSocket
void closeMulticastSocket()(Code)



closeSockets
void closeSockets()(Code)
Closed UDP unicast and multicast sockets



createDatagramSocketWithBindPort
protected DatagramSocket createDatagramSocketWithBindPort() throws Exception(Code)
Creates a DatagramSocket when bind_port > 0. Attempts to allocate the socket with port == bind_port, and increments until it finds a valid port, or until port_range has been exceeded DatagramSocket The newly created socket
throws:
  Exception -



createEphemeralDatagramSocket
protected DatagramSocket createEphemeralDatagramSocket() throws SocketException(Code)
Creates a DatagramSocket with a random port. Because in certain operating systems, ports are reused, we keep a list of the n last used ports, and avoid port reuse



getInfo
public String getInfo()(Code)



getName
public String getName()(Code)



handleConfigEvent
protected void handleConfigEvent(HashMap map)(Code)



postUnmarshalling
public void postUnmarshalling(Message msg, Address dest, Address src, boolean multicast)(Code)



postUnmarshallingList
public void postUnmarshallingList(Message msg, Address dest, boolean multicast)(Code)



run
public void run()(Code)



sendToAllMembers
public void sendToAllMembers(byte[] data, int offset, int length) throws Exception(Code)



sendToSingleMember
public void sendToSingleMember(Address dest, byte[] data, int offset, int length) throws Exception(Code)



setBufferSizes
void setBufferSizes()(Code)



setProperties
public boolean setProperties(Properties props)(Code)
Setup the Protocol instance acording to the configuration string. The following properties are read by the UDP protocol:
  • param mcast_addr - the multicast address to use default is 228.8.8.8
  • param mcast_port - (int) the port that the multicast is sent on default is 7600
  • param ip_mcast - (boolean) flag whether to use IP multicast - default is true
  • param ip_ttl - Set the default time-to-live for multicast packets sent out on this socket. default is 32
true if no other properties are left.false if the properties still have data in them, ie ,properties are left over and not handled by the protocol stack



setThreadNames
protected void setThreadNames()(Code)



start
public void start() throws Exception(Code)
Creates the unicast and multicast sockets and starts the unicast and multicast receiver threads



startThreads
void startThreads() throws Exception(Code)
Starts the unicast and multicast receiver threads



stop
public void stop()(Code)



stopThreads
void stopThreads()(Code)
Stops unicast and multicast receiver threads



unsetThreadNames
protected void unsetThreadNames()(Code)



Fields inherited from org.jgroups.protocols.TP
final static byte LIST(Code)(Java Doc)
final static byte MULTICAST(Code)(Java Doc)
byte[] additional_data(Code)(Java Doc)
HashMap addr_translation_table(Code)(Java Doc)
protected InetAddress bind_addr(Code)(Java Doc)
int bind_port(Code)(Java Doc)
boolean bind_to_all_interfaces(Code)(Java Doc)
final ExposedBufferedInputStream buf_in_stream(Code)(Java Doc)
final ExposedBufferedOutputStream buf_out_stream(Code)(Java Doc)
protected String channel_name(Code)(Java Doc)
String diagnostics_addr(Code)(Java Doc)
int diagnostics_port(Code)(Java Doc)
final DataInputStream dis(Code)(Java Doc)
boolean discard_incompatible_packets(Code)(Java Doc)
final ExposedDataOutputStream dos(Code)(Java Doc)
boolean enable_bundling(Code)(Java Doc)
boolean enable_diagnostics(Code)(Java Doc)
static NumberFormat f(Code)(Java Doc)
TpHeader header(Code)(Java Doc)
final ExposedByteArrayInputStream in_stream(Code)(Java Doc)
IncomingMessageHandler incoming_msg_handler(Code)(Java Doc)
Queue incoming_msg_queue(Code)(Java Doc)
IncomingPacketHandler incoming_packet_handler(Code)(Java Doc)
Queue incoming_packet_queue(Code)(Java Doc)
protected Address local_addr(Code)(Java Doc)
boolean loopback(Code)(Java Doc)
int max_bundle_size(Code)(Java Doc)
long max_bundle_timeout(Code)(Java Doc)
final protected Vector members(Code)(Java Doc)
final String name(Code)(Java Doc)
long num_msgs_sentnum_msgs_receivednum_bytes_sentnum_bytes_received(Code)(Java Doc)
final ExposedByteArrayOutputStream out_stream(Code)(Java Doc)
OutgoingPacketHandler outgoing_packet_handler(Code)(Java Doc)
BoundedLinkedQueue outgoing_queue(Code)(Java Doc)
int outgoing_queue_max_size(Code)(Java Doc)
int port_range(Code)(Java Doc)
java.util.List receive_interfaces(Code)(Java Doc)
boolean receive_on_all_interfaces(Code)(Java Doc)
java.util.List send_interfaces(Code)(Java Doc)
boolean send_on_all_interfaces(Code)(Java Doc)
protected TimeScheduler timer(Code)(Java Doc)
boolean use_addr_translation(Code)(Java Doc)
boolean use_incoming_packet_handler(Code)(Java Doc)
boolean use_local_host(Code)(Java Doc)
boolean use_outgoing_packet_handler(Code)(Java Doc)
protected View view(Code)(Java Doc)

Methods inherited from org.jgroups.protocols.TP
public void down(Event evt)(Code)(Java Doc)
public Map dumpStats()(Code)(Java Doc)
public String getBindAddress()(Code)(Java Doc)
public boolean getBindToAllInterfaces()(Code)(Java Doc)
public String getChannelName()(Code)(Java Doc)
public int getIncomingQueueSize()(Code)(Java Doc)
abstract public String getInfo()(Code)(Java Doc)
public Address getLocalAddress()(Code)(Java Doc)
public int getMaxBundleSize()(Code)(Java Doc)
public long getMaxBundleTimeout()(Code)(Java Doc)
public long getNumBytesReceived()(Code)(Java Doc)
public long getNumBytesSent()(Code)(Java Doc)
public long getNumMessagesReceived()(Code)(Java Doc)
public long getNumMessagesSent()(Code)(Java Doc)
public int getOutgoingQueueMaxSize()(Code)(Java Doc)
public int getOutgoingQueueSize()(Code)(Java Doc)
public java.util.List getReceiveInterfaces()(Code)(Java Doc)
public java.util.List getSendInterfaces()(Code)(Java Doc)
protected void handleConfigEvent(HashMap map)(Code)(Java Doc)
protected void handleDownEvent(Event evt)(Code)(Java Doc)
public void init() throws Exception(Code)(Java Doc)
public boolean isDiscardIncompatiblePackets()(Code)(Java Doc)
public boolean isEnableBundling()(Code)(Java Doc)
public boolean isLoopback()(Code)(Java Doc)
public boolean isReceiveOnAllInterfaces()(Code)(Java Doc)
public boolean isSendOnAllInterfaces()(Code)(Java Doc)
public boolean isUseIncomingPacketHandler()(Code)(Java Doc)
public boolean isUseOutgoingPacketHandler()(Code)(Java Doc)
abstract public void postUnmarshalling(Message msg, Address dest, Address src, boolean multicast)(Code)(Java Doc)
abstract public void postUnmarshallingList(Message msg, Address dest, boolean multicast)(Code)(Java Doc)
final protected void receive(Address dest, Address sender, byte[] data, int offset, int length)(Code)(Java Doc)
public void resetStats()(Code)(Java Doc)
abstract public void sendToAllMembers(byte[] data, int offset, int length) throws Exception(Code)(Java Doc)
abstract public void sendToSingleMember(Address dest, byte[] data, int offset, int length) throws Exception(Code)(Java Doc)
public void setBindAddress(String bind_addr) throws UnknownHostException(Code)(Java Doc)
public void setBindToAllInterfaces(boolean flag)(Code)(Java Doc)
public void setDiscardIncompatiblePackets(boolean flag)(Code)(Java Doc)
public void setEnableBundling(boolean flag)(Code)(Java Doc)
public void setLoopback(boolean b)(Code)(Java Doc)
public void setMaxBundleSize(int size)(Code)(Java Doc)
public void setMaxBundleTimeout(long timeout)(Code)(Java Doc)
public void setOutgoingQueueMaxSize(int new_size)(Code)(Java Doc)
public boolean setProperties(Properties props)(Code)(Java Doc)
protected void setThreadNames()(Code)(Java Doc)
public void start() throws Exception(Code)(Java Doc)
public void startUpHandler()(Code)(Java Doc)
public void stop()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
protected void unsetThreadNames()(Code)(Java Doc)
public void up(Event evt)(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.