OtpTransportFactory (Java-Erlang Interface Library)
Date: 2017-06-20

Package | Class | Tree | Serialized | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.ericsson.otp.erlang
Interface OtpTransportFactory

All Known Implementing Classes:
  AbstractNode, 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
`OtpServerTransport` | `createServerTransport(int port)` Create instance of `OtpServerTransport`
`OtpTransport` | `createTransport(java.net.InetAddress addr, int port)` Create instance of `OtpTransport`
`OtpTransport` | `createTransport(java.lang.String addr, int port)` Create instance of `OtpTransport`

Method Detail

### createTransport

    OtpTransport createTransport(java.lang.String addr,
                                 int port)
                                 throws java.io.IOException

  Create instance of `OtpTransport`

  Parameters:
    `addr` - host name or IP address string
    `port` - port number
  Returns:
    new socket object
  Throws:
    `java.io.IOException`

### createTransport

    OtpTransport createTransport(java.net.InetAddress addr,
                                 int port)
                                 throws java.io.IOException

  Create instance of `OtpTransport`

  Parameters:
    `addr` - peer address
    `port` - port number
  Returns:
    new socket object
  Throws:
    `java.io.IOException`

### createServerTransport

    OtpServerTransport createServerTransport(int port)
                                             throws java.io.IOException

  Create instance of `OtpServerTransport`

  Parameters:
    `port` - port number to listen on
  Returns:
    new socket object
  Throws:
    `java.io.IOException`

Package | Class | Tree | Serialized | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD