Java Reference
In-Depth Information
The following excerpt is taken from the terminal. It is the execution of a Java ap-
plication named
SDPExample
, specifying the SDP system property:
% java -Dcom.sun.sdp.conf=sdp.conf
-Djava.net.preferIPv4Stack=true SDPExample
How It Works
Sometimes it is essential that an application be as fast as possible while performing
network communications. Transfers over TCP can sometimes decrease performance, so
bypassing TCP can be beneficial. Since the release of Java SE 7, support for the SDP
has been included for certain platforms. The SDP supports stream connections over In-
finiBand fabric. Both Solaris and Linux include support for InfiniBand, so SDP can be
useful on those platforms.
You don't need to make any programmatic changes to your applications in order to
support SDP. The only differences when using SDP are that you must create an SDP
configuration file, and the JVM must be told to use the protocol by passing a flag when
running the application. Because the implementation is transparent, applications can be
written for any platform, and those that support SDP can merely include the configura-
tion file and bypass TCP.
The SDP configuration file is a text file that is composed of
bind
and
connect
rules. A
bind
rule indicates that the SDP protocol transport should be used when a
TCP socket binds to an address and port that match the given rule. A
connect
rule
indicates that the SDP protocol transport should be used when an unbound TCP socket
attempts to connect to an address and port that match the given rule. The rule begins
with either the
bind
or
connect
keyword indicating the rule type, followed by the
hostname or IP address, and a single port number or range of port numbers. Per the on-
line documentation, a rule has the following form:
("bind"|"connect")1*LWSP-char(hostname|ipaddress)["/
"prefix])1*LWSP-char("*"|port)
["-"("*"|port)]
In the rule format shown here,
1*LWSP-char
means that any number of tabs or
spaces can separate the tokens. Anything contained within square brackets indicates
optional text, and quotes indicate literal text. In the solution to the recipe, the first rule
indicates that SDP can be used for any port (
*
indicates a wildcard) on the IP address