Skip navigation links

Oracle® Coherence Java API Reference
Release 3.7.0.0

E18683-01


com.tangosol.net
Class SocketOptions

java.lang.Object
  extended by com.tangosol.net.SocketOptions

All Implemented Interfaces:
XmlConfigurable, java.net.SocketOptions

public class SocketOptions
extends java.lang.Object
implements java.net.SocketOptions, XmlConfigurable

SocketOptions provides a means to configure the various aspects of Sockets. Unlike java.net.SocketOptions, unset options will result in a value of null when queried via getOption.

Since:
Coherence 3.6
Author:
mf 2010.05.20

Field Summary
protected  java.util.Map m_mapOptions
          A map of the specified options.
protected  XmlElement m_xml
          The configuration.
protected static boolean s_fWarnReuseAddr
          Tracks if a configuration warning has been issued for SO_REUSEADDR

 

Fields inherited from interface java.net.SocketOptions
IP_MULTICAST_IF, IP_MULTICAST_IF2, IP_MULTICAST_LOOP, IP_TOS, SO_BINDADDR, SO_BROADCAST, SO_KEEPALIVE, SO_LINGER, SO_OOBINLINE, SO_RCVBUF, SO_REUSEADDR, SO_SNDBUF, SO_TIMEOUT, TCP_NODELAY

 

Constructor Summary
SocketOptions()
           

 

Method Summary
 void apply(java.net.DatagramSocket socket)
          Configure the specified socket.
 void apply(java.net.MulticastSocket socket)
          Configure the specified socket.
 void apply(java.net.ServerSocket socket)
          Configure the specified socket.
 void apply(java.net.Socket socket)
          Configure the specified socket.
static void apply(java.net.SocketOptions options, java.net.DatagramSocket socket)
          Apply the specified options to a socket.
 void apply(java.net.SocketOptions options, java.net.MulticastSocket socket)
          Apply the specified options to a socket.
static void apply(java.net.SocketOptions options, java.net.ServerSocket socket)
          Apply the specified options to a socket.
static void apply(java.net.SocketOptions options, java.net.Socket socket)
          Apply the specified options to a socket.
 void copyOptions(java.net.SocketOptions options)
          Copy the options in the specified SocketOptions into this SocketOptions.
 XmlElement getConfig()
          Determine the current configuration of the object.
 java.lang.Object getOption(int optID)
          
 boolean isConfigured()
          Return true iff the XmlSocketOptions have been configured with any options.
static SocketOptions load(XmlElement xml)
          Parse the supplied XML and return the corresponding SocketOptions.
 void setConfig(XmlElement xml)
          Specify the configuration for the object.
 void setOption(int optID, java.lang.Object value)
          
 java.lang.String toString()
          
protected static void warnBufferSize(java.lang.Object socket, java.lang.String sBuffer, int cb, int cbReal)
          Issue a warning regarding an undersized socket buffer.
protected static void warnReuseAddr(boolean fReuse)
          Issue a warning regarding overrideing SO_REUSEADDR

 

Field Detail

m_xml

protected XmlElement m_xml
The configuration.

m_mapOptions

protected java.util.Map m_mapOptions
A map of the specified options.

s_fWarnReuseAddr

protected static boolean s_fWarnReuseAddr
Tracks if a configuration warning has been issued for SO_REUSEADDR

Constructor Detail

SocketOptions

public SocketOptions()

Method Detail

isConfigured

public boolean isConfigured()
Return true iff the XmlSocketOptions have been configured with any options.
Returns:
true iff the XmlSocketOptions have been configured with any options.

apply

public void apply(java.net.ServerSocket socket)
           throws java.net.SocketException
Configure the specified socket.
Parameters:
socket - the socket to configure
Throws:
java.net.SocketException - if an I/O error occurs

apply

public void apply(java.net.Socket socket)
           throws java.net.SocketException
Configure the specified socket.
Parameters:
socket - the socket to configure
Throws:
java.net.SocketException - if an I/O error occurs

apply

public void apply(java.net.DatagramSocket socket)
           throws java.net.SocketException
Configure the specified socket.
Parameters:
socket - the socket to configure
Throws:
java.net.SocketException - if an I/O error occurs

apply

public void apply(java.net.MulticastSocket socket)
           throws java.net.SocketException
Configure the specified socket.
Parameters:
socket - the socket to configure
Throws:
java.net.SocketException - if an I/O error occurs

getConfig

public XmlElement getConfig()
Determine the current configuration of the object.
Specified by:
getConfig in interface XmlConfigurable
Returns:
the XML configuration or null

setConfig

public void setConfig(XmlElement xml)
Specify the configuration for the object.
Specified by:
setConfig in interface XmlConfigurable
Parameters:
xml - the XML configuration for the object

setOption

public void setOption(int optID,
                      java.lang.Object value)
               throws java.net.SocketException
Specified by:
setOption in interface java.net.SocketOptions
Throws:
java.net.SocketException

getOption

public java.lang.Object getOption(int optID)
                           throws java.net.SocketException
Specified by:
getOption in interface java.net.SocketOptions
Throws:
java.net.SocketException

copyOptions

public void copyOptions(java.net.SocketOptions options)
                 throws java.net.SocketException
Copy the options in the specified SocketOptions into this SocketOptions.
Parameters:
options - the options to copy
Throws:
java.net.SocketException - if an error occurs

toString

public java.lang.String toString()

warnBufferSize

protected static void warnBufferSize(java.lang.Object socket,
                                     java.lang.String sBuffer,
                                     int cb,
                                     int cbReal)
Issue a warning regarding an undersized socket buffer.
Parameters:
socket - the socket
sBuffer - the buffer description
cb - the requested size
cbReal - the actual size

warnReuseAddr

protected static void warnReuseAddr(boolean fReuse)
Issue a warning regarding overrideing SO_REUSEADDR
Parameters:
fReuse - the specified setting

load

public static SocketOptions load(XmlElement xml)
Parse the supplied XML and return the corresponding SocketOptions.
Parameters:
xml - the xml configuraiton
Returns:
the options, or null if none were identified

apply

public static void apply(java.net.SocketOptions options,
                         java.net.ServerSocket socket)
                  throws java.net.SocketException
Apply the specified options to a socket.
Parameters:
options - the options to apply
socket - the socket to configure
Throws:
java.net.SocketException - if an I/O error occurs

apply

public static void apply(java.net.SocketOptions options,
                         java.net.Socket socket)
                  throws java.net.SocketException
Apply the specified options to a socket.
Parameters:
options - the options to apply
socket - the socket to configure
Throws:
java.net.SocketException - if an I/O error occurs

apply

public static void apply(java.net.SocketOptions options,
                         java.net.DatagramSocket socket)
                  throws java.net.SocketException
Apply the specified options to a socket.
Parameters:
options - the options to apply
socket - the socket to configure
Throws:
java.net.SocketException - if an I/O error occurs

apply

public void apply(java.net.SocketOptions options,
                  java.net.MulticastSocket socket)
           throws java.net.SocketException
Apply the specified options to a socket.
Parameters:
options - the options to apply
socket - the socket to configure
Throws:
java.net.SocketException - if an I/O error occurs

Skip navigation links

Oracle® Coherence Java API Reference
Release 3.7.0.0

E18683-01


Copyright © 2000, 2011, Oracle and/or its affiliates. All rights reserved.