public class CloneClientImpl extends Object implements CloneClient
| Constructor and Description |
|---|
CloneClientImpl(ManagedContext context,
long heartbeatInterval) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Destroy this client.
|
void |
connect(String address,
int port)
Connect to a new server endpoint.
|
String |
get(String key)
Look up the value in the shared hashmap.
|
Map<String,String> |
getAll()
Look up all values in the shared hashmap.
|
void |
set(String key,
String value)
Set a new value in the shared hashmap, with no ttl.
|
void |
set(String key,
String value,
long ttl)
Set a new value in the shared hashmap.
|
void |
subscribe(String subtree)
Specify subtree for snapshot and updates.
|
public CloneClientImpl(ManagedContext context, long heartbeatInterval)
public void subscribe(String subtree)
CloneClientNote: We must do this before connecting to a server as the subtree specification is sent as the first command to the server.
subscribe in interface CloneClientsubtree - The prefix (subtree) to subscribe topublic void connect(String address, int port)
CloneClientconnect in interface CloneClientaddress - The address of the server to connect toport - The port on the server to connect topublic void set(String key, String value)
CloneClientset in interface CloneClientkey - The key associated with the new valuevalue - The new value to set in the shared hashmappublic void set(String key, String value, long ttl)
CloneClientset in interface CloneClientkey - The key associated with the new valuevalue - The new value to set in the shared hashmapttl - The time-to-live for the given value, in secondspublic String get(String key)
CloneClientget in interface CloneClientkey - The key to look uppublic Map<String,String> getAll()
CloneClientgetAll in interface CloneClientpublic void close()
CloneClientclose in interface CloneClientCopyright © 2019. All rights reserved.