Package org.jgroups.util
Class DefaultSocketFactory
- java.lang.Object
-
- 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
Constructors Constructor Description DefaultSocketFactory()
DefaultSocketFactory(javax.net.SocketFactory socketFactory, javax.net.ServerSocketFactory serverSocketFactory)
DefaultSocketFactory(javax.net.ssl.SSLContext sslContext)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close(java.net.DatagramSocket datagramSocket)
void
close(java.net.ServerSocket serverSocket)
void
close(java.net.Socket socket)
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 s)
java.net.ServerSocket
createServerSocket(java.lang.String s, int port)
java.net.ServerSocket
createServerSocket(java.lang.String s, int port, int backlog)
java.net.ServerSocket
createServerSocket(java.lang.String s, int port, int backlog, java.net.InetAddress bindAddress)
java.net.Socket
createSocket(java.lang.String s)
java.net.Socket
createSocket(java.lang.String s, java.lang.String host, int port)
java.net.Socket
createSocket(java.lang.String s, java.lang.String host, int port, java.net.InetAddress localHost, int localPort)
java.net.Socket
createSocket(java.lang.String s, java.net.InetAddress host, int port)
java.net.Socket
createSocket(java.lang.String s, java.net.InetAddress host, int port, java.net.InetAddress localHost, int localPort)
java.util.Map<java.lang.Object,java.lang.String>
getSockets()
Returns all open sockets.void
setServerSocketConfigurator(java.util.function.Consumer<java.net.ServerSocket> serverSocketConfigurator)
void
setSocketConfigurator(java.util.function.Consumer<java.net.Socket> socketConfigurator)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jgroups.util.SocketFactory
close, close, createServerSocketChannel, createServerSocketChannel, createServerSocketChannel, createServerSocketChannel, createSocketChannel, createSocketChannel
-
-
-
-
Method Detail
-
setSocketConfigurator
public void setSocketConfigurator(java.util.function.Consumer<java.net.Socket> socketConfigurator)
-
setServerSocketConfigurator
public void setServerSocketConfigurator(java.util.function.Consumer<java.net.ServerSocket> serverSocketConfigurator)
-
createSocket
public java.net.Socket createSocket(java.lang.String s) throws java.io.IOException
- Specified by:
createSocket
in interfaceSocketFactory
- Throws:
java.io.IOException
-
createSocket
public java.net.Socket createSocket(java.lang.String s, java.lang.String host, int port) throws java.io.IOException
- Specified by:
createSocket
in interfaceSocketFactory
- Throws:
java.io.IOException
-
createSocket
public java.net.Socket createSocket(java.lang.String s, java.net.InetAddress host, int port) throws java.io.IOException
- Specified by:
createSocket
in interfaceSocketFactory
- Throws:
java.io.IOException
-
createSocket
public java.net.Socket createSocket(java.lang.String s, java.lang.String host, int port, java.net.InetAddress localHost, int localPort) throws java.io.IOException
- Specified by:
createSocket
in interfaceSocketFactory
- Throws:
java.io.IOException
-
createSocket
public java.net.Socket createSocket(java.lang.String s, java.net.InetAddress host, int port, java.net.InetAddress localHost, int localPort) throws java.io.IOException
- Specified by:
createSocket
in interfaceSocketFactory
- Throws:
java.io.IOException
-
createServerSocket
public java.net.ServerSocket createServerSocket(java.lang.String s) throws java.io.IOException
- Specified by:
createServerSocket
in interfaceSocketFactory
- Throws:
java.io.IOException
-
createServerSocket
public java.net.ServerSocket createServerSocket(java.lang.String s, int port) throws java.io.IOException
- Specified by:
createServerSocket
in interfaceSocketFactory
- Throws:
java.io.IOException
-
createServerSocket
public java.net.ServerSocket createServerSocket(java.lang.String s, int port, int backlog) throws java.io.IOException
- Specified by:
createServerSocket
in interfaceSocketFactory
- Throws:
java.io.IOException
-
createServerSocket
public java.net.ServerSocket createServerSocket(java.lang.String s, int port, int backlog, java.net.InetAddress bindAddress) throws java.io.IOException
- Specified by:
createServerSocket
in interfaceSocketFactory
- Throws:
java.io.IOException
-
createDatagramSocket
public java.net.DatagramSocket createDatagramSocket(java.lang.String service_name) throws java.net.SocketException
- Specified by:
createDatagramSocket
in interfaceSocketFactory
- 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 interfaceSocketFactory
- 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 interfaceSocketFactory
- 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 interfaceSocketFactory
- Throws:
java.net.SocketException
-
createMulticastSocket
public java.net.MulticastSocket createMulticastSocket(java.lang.String service_name) throws java.io.IOException
- Specified by:
createMulticastSocket
in interfaceSocketFactory
- 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 interfaceSocketFactory
- 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 interfaceSocketFactory
- Throws:
java.io.IOException
-
close
public void close(java.net.Socket socket) throws java.io.IOException
- Specified by:
close
in interfaceSocketFactory
- Throws:
java.io.IOException
-
close
public void close(java.net.ServerSocket serverSocket) throws java.io.IOException
- Specified by:
close
in interfaceSocketFactory
- Throws:
java.io.IOException
-
close
public void close(java.net.DatagramSocket datagramSocket)
- Specified by:
close
in interfaceSocketFactory
-
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 interfaceSocketFactory
- Returns:
- A map of open sockets; keys are Sockets, ServerSockets, DatagramSockets or MulticastSockets, values are the service names.
-
-