Package com.ericsson.otp.erlang
Interface OtpTransportFactory
- All Known Implementing Classes:
AbstractNode
,OtpGenericTransportFactory
,OtpLocalNode
,OtpNode
,OtpPeer
,OtpSelf
,OtpServer
,OtpSocketTransportFactory
public interface OtpTransportFactory
Factory class used to create client- and server-side transport instances. One
static instance of class implementing this interface is created when program
loaded. Default implementation used is
OtpSocketTransportFactory
.
JInterface user can specify custom transport factory implementing this
interface in the following ways:
- defining static class as internal to class holding main() method
- In the systems, where main class can be retrieved with
System.getProperty("sun.java.command")
, user can define static class OtpErlangSystemTuner internal to the main class, providing at least one static method with the name getOtpTransportFactory, with no parameters, returning object of class implementing OtpTransportFactory, for example:public class MyMainClass { public static class OtpErlangSystemTuner { ... public static OtpTransportFactory getOtpTransportFactory() { return new MyTransportFactory(); } } public static class MyTransportFactory implements OtpTransportFactory { ... } public static void main(String[] args) { ... } }
- specifying factory class in the system properties
- User-defined transport factory class may be specified via system property
OtpTransportFactory, for example:
package com.my.company; public static class MyTransportFactory implements OtpTransportFactory { ... }
In such case program may be run with -DOtpTransportFactory=com.my.company.MyTransportFactory, or other way of setting system property before execution of static initializers may be used.
-
Method Summary
Modifier and TypeMethodDescriptioncreateServerTransport
(int port) Create instance ofOtpServerTransport
createTransport
(String addr, int port) Create instance ofOtpTransport
createTransport
(InetAddress addr, int port) Create instance ofOtpTransport
-
Method Details
-
createTransport
Create instance ofOtpTransport
- Parameters:
addr
- host name or IP address stringport
- port number- Returns:
- new socket object
- Throws:
IOException
-
createTransport
Create instance ofOtpTransport
- Parameters:
addr
- peer addressport
- port number- Returns:
- new socket object
- Throws:
IOException
-
createServerTransport
Create instance ofOtpServerTransport
- Parameters:
port
- port number to listen on- Returns:
- new socket object
- Throws:
IOException
-