public class SynchronizeFxServer extends Object
Property interface will be synchronized between all clients.| Constructor and Description |
|---|
SynchronizeFxServer(Object model,
CommandTransferServer networkLayer,
Executor changeExecutor,
ServerCallback callback)
Sets up everything that is needed to serve a domain model.
|
SynchronizeFxServer(Object model,
CommandTransferServer networkLayer,
ServerCallback callback)
Sets up everything that is needed to serve a domain model.
|
| Modifier and Type | Method and Description |
|---|---|
Executor |
getModelChangeExecutor()
The
Executor that should be used for all changes on JavaFX properties in the model in order to
guarantee synchronity to the connected clients. |
void |
shutdown()
Shuts down the server
Before the shutdown, all clients which are still connected are disconnected.
|
void |
start()
Starts the server and accepts incoming client connections.
|
public SynchronizeFxServer(Object model, CommandTransferServer networkLayer, ServerCallback callback)
This method doesn't start the server. Use start() for that. Using this
constructor, all changes done to JavaFX properties will be executed directly in the current thread.
model - The root object of the domain model to serve.networkLayer - An object that does the network transfer and optionally the serialization of the data
generated to keep models synchron.callback - Used to inform the user of this class on errors. The methods in the callback are not called
before you call start().public SynchronizeFxServer(Object model, CommandTransferServer networkLayer, Executor changeExecutor, ServerCallback callback)
This method doesn't start the server. Use start() for that. Using this
constructor, all changes done to JavaFX properties will be executed by an Executor passed by the user.
model - The root object of the domain model to serve.networkLayer - An object that does the network transfer and optionally the serialization of the data
generated to keep models synchron.callback - Used to inform the user of this class on errors. The methods in the callback are not called
before you call start().changeExecutor - An executor used to execute all changes done to JavaFX properties in the model. This
executor must garuantee that only one runnable passed to it is executed at the same time (e.g. like
a single thread executor). IMPORTANT This executor must be used by other code too to execute
all changes on the model in order to guarantee synchronity between the server and all connected
clients.public void start()
public Executor getModelChangeExecutor()
Executor that should be used for all changes on JavaFX properties in the model in order to
guarantee synchronity to the connected clients.
This executor is much like platform thread for JavaFX clients. Like with the platform thread, runnables passed should execute quickly to not block the server.
If an Executor was passed in the constructor this method will returned it. In this case it is also
possible to use this passed Executor directly instead of using this method. If the Executor
was not passed in the constructor this method will return an automatically created one.
Executor for model changes.public void shutdown()
Before the shutdown, all clients which are still connected are disconnected. If the Executor for model
changes was not passed in the constructor it will be shutdown by this method too. This means
getModelChangeExecutor() will not accept any further tasks. If the Executor for model changes
was passed in the constructor it will not be closed. It is the responsibility of the user to do so.
Copyright © 2016 Saxonia Systems AG. All Rights Reserved.