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)
CloneClient
Note: 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 CloneClient
subtree
- The prefix (subtree) to subscribe topublic void connect(String address, int port)
CloneClient
connect
in interface CloneClient
address
- The address of the server to connect toport
- The port on the server to connect topublic void set(String key, String value)
CloneClient
set
in interface CloneClient
key
- The key associated with the new valuevalue
- The new value to set in the shared hashmappublic void set(String key, String value, long ttl)
CloneClient
set
in interface CloneClient
key
- 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)
CloneClient
get
in interface CloneClient
key
- The key to look uppublic Map<String,String> getAll()
CloneClient
getAll
in interface CloneClient
public void close()
CloneClient
close
in interface CloneClient
Copyright © 2019. All rights reserved.