forked from voldemort/voldemort
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add SchedulerService in voldemort client
- Loading branch information
Lei Gao
committed
Jul 3, 2012
1 parent
9a582b4
commit 20b47b7
Showing
30 changed files
with
238 additions
and
281 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
src/java/voldemort/client/scheduler/ClientRegistryRefresher.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package voldemort.client.scheduler; | ||
|
||
import org.apache.log4j.Logger; | ||
|
||
import voldemort.client.ClientInfo; | ||
import voldemort.client.SystemStore; | ||
import voldemort.versioning.Version; | ||
import voldemort.versioning.Versioned; | ||
|
||
public class ClientRegistryRefresher implements Runnable { | ||
|
||
private final Logger logger = Logger.getLogger(this.getClass()); | ||
|
||
private final SystemStore<String, ClientInfo> clientRegistry; | ||
private ClientInfo clientInfo; | ||
private final String clientId; | ||
private Version lastVersion; | ||
|
||
public ClientRegistryRefresher(SystemStore<String, ClientInfo> clientRegistry, | ||
String clientId, | ||
ClientInfo clientInfo, | ||
Version version) { | ||
this.clientRegistry = clientRegistry; | ||
this.clientInfo = clientInfo; | ||
this.clientId = clientId; | ||
this.lastVersion = version; | ||
logger.info("Initial version obtained from client registry: " + version); | ||
} | ||
|
||
public void run() { | ||
clientInfo.setUpdateTime(System.currentTimeMillis()); | ||
logger.info("updating client registry with the following info for client: " + clientId | ||
+ "\n" + clientInfo); | ||
try { | ||
lastVersion = clientRegistry.putSysStore(clientId, | ||
new Versioned<ClientInfo>(clientInfo, | ||
lastVersion)); | ||
} catch(Exception e) { | ||
logger.warn("encounted the following error while trying to update client registry: " | ||
+ e); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.