Skip navigation links


COM.FutureTense.Interfaces
Interface ISyncHash


public interface ISyncHash

This class presents functionality like a hashtable but with cluster sync and LRU behaviors. Note that the use of this object has performance implications. Size should be consider by cost-to-reload data vs memory usage per VM; cluster sync should be used only when a backing store is likely to change and invalidate stored results in a given VM.

Operational considerations (from Netscape) suggest that data read vs write from a synchronized hash should be in a 80/20 ratio if the synchronization is across multiple machines. Non synchronized hashs do not have this suggested restriction. In theory the cost is also low if multiple VM's are on a single machine.


Method Summary
 void clear()
          Empty a hash - causes cluster sync as needed
 java.lang.Object get(java.lang.String key)
          Get an object from hash - performs required data validation/VM synchronization checks as needed.
 java.lang.String getName()
          Get name
 java.util.Set keySet()
          Return a set of all of the keys in the current hash.
 java.lang.Object put(java.lang.String key, java.lang.Object v)
          Add something to the hash; will generate appropriate cluster sync methods and LRU behavior.
 java.lang.Object put(java.lang.String key, java.lang.Object v, java.util.Calendar cal)
          Deprecated. use put(String,Object,Date) insatead.
 java.lang.Object put(java.lang.String key, java.lang.Object v, java.util.Date date)
          Add something to the hash; will generate appropriate cluster sync methods and LRU behavior.
 java.lang.Object remove(java.lang.String key)
          Remove an item
 int size()
          Return the size of the current hash

 

Method Detail

getName

java.lang.String getName()
Get name
Returns:
Returns the name of the hash as it is managed. There is no namespace support for hash names.

put

java.lang.Object put(java.lang.String key,
                     java.lang.Object v)
                     throws java.lang.NullPointerException
Add something to the hash; will generate appropriate cluster sync methods and LRU behavior.
Parameters:
key - Use meaningful, reproducable key names for proper behavior. Limit length; don't use multi-K length keys. 64chars or less is a good guide; 16 chars is optimal for performance but may not be unique.
v - value
Returns:
previous object or null NOTE may toss exception(s) if the create had failed in some unexpected way
Throws:
java.lang.NullPointerException

put

java.lang.Object put(java.lang.String key,
                     java.lang.Object v,
                     java.util.Calendar cal)
Deprecated. use put(String,Object,Date) insatead.
Add something to the hash; will generate appropriate cluster sync methods and LRU behavior.
Parameters:
key - Use meaningful, reproducable key names for proper behavior. Limit length; don't use multi-K length keys. 64chars or less is a good guide; 16 chars is optimal for performance but may not be unique.
v - value
cal - Calendar object specifying the expiration time for this object in the hash. The object added will expire at the time specified by the calendar. Null is not allowed.
Returns:
previous object or null NOTE may toss exception(s) if the create had failed in some unexpected way
Since:
6.1

put

java.lang.Object put(java.lang.String key,
                     java.lang.Object v,
                     java.util.Date date)
Add something to the hash; will generate appropriate cluster sync methods and LRU behavior.
Parameters:
key - Use meaningful, reproducable key names for proper behavior. Limit length; don't use multi-K length keys. 64chars or less is a good guide; 16 chars is optimal for performance but may not be unique.
v - value
date - Date object specifying the expiration time for this object in the hash. The object added will expire at the time specified by the date. Null is not allowed.
Returns:
previous object or null NOTE may toss exception(s) if the create had failed in some unexpected way
Since:
7.0

get

java.lang.Object get(java.lang.String key)
Get an object from hash - performs required data validation/VM synchronization checks as needed.
Parameters:
key -

clear

void clear()
Empty a hash - causes cluster sync as needed

remove

java.lang.Object remove(java.lang.String key)
Remove an item
Parameters:
key -
Returns:
the object, null if not found. Causes cluster sync as needed. It is more efficient to clear() a hash then to remove all entries one by one; first is loop cost, second is cluster-sync cost which can be very high.

size

int size()
Return the size of the current hash
Returns:
int size
Since:
6.1

keySet

java.util.Set keySet()
Return a set of all of the keys in the current hash.
Returns:
Set of string keys; never null
Since:
6.1

Skip navigation links


Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.