public class HashtableServerImpl extends java.lang.Object implements HashtableServer, HashtableServer_thrift.Iface
| Constructor and Description |
|---|
HashtableServerImpl(java.lang.String url)
server-id unaware constructor
|
HashtableServerImpl(java.lang.String url,
int serverId,
Config configParams,
boolean caching,
java.util.HashMap<java.lang.Byte,java.lang.String> nodeClassNameMap,
java.util.HashMap<java.lang.Byte,java.lang.Class> nodeClassMap)
Constructor for the caching case
|
HashtableServerImpl(java.lang.String url,
int serverId,
Config configParams,
boolean caching,
java.util.HashMap<java.lang.Byte,java.lang.String> nodeClassNameMap,
java.util.HashMap<java.lang.Byte,java.lang.Class> nodeClassMap,
boolean recover) |
| Modifier and Type | Method and Description |
|---|---|
int |
acquireLocks_thrift(java.util.Set<LockRequest_thrift> lockRequests) |
int |
acquireLocks(java.util.SortedSet<LockRequest> lockRequests) |
Node |
cacheEvict(java.lang.String nodeId)
cache eviction thread invokes this method when removing a copy from the cache table (cache replacement)
|
void |
cacheEvictMasterNotify(java.lang.String cachingServerId,
java.util.Hashtable<java.lang.String,java.lang.Long> evictedNodes)
cache eviction thread invokes this method on the master site informing it of the cache eviction
|
void |
cacheInvalidate(java.lang.String nodeId)
Master server invokes this function on a remote server when asking it to invalidate its cache copy
|
java.util.Vector<ResultObject> |
cachePut(java.util.Map<java.lang.Integer,java.util.Vector<Node>> nodes,
long storageSystemThreadId)
Bulk call for cachePut
|
ResultObject |
cachePut(java.lang.String nodeId,
Node node,
int masterCopySite,
long storageSystemThreadId)
Once a node has been fetched for caching, insert into cache table.
|
void |
checkpoint() |
void |
clearStatContainers()
Clear stat containers
|
void |
commitChanges_thrift(java.util.Set<NodeData_thrift> writeNd,
java.util.Map<java.lang.String,java.lang.Long> read) |
void |
commitChanges(java.util.Set<Node> write,
java.util.Set<NodeData> writeNd,
java.util.Map<java.lang.String,java.lang.Long> read) |
void |
configureServer(java.util.Vector<java.lang.String> hostList)
Configure server to hold rmi handles of other servers
Allows for inter-server communication
|
boolean |
contains(java.lang.String key)
Check if the table contains a given key
|
void |
enableStats()
Turn on stat recording
|
ResultObject |
exec(NodeData n) |
java.util.Vector<ResultObject> |
execBulk(java.util.Vector<NodeData> keyList) |
ResultObject_thrift |
get_thrift(java.lang.String key,
long storageSystemThreadId) |
ResultObject |
get(java.lang.String nodeId,
long storageSystemThreadId)
Given a node id, returns a node to the storage system (application)
Forks off to getUseCache in the useCaching = true case
|
java.util.List<java.lang.String> |
getAllKeys_thrift() |
java.util.Vector<java.lang.String> |
getAllKeys()
Get all node ids present in the main table (does not include cache table)
|
java.util.Vector<Node> |
getAllNodes()
Get all nodes present in the main table (does not include cache table)
|
java.util.Vector<Node> |
getCachedObjects(java.util.Vector<java.lang.String> nodeIds)
In the list provided, get the objects that are available in the cache
|
java.util.Vector<ResultObject> |
getLocalNodes(java.util.Vector<java.lang.String> nodeIds,
long storageSystemThreadId)
Storage system invokes this method on the server when requesting nodes and status for those nodes which are not available
Only used in caching case
|
Node |
getNodeForCaching(java.lang.String nodeId,
int cachingSite)
Remote server invokes this method on the master site when requesting a cache copy
|
Node |
getNodeFromCacheTable(java.lang.String nodeId)
get node for nodeId from the cache table
returns null if node not found
|
Node |
getNodeFromTable(java.lang.String nodeId)
get a node from the table
|
ResultObject_thrift |
getNodeProperties_thrift(NodeData_thrift n) |
ResultObject |
getNodeProperties(NodeData n)
retrieve the node data for a node, given its node ids and the required properties
|
java.util.Vector<Node> |
getNodesForCaching(java.util.Vector<java.lang.String> nodeIds,
int cachingSite)
Bulk call for getNodeForCaching
|
int |
getNumServers() |
java.util.List<ResultObject_thrift> |
getObjects_thrift(java.util.List<java.lang.String> keyList) |
java.util.Vector<ResultObject> |
getObjects(java.util.Vector<java.lang.String> keyList)
getObjects from the hash table.
|
java.util.List<ResultObject_thrift> |
getObjectsProperties_thrift(java.util.List<NodeData_thrift> keyList) |
java.util.Vector<ResultObject> |
getObjectsProperties(java.util.Vector<NodeData> keyList)
Bulk call to get object properties for a set of nodes
|
int |
getServerId() |
java.lang.String |
getStats()
Get the stats, called after program run terminates
|
void |
loadNodes(java.util.Vector<Node> nodes)
To load initial nodes into the table, used by the file loader
|
void |
locationChange_thrift(int nodeId,
java.lang.String serverName) |
void |
locationChange(int nodeId,
java.lang.String servername)
Deprecated.
nodeIds are now Strings
|
ResultObject_thrift |
lock_thrift(int nodeId) |
ResultObject |
lock(int nodeId)
Deprecated.
nodeIds are now Strings
|
static void |
main(java.lang.String[] args) |
java.util.Date |
ping()
Test if the hashtable server is up
|
ResultObject_thrift |
put_thrift(java.lang.String nodeId,
Node_thrift value) |
ResultObject |
put(java.lang.String nodeId,
java.lang.Object value)
put the node into the table, given a node-id
Forks off to putUseCache in the useCaching = true case
Returns status as FAILED if the object is put for the first time.
|
ResultObject |
put(java.lang.String nodeId,
java.lang.Object value,
int callerServerId)
put for the write through cache case
|
java.util.List<ResultObject_thrift> |
putObjects_thrift(java.util.Map<java.lang.String,Node_thrift> nodeList_thrift) |
java.util.Vector<ResultObject> |
putObjects(java.util.concurrent.ConcurrentHashMap<java.lang.String,Node> objList)
putObjects back into the hash table
|
java.util.Vector<ResultObject> |
putObjects(java.util.concurrent.ConcurrentHashMap<java.lang.String,Node> objList,
int callingServerId)
put objects back into the hash table for the write through cache case
|
void |
releaseLock(java.util.SortedSet<LockRequest> lockRequests) |
void |
releaseLocks_thrift(java.util.Set<LockRequest_thrift> lockRequests) |
ResultObject_thrift |
relocate_thrift(int nodeId,
java.lang.String serverName) |
ResultObject |
relocate(int nodeId,
java.lang.String serverName)
Deprecated.
nodeIds are now Strings
|
void |
removeLocationTableEntry(java.lang.String key)
Remove a key from the location table
|
void |
setNumServers(int n) |
ResultObject_thrift |
updateNodeProperties_thrift(NodeData_thrift n) |
ResultObject |
updateNodeProperties(NodeData value)
update the properties of a node, given the node id and the updated property map
|
java.util.List<ResultObject_thrift> |
updateNodePropertiesParallel_thrift(java.util.List<NodeData_thrift> keyList) |
java.util.Vector<ResultObject> |
updateNodePropertiesParallel(java.util.Vector<NodeData> objList)
This is the reflection counterpart of putObjects, used for bulk update of node properties
repeatedly calls the updateNodeProperties (can be done in parallel)
|
void |
writeThroughToCache(java.lang.String paramString,
java.lang.Object value)
write through to local cache, so that master does need to invalidate the copy on put
|
void |
writeThroughToCacheBulk(java.util.concurrent.ConcurrentHashMap<java.lang.String,Node> map)
bulk call for writeThroughToCache
|
public HashtableServerImpl(java.lang.String url)
throws java.rmi.RemoteException
url - java.rmi.RemoteExceptionpublic HashtableServerImpl(java.lang.String url,
int serverId,
Config configParams,
boolean caching,
java.util.HashMap<java.lang.Byte,java.lang.String> nodeClassNameMap,
java.util.HashMap<java.lang.Byte,java.lang.Class> nodeClassMap)
throws java.rmi.RemoteException
url - serverId - configParams - java.rmi.RemoteExceptionpublic HashtableServerImpl(java.lang.String url,
int serverId,
Config configParams,
boolean caching,
java.util.HashMap<java.lang.Byte,java.lang.String> nodeClassNameMap,
java.util.HashMap<java.lang.Byte,java.lang.Class> nodeClassMap,
boolean recover)
throws java.rmi.RemoteException
java.rmi.RemoteExceptionpublic void configureServer(java.util.Vector<java.lang.String> hostList)
hostList - public void enableStats()
public java.util.Date ping()
ping in interface HashtableServerpublic ResultObject get(java.lang.String nodeId, long storageSystemThreadId)
get in interface HashtableServernodeId - storageSystemThreadId - public ResultObject put(java.lang.String nodeId, java.lang.Object value) throws java.rmi.RemoteException
put in interface HashtableServernodeId - value - java.rmi.RemoteExceptionpublic ResultObject put(java.lang.String nodeId, java.lang.Object value, int callerServerId) throws java.rmi.RemoteException
put in interface HashtableServernodeId - value - callerServerId - java.rmi.RemoteExceptionpublic ResultObject getNodeProperties(NodeData n) throws java.rmi.RemoteException
getNodeProperties in interface HashtableServern - java.rmi.RemoteExceptionpublic ResultObject updateNodeProperties(NodeData value) throws java.rmi.RemoteException
updateNodeProperties in interface HashtableServervalue - java.rmi.RemoteExceptionpublic ResultObject exec(NodeData n) throws java.rmi.RemoteException
exec in interface HashtableServerjava.rmi.RemoteExceptionpublic java.util.Vector<ResultObject> execBulk(java.util.Vector<NodeData> keyList) throws java.rmi.RemoteException
execBulk in interface HashtableServerjava.rmi.RemoteExceptionpublic java.util.Vector<ResultObject> getObjects(java.util.Vector<java.lang.String> keyList)
getObjects in interface HashtableServerkeyList - public java.util.Vector<ResultObject> putObjects(java.util.concurrent.ConcurrentHashMap<java.lang.String,Node> objList) throws java.rmi.RemoteException
putObjects in interface HashtableServerobjList - java.rmi.RemoteExceptionpublic java.util.Vector<ResultObject> putObjects(java.util.concurrent.ConcurrentHashMap<java.lang.String,Node> objList, int callingServerId) throws java.rmi.RemoteException
putObjects in interface HashtableServerobjList - callingServerId - java.rmi.RemoteExceptionpublic java.util.Vector<ResultObject> getObjectsProperties(java.util.Vector<NodeData> keyList) throws java.rmi.RemoteException
getObjectsProperties in interface HashtableServerkeyList - java.rmi.RemoteExceptionpublic java.util.Vector<Node> getCachedObjects(java.util.Vector<java.lang.String> nodeIds) throws java.rmi.RemoteException
getCachedObjects in interface HashtableServernodeIds - java.rmi.RemoteExceptionpublic java.util.Vector<ResultObject> updateNodePropertiesParallel(java.util.Vector<NodeData> objList) throws java.rmi.RemoteException
updateNodePropertiesParallel in interface HashtableServerobjList - - hashtable of nodeId/Node data objectjava.rmi.RemoteExceptionpublic Node getNodeFromCacheTable(java.lang.String nodeId) throws java.rmi.RemoteException
getNodeFromCacheTable in interface HashtableServernodeId - java.rmi.RemoteExceptionpublic ResultObject cachePut(java.lang.String nodeId, Node node, int masterCopySite, long storageSystemThreadId)
cachePut in interface HashtableServernodeId - node - masterCopySite - storageSystemThreadId - public java.util.Vector<ResultObject> cachePut(java.util.Map<java.lang.Integer,java.util.Vector<Node>> nodes, long storageSystemThreadId)
cachePut in interface HashtableServernodes - - Map of master site v/s list of nodes obtained from that master sitestorageSystemThreadId - public void cacheInvalidate(java.lang.String nodeId)
cacheInvalidate in interface HashtableServernodeId - - node for which invalidation has to take placepublic Node cacheEvict(java.lang.String nodeId)
nodeId - public void cacheEvictMasterNotify(java.lang.String cachingServerId,
java.util.Hashtable<java.lang.String,java.lang.Long> evictedNodes)
throws java.rmi.RemoteException
cacheEvictMasterNotify in interface HashtableServercachingServerId - evictedNodes - java.rmi.RemoteExceptionpublic Node getNodeForCaching(java.lang.String nodeId, int cachingSite)
getNodeForCaching in interface HashtableServernodeId - cachingSite - public java.util.Vector<Node> getNodesForCaching(java.util.Vector<java.lang.String> nodeIds, int cachingSite)
getNodesForCaching in interface HashtableServerpublic void writeThroughToCache(java.lang.String paramString,
java.lang.Object value)
writeThroughToCache in interface HashtableServerparamString - value - public void writeThroughToCacheBulk(java.util.concurrent.ConcurrentHashMap<java.lang.String,Node> map)
writeThroughToCacheBulk in interface HashtableServermap - public java.util.Vector<ResultObject> getLocalNodes(java.util.Vector<java.lang.String> nodeIds, long storageSystemThreadId)
getLocalNodes in interface HashtableServernodeIds - public Node getNodeFromTable(java.lang.String nodeId) throws java.rmi.RemoteException
getNodeFromTable in interface HashtableServernodeId - java.rmi.RemoteExceptionpublic boolean contains(java.lang.String key)
contains in interface HashtableServerkey - public java.util.Vector<Node> getAllNodes()
getAllNodes in interface HashtableServerpublic java.util.Vector<java.lang.String> getAllKeys()
getAllKeys in interface HashtableServerpublic java.lang.String getStats()
getStats in interface HashtableServerpublic void clearStatContainers()
clearStatContainers in interface HashtableServerpublic void loadNodes(java.util.Vector<Node> nodes) throws java.rmi.RemoteException
loadNodes in interface HashtableServernodes - java.rmi.RemoteExceptionpublic int getServerId()
throws java.rmi.RemoteException
getServerId in interface HashtableServerjava.rmi.RemoteExceptionpublic int getNumServers()
throws java.rmi.RemoteException
getNumServers in interface HashtableServerjava.rmi.RemoteExceptionpublic void setNumServers(int n)
throws java.rmi.RemoteException
setNumServers in interface HashtableServerjava.rmi.RemoteException@Deprecated public ResultObject relocate(int nodeId, java.lang.String serverName)
relocate in interface HashtableServernodeId - serverName - @Deprecated
public void locationChange(int nodeId,
java.lang.String servername)
locationChange in interface HashtableServernodeId - servername - @Deprecated public ResultObject lock(int nodeId) throws java.rmi.RemoteException
lock in interface HashtableServernodeId - java.rmi.RemoteExceptionpublic void removeLocationTableEntry(java.lang.String key)
removeLocationTableEntry in interface HashtableServerkey - public int acquireLocks(java.util.SortedSet<LockRequest> lockRequests) throws java.rmi.RemoteException
acquireLocks in interface HashtableServerjava.rmi.RemoteExceptionpublic void releaseLock(java.util.SortedSet<LockRequest> lockRequests) throws java.rmi.RemoteException
releaseLock in interface HashtableServerjava.rmi.RemoteExceptionpublic void commitChanges(java.util.Set<Node> write, java.util.Set<NodeData> writeNd, java.util.Map<java.lang.String,java.lang.Long> read) throws java.rmi.RemoteException
commitChanges in interface HashtableServerjava.rmi.RemoteExceptionpublic void checkpoint()
throws java.rmi.RemoteException
checkpoint in interface HashtableServerjava.rmi.RemoteExceptionpublic ResultObject_thrift put_thrift(java.lang.String nodeId, Node_thrift value)
put_thrift in interface HashtableServer_thrift.Ifacepublic ResultObject_thrift get_thrift(java.lang.String key, long storageSystemThreadId) throws org.apache.thrift.TException
get_thrift in interface HashtableServer_thrift.Ifaceorg.apache.thrift.TExceptionpublic ResultObject_thrift getNodeProperties_thrift(NodeData_thrift n) throws org.apache.thrift.TException
getNodeProperties_thrift in interface HashtableServer_thrift.Ifaceorg.apache.thrift.TExceptionpublic ResultObject_thrift updateNodeProperties_thrift(NodeData_thrift n) throws org.apache.thrift.TException
updateNodeProperties_thrift in interface HashtableServer_thrift.Ifaceorg.apache.thrift.TExceptionpublic java.util.List<ResultObject_thrift> getObjectsProperties_thrift(java.util.List<NodeData_thrift> keyList) throws org.apache.thrift.TException
getObjectsProperties_thrift in interface HashtableServer_thrift.Ifaceorg.apache.thrift.TExceptionpublic java.util.List<ResultObject_thrift> updateNodePropertiesParallel_thrift(java.util.List<NodeData_thrift> keyList) throws org.apache.thrift.TException
updateNodePropertiesParallel_thrift in interface HashtableServer_thrift.Ifaceorg.apache.thrift.TExceptionpublic java.util.List<ResultObject_thrift> putObjects_thrift(java.util.Map<java.lang.String,Node_thrift> nodeList_thrift) throws org.apache.thrift.TException
putObjects_thrift in interface HashtableServer_thrift.Ifaceorg.apache.thrift.TExceptionpublic java.util.List<ResultObject_thrift> getObjects_thrift(java.util.List<java.lang.String> keyList) throws org.apache.thrift.TException
getObjects_thrift in interface HashtableServer_thrift.Ifaceorg.apache.thrift.TExceptionpublic java.util.List<java.lang.String> getAllKeys_thrift()
throws org.apache.thrift.TException
getAllKeys_thrift in interface HashtableServer_thrift.Ifaceorg.apache.thrift.TExceptionpublic ResultObject_thrift relocate_thrift(int nodeId, java.lang.String serverName) throws org.apache.thrift.TException
relocate_thrift in interface HashtableServer_thrift.Ifaceorg.apache.thrift.TExceptionpublic void locationChange_thrift(int nodeId,
java.lang.String serverName)
throws org.apache.thrift.TException
locationChange_thrift in interface HashtableServer_thrift.Ifaceorg.apache.thrift.TExceptionpublic ResultObject_thrift lock_thrift(int nodeId) throws org.apache.thrift.TException
lock_thrift in interface HashtableServer_thrift.Ifaceorg.apache.thrift.TExceptionpublic int acquireLocks_thrift(java.util.Set<LockRequest_thrift> lockRequests) throws org.apache.thrift.TException
acquireLocks_thrift in interface HashtableServer_thrift.Ifaceorg.apache.thrift.TExceptionpublic void releaseLocks_thrift(java.util.Set<LockRequest_thrift> lockRequests) throws org.apache.thrift.TException
releaseLocks_thrift in interface HashtableServer_thrift.Ifaceorg.apache.thrift.TExceptionpublic void commitChanges_thrift(java.util.Set<NodeData_thrift> writeNd, java.util.Map<java.lang.String,java.lang.Long> read) throws org.apache.thrift.TException
commitChanges_thrift in interface HashtableServer_thrift.Ifaceorg.apache.thrift.TExceptionpublic static void main(java.lang.String[] args)
throws java.lang.Exception
java.lang.Exception