org.jgroups.util
Class DefaultSocketFactory

java.lang.Object
  extended by org.jgroups.util.DefaultSocketFactory
All Implemented Interfaces:
SocketFactory

public class DefaultSocketFactory
extends java.lang.Object
implements SocketFactory

Default implementation, ignores service names

Author:
Bela Ban

Constructor Summary
DefaultSocketFactory()
           
 
Method Summary
 void close(java.net.DatagramSocket sock)
           
 void close(java.net.ServerSocket sock)
           
 void close(java.net.Socket sock)
           
 java.net.DatagramSocket createDatagramSocket(java.lang.String service_name)
           
 java.net.DatagramSocket createDatagramSocket(java.lang.String service_name, int port)
           
 java.net.DatagramSocket createDatagramSocket(java.lang.String service_name, int port, java.net.InetAddress laddr)
           
 java.net.DatagramSocket createDatagramSocket(java.lang.String service_name, java.net.SocketAddress bindaddr)
           
 java.net.MulticastSocket createMulticastSocket(java.lang.String service_name)
           
 java.net.MulticastSocket createMulticastSocket(java.lang.String service_name, int port)
           
 java.net.MulticastSocket createMulticastSocket(java.lang.String service_name, java.net.SocketAddress bindaddr)
           
 java.net.ServerSocket createServerSocket(java.lang.String service_name)
           
 java.net.ServerSocket createServerSocket(java.lang.String service_name, int port)
           
 java.net.ServerSocket createServerSocket(java.lang.String service_name, int port, int backlog)
           
 java.net.ServerSocket createServerSocket(java.lang.String service_name, int port, int backlog, java.net.InetAddress bindAddr)
           
 java.net.Socket createSocket(java.lang.String service_name)
           
 java.net.Socket createSocket(java.lang.String service_name, java.net.InetAddress address, int port)
           
 java.net.Socket createSocket(java.lang.String service_name, java.net.InetAddress address, int port, java.net.InetAddress localAddr, int localPort)
           
 java.net.Socket createSocket(java.lang.String service_name, java.lang.String host, int port)
           
 java.net.Socket createSocket(java.lang.String service_name, java.lang.String host, int port, java.net.InetAddress localAddr, int localPort)
           
 java.util.Map<java.lang.Object,java.lang.String> getSockets()
          Returns all open sockets.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultSocketFactory

public DefaultSocketFactory()
Method Detail

createSocket

public java.net.Socket createSocket(java.lang.String service_name)
                             throws java.io.IOException
Specified by:
createSocket in interface SocketFactory
Throws:
java.io.IOException

createSocket

public java.net.Socket createSocket(java.lang.String service_name,
                                    java.lang.String host,
                                    int port)
                             throws java.io.IOException
Specified by:
createSocket in interface SocketFactory
Throws:
java.io.IOException

createSocket

public java.net.Socket createSocket(java.lang.String service_name,
                                    java.net.InetAddress address,
                                    int port)
                             throws java.io.IOException
Specified by:
createSocket in interface SocketFactory
Throws:
java.io.IOException

createSocket

public java.net.Socket createSocket(java.lang.String service_name,
                                    java.lang.String host,
                                    int port,
                                    java.net.InetAddress localAddr,
                                    int localPort)
                             throws java.io.IOException
Specified by:
createSocket in interface SocketFactory
Throws:
java.io.IOException

createSocket

public java.net.Socket createSocket(java.lang.String service_name,
                                    java.net.InetAddress address,
                                    int port,
                                    java.net.InetAddress localAddr,
                                    int localPort)
                             throws java.io.IOException
Specified by:
createSocket in interface SocketFactory
Throws:
java.io.IOException

createServerSocket

public java.net.ServerSocket createServerSocket(java.lang.String service_name)
                                         throws java.io.IOException
Specified by:
createServerSocket in interface SocketFactory
Throws:
java.io.IOException

createServerSocket

public java.net.ServerSocket createServerSocket(java.lang.String service_name,
                                                int port)
                                         throws java.io.IOException
Specified by:
createServerSocket in interface SocketFactory
Throws:
java.io.IOException

createServerSocket

public java.net.ServerSocket createServerSocket(java.lang.String service_name,
                                                int port,
                                                int backlog)
                                         throws java.io.IOException
Specified by:
createServerSocket in interface SocketFactory
Throws:
java.io.IOException

createServerSocket

public java.net.ServerSocket createServerSocket(java.lang.String service_name,
                                                int port,
                                                int backlog,
                                                java.net.InetAddress bindAddr)
                                         throws java.io.IOException
Specified by:
createServerSocket in interface SocketFactory
Throws:
java.io.IOException

createDatagramSocket

public java.net.DatagramSocket createDatagramSocket(java.lang.String service_name)
                                             throws java.net.SocketException
Specified by:
createDatagramSocket in interface SocketFactory
Throws:
java.net.SocketException

createDatagramSocket

public java.net.DatagramSocket createDatagramSocket(java.lang.String service_name,
                                                    java.net.SocketAddress bindaddr)
                                             throws java.net.SocketException
Specified by:
createDatagramSocket in interface SocketFactory
Throws:
java.net.SocketException

createDatagramSocket

public java.net.DatagramSocket createDatagramSocket(java.lang.String service_name,
                                                    int port)
                                             throws java.net.SocketException
Specified by:
createDatagramSocket in interface SocketFactory
Throws:
java.net.SocketException

createDatagramSocket

public java.net.DatagramSocket createDatagramSocket(java.lang.String service_name,
                                                    int port,
                                                    java.net.InetAddress laddr)
                                             throws java.net.SocketException
Specified by:
createDatagramSocket in interface SocketFactory
Throws:
java.net.SocketException

createMulticastSocket

public java.net.MulticastSocket createMulticastSocket(java.lang.String service_name)
                                               throws java.io.IOException
Specified by:
createMulticastSocket in interface SocketFactory
Throws:
java.io.IOException

createMulticastSocket

public java.net.MulticastSocket createMulticastSocket(java.lang.String service_name,
                                                      int port)
                                               throws java.io.IOException
Specified by:
createMulticastSocket in interface SocketFactory
Throws:
java.io.IOException

createMulticastSocket

public java.net.MulticastSocket createMulticastSocket(java.lang.String service_name,
                                                      java.net.SocketAddress bindaddr)
                                               throws java.io.IOException
Specified by:
createMulticastSocket in interface SocketFactory
Throws:
java.io.IOException

close

public void close(java.net.Socket sock)
           throws java.io.IOException
Specified by:
close in interface SocketFactory
Throws:
java.io.IOException

close

public void close(java.net.ServerSocket sock)
           throws java.io.IOException
Specified by:
close in interface SocketFactory
Throws:
java.io.IOException

close

public void close(java.net.DatagramSocket sock)
Specified by:
close in interface SocketFactory

getSockets

public java.util.Map<java.lang.Object,java.lang.String> getSockets()
Description copied from interface: SocketFactory
Returns all open sockets. This method can be used to list or close all open sockets.

Specified by:
getSockets in interface SocketFactory
Returns:
A map of open sockets; keys are Sockets, ServerSockets, DatagramSockets or MulticastSockets, values are the service names.


Copyright © 1998-2012 Bela Ban / Red Hat. All Rights Reserved.