T
- remote service interface typepublic interface Launcher<T>
Modifier and Type | Interface and Description |
---|---|
static class |
Launcher.Builder<T>
The launcher builder wires up all components for JSON-RPC communication.
|
Modifier and Type | Method and Description |
---|---|
static Launcher<java.lang.Object> |
createIoLauncher(java.util.Collection<java.lang.Object> localServices,
java.util.Collection<java.lang.Class<?>> remoteInterfaces,
java.lang.ClassLoader classLoader,
java.io.InputStream in,
java.io.OutputStream out,
java.util.concurrent.ExecutorService executorService,
java.util.function.Function<MessageConsumer,MessageConsumer> wrapper,
java.util.function.Consumer<com.google.gson.GsonBuilder> configureGson)
Create a new Launcher for a collection of local service objects, a collection of remote interfaces and an
input and output stream.
|
static <T> Launcher<T> |
createIoLauncher(java.lang.Object localService,
java.lang.Class<T> remoteInterface,
java.io.InputStream in,
java.io.OutputStream out,
boolean validate,
java.util.concurrent.ExecutorService executorService,
java.util.function.Function<MessageConsumer,MessageConsumer> wrapper,
java.util.function.Consumer<com.google.gson.GsonBuilder> configureGson)
Create a new Launcher for a given local service object, a given remote interface and an input and output stream.
|
static <T> Launcher<T> |
createIoLauncher(java.lang.Object localService,
java.lang.Class<T> remoteInterface,
java.io.InputStream in,
java.io.OutputStream out,
java.util.concurrent.ExecutorService executorService,
java.util.function.Function<MessageConsumer,MessageConsumer> wrapper)
Create a new Launcher for a given local service object, a given remote interface and an input and output stream.
|
static <T> Launcher<T> |
createIoLauncher(java.lang.Object localService,
java.lang.Class<T> remoteInterface,
java.io.InputStream in,
java.io.OutputStream out,
java.util.concurrent.ExecutorService executorService,
java.util.function.Function<MessageConsumer,MessageConsumer> wrapper,
java.util.function.Consumer<com.google.gson.GsonBuilder> configureGson)
Create a new Launcher for a given local service object, a given remote interface and an input and output stream.
|
static <T> Launcher<T> |
createLauncher(java.lang.Object localService,
java.lang.Class<T> remoteInterface,
java.io.InputStream in,
java.io.OutputStream out)
Create a new Launcher for a given local service object, a given remote interface and an input and output stream.
|
static <T> Launcher<T> |
createLauncher(java.lang.Object localService,
java.lang.Class<T> remoteInterface,
java.io.InputStream in,
java.io.OutputStream out,
boolean validate,
java.io.PrintWriter trace)
Create a new Launcher for a given local service object, a given remote interface and an input and output stream,
and set up message validation and tracing.
|
static <T> Launcher<T> |
createLauncher(java.lang.Object localService,
java.lang.Class<T> remoteInterface,
java.io.InputStream in,
java.io.OutputStream out,
java.util.concurrent.ExecutorService executorService,
java.util.function.Function<MessageConsumer,MessageConsumer> wrapper)
Create a new Launcher for a given local service object, a given remote interface and an input and output stream.
|
RemoteEndpoint |
getRemoteEndpoint()
Returns the remote endpoint.
|
T |
getRemoteProxy()
Returns the proxy instance that implements the remote service interfaces.
|
java.util.concurrent.Future<java.lang.Void> |
startListening()
Start a thread that listens to the input stream.
|
static <T> Launcher<T> createLauncher(java.lang.Object localService, java.lang.Class<T> remoteInterface, java.io.InputStream in, java.io.OutputStream out)
localService
- - the object that receives method calls from the remote serviceremoteInterface
- - an interface on which RPC methods are looked upin
- - input stream to listen for incoming messagesout
- - output stream to send outgoing messagesstatic <T> Launcher<T> createLauncher(java.lang.Object localService, java.lang.Class<T> remoteInterface, java.io.InputStream in, java.io.OutputStream out, boolean validate, java.io.PrintWriter trace)
localService
- - the object that receives method calls from the remote serviceremoteInterface
- - an interface on which RPC methods are looked upin
- - input stream to listen for incoming messagesout
- - output stream to send outgoing messagesvalidate
- - whether messages should be validated with the ReflectiveMessageValidator
trace
- - a writer to which incoming and outgoing messages are traced, or null
to disable tracingstatic <T> Launcher<T> createLauncher(java.lang.Object localService, java.lang.Class<T> remoteInterface, java.io.InputStream in, java.io.OutputStream out, java.util.concurrent.ExecutorService executorService, java.util.function.Function<MessageConsumer,MessageConsumer> wrapper)
localService
- - the object that receives method calls from the remote serviceremoteInterface
- - an interface on which RPC methods are looked upin
- - input stream to listen for incoming messagesout
- - output stream to send outgoing messagesexecutorService
- - the executor service used to start threadswrapper
- - a function for plugging in additional message consumersstatic <T> Launcher<T> createIoLauncher(java.lang.Object localService, java.lang.Class<T> remoteInterface, java.io.InputStream in, java.io.OutputStream out, java.util.concurrent.ExecutorService executorService, java.util.function.Function<MessageConsumer,MessageConsumer> wrapper)
localService
- - the object that receives method calls from the remote serviceremoteInterface
- - an interface on which RPC methods are looked upin
- - input stream to listen for incoming messagesout
- - output stream to send outgoing messagesexecutorService
- - the executor service used to start threadswrapper
- - a function for plugging in additional message consumersstatic <T> Launcher<T> createIoLauncher(java.lang.Object localService, java.lang.Class<T> remoteInterface, java.io.InputStream in, java.io.OutputStream out, java.util.concurrent.ExecutorService executorService, java.util.function.Function<MessageConsumer,MessageConsumer> wrapper, java.util.function.Consumer<com.google.gson.GsonBuilder> configureGson)
configureGson
function can be used to register additional type adapters in the GsonBuilder
in order to support protocol classes that cannot be handled by Gson's reflective capabilities.localService
- - the object that receives method calls from the remote serviceremoteInterface
- - an interface on which RPC methods are looked upin
- - input stream to listen for incoming messagesout
- - output stream to send outgoing messagesexecutorService
- - the executor service used to start threadswrapper
- - a function for plugging in additional message consumersconfigureGson
- - a function for Gson configurationstatic <T> Launcher<T> createIoLauncher(java.lang.Object localService, java.lang.Class<T> remoteInterface, java.io.InputStream in, java.io.OutputStream out, boolean validate, java.util.concurrent.ExecutorService executorService, java.util.function.Function<MessageConsumer,MessageConsumer> wrapper, java.util.function.Consumer<com.google.gson.GsonBuilder> configureGson)
configureGson
function can be used to register additional type adapters in the GsonBuilder
in order to support protocol classes that cannot be handled by Gson's reflective capabilities.localService
- - the object that receives method calls from the remote serviceremoteInterface
- - an interface on which RPC methods are looked upin
- - input stream to listen for incoming messagesout
- - output stream to send outgoing messagesvalidate
- - whether messages should be validated with the ReflectiveMessageValidator
executorService
- - the executor service used to start threadswrapper
- - a function for plugging in additional message consumersconfigureGson
- - a function for Gson configurationstatic Launcher<java.lang.Object> createIoLauncher(java.util.Collection<java.lang.Object> localServices, java.util.Collection<java.lang.Class<?>> remoteInterfaces, java.lang.ClassLoader classLoader, java.io.InputStream in, java.io.OutputStream out, java.util.concurrent.ExecutorService executorService, java.util.function.Function<MessageConsumer,MessageConsumer> wrapper, java.util.function.Consumer<com.google.gson.GsonBuilder> configureGson)
configureGson
function can be used to register additional type adapters in
the GsonBuilder
in order to support protocol classes that cannot be handled by Gson's reflective
capabilities.localServices
- - the objects that receive method calls from the remote servicesremoteInterfaces
- - interfaces on which RPC methods are looked upclassLoader
- - a class loader that is able to resolve all given interfacesin
- - input stream to listen for incoming messagesout
- - output stream to send outgoing messagesexecutorService
- - the executor service used to start threadswrapper
- - a function for plugging in additional message consumersconfigureGson
- - a function for Gson configurationjava.util.concurrent.Future<java.lang.Void> startListening()
null
when the listener thread is terminatedT getRemoteProxy()
RemoteEndpoint getRemoteEndpoint()
request
or notify
methods
to the remote services.