Class SyncHybrid
- All Implemented Interfaces:
Closeable,AutoCloseable
It is typically used in local cluster setups, in which a "hybrid" functions as a client invalid input: '&' cluster peer (server).
Call getStore() to retrieve the store. To set sync listeners use the SyncClient that is available
from getClient().
This class implements the Closeable interface, ensuring that resources are cleaned up properly.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final SyncClientprivate final SyncServerprivate BoxStoreprivate BoxStore -
Constructor Summary
ConstructorsConstructorDescriptionSyncHybrid(BoxStore store, SyncClient client, BoxStore storeServer, SyncServer server) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes and cleans up all resources used by this Sync hybrid.protected voidfinalize()Users of this class should explicitly callclose()instead to avoid expensive finalization.Returns theSyncClientof this hybrid, typically only to set Sync listeners.Returns theSyncServerof this hybrid.getStore()voidstop()Stops the client and server.
-
Field Details
-
store
-
client
-
storeServer
-
server
-
-
Constructor Details
-
SyncHybrid
SyncHybrid(BoxStore store, SyncClient client, BoxStore storeServer, SyncServer server)
-
-
Method Details
-
getStore
-
getClient
Returns theSyncClientof this hybrid, typically only to set Sync listeners.Note: do not stop or close the client directly. Instead, use the
stop()andclose()methods of this hybrid. -
getServer
Returns theSyncServerof this hybrid.Typically, the server should not be touched. Yet, it is still exposed for advanced use cases.
Note: do not stop or close the server directly. Instead, use the
stop()andclose()methods of this hybrid. -
stop
public void stop()Stops the client and server. -
close
public void close()Closes and cleans up all resources used by this Sync hybrid.It can no longer be used afterward, build a new one instead.
Does nothing if this has already been closed.
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
finalize
Users of this class should explicitly callclose()instead to avoid expensive finalization.
-