Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.jnp.interfaces
Class FastNamingProperties  view FastNamingProperties download FastNamingProperties.java

java.lang.Object
  extended byjava.util.Dictionary
      extended byjava.util.Hashtable
          extended byjava.util.Properties
              extended byorg.jnp.interfaces.FastNamingProperties
All Implemented Interfaces:
java.lang.Cloneable, java.util.Map, java.io.Serializable

class FastNamingProperties
extends java.util.Properties

This class exists because the JNDI API set wisely uses java.util.Properties which extends Hashtable, a threadsafe class. The NamingParser uses a static instance, making it a global source of contention. This results in a huge scalability problem, which can be seen in ECPerf, as sometimes half of the worker threads are stuck waiting for this stupid lock, sometimes themselves holdings global locks, e.g. to the AbstractInstanceCache.

Version:
$Revision: 1.1.4.1 $

Nested Class Summary
 
Nested classes inherited from class java.util.Hashtable
 
Nested classes inherited from class java.util.Map
java.util.Map.Entry
 
Field Summary
 
Fields inherited from class java.util.Properties
defaults
 
Fields inherited from class java.util.Hashtable
 
Constructor Summary
(package private) FastNamingProperties()
           
 
Method Summary
 void clear()
          Clears the hashtable so it has no keys.
 java.lang.Object clone()
          Returns a shallow clone of this Hashtable.
 boolean contains(java.lang.Object o)
          Returns true if this Hashtable contains a value o, such that o.equals(value).
 boolean containsKey(java.lang.Object o)
          Returns true if the supplied object equals() a key in this Hashtable.
 boolean containsValue(java.lang.Object o)
          Returns true if this Hashtable contains a value o, such that o.equals(value).
 java.util.Enumeration elements()
          Return an enumeration of the values of this table.
 java.util.Set entrySet()
          Returns a "set view" of this Hashtable's entries.
 boolean equals(java.lang.Object o)
          Returns true if this Hashtable equals the supplied Object o.
 java.lang.Object get(java.lang.Object o)
          Return the value in this Hashtable associated with the supplied key, or null if the key maps to nothing.
 java.lang.String getProperty(java.lang.String s)
          Gets the property with the specified key in this property list.
 java.lang.String getProperty(java.lang.String name, java.lang.String defaultValue)
          Gets the property with the specified key in this property list.
 int hashCode()
          Returns the hashCode for this Hashtable.
 boolean isEmpty()
          Returns true if there are no key-value mappings currently in this table.
 java.util.Enumeration keys()
          Return an enumeration of the keys of this table.
 java.util.Set keySet()
          Returns a "set view" of this Hashtable's keys.
 void list(java.io.PrintStream ps)
          Prints the key/value pairs to the given print stream.
 void list(java.io.PrintWriter ps)
          Prints the key/value pairs to the given print writer.
 void load(java.io.InputStream is)
          Reads a property list from an input stream.
 java.util.Enumeration propertyNames()
          Returns an enumeration of all keys in this property list, including the keys in the default property list.
 java.lang.Object put(java.lang.Object o1, java.lang.Object o2)
          Puts the supplied value into the Map, mapped by the supplied key.
 void putAll(java.util.Map m)
          Copies all elements of the given map into this hashtable.
 java.lang.Object remove(java.lang.Object o)
          Removes from the table and returns the value which is mapped by the supplied key.
 java.lang.Object setProperty(java.lang.String s1, java.lang.String s2)
          Adds the given key/value pair to this properties.
 int size()
          Returns the number of key-value mappings currently in this hashtable.
 java.lang.String toString()
          Converts this Hashtable to a String, surrounded by braces, and with key/value pairs listed with an equals sign between, separated by a comma and space.
 java.util.Collection values()
          Returns a "collection view" (or "bag view") of this Hashtable's values.
 
Methods inherited from class java.util.Properties
loadFromXML, save, store, storeToXML, storeToXML
 
Methods inherited from class java.util.Hashtable
rehash
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FastNamingProperties

FastNamingProperties()
Method Detail

setProperty

public java.lang.Object setProperty(java.lang.String s1,
                                    java.lang.String s2)
Description copied from class: java.util.Properties
Adds the given key/value pair to this properties. This calls the hashtable method put.


load

public void load(java.io.InputStream is)
          throws java.io.IOException
Description copied from class: java.util.Properties
Reads a property list from an input stream. The stream should have the following format:
An empty line or a line starting with # or ! is ignored. An backslash (\) at the end of the line makes the line continueing on the next line (but make sure there is no whitespace after the backslash). Otherwise, each line describes a key/value pair.
The chars up to the first whitespace, = or : are the key. You can include this caracters in the key, if you precede them with a backslash (\). The key is followed by optional whitespaces, optionally one = or :, and optionally some more whitespaces. The rest of the line is the resource belonging to the key.
Escape sequences \t, \n, \r, \\, \", \', \!, \#, \ (a space), and unicode characters with the \\uxxxx notation are detected, and converted to the corresponding single character.
# This is a comment
key     = value
k\:5      \ a string starting with space and ending with newline\n
# This is a multiline specification; note that the value contains
# no white space.
weekdays: Sunday,Monday,Tuesday,Wednesday,\\
          Thursday,Friday,Saturday
# The safest way to include a space at the end of a value:
label   = Name:\\u0020


getProperty

public java.lang.String getProperty(java.lang.String s)
Description copied from class: java.util.Properties
Gets the property with the specified key in this property list. If the key is not found, the default property list is searched. If the property is not found in the default, null is returned.


getProperty

public java.lang.String getProperty(java.lang.String name,
                                    java.lang.String defaultValue)
Description copied from class: java.util.Properties
Gets the property with the specified key in this property list. If the key is not found, the default property list is searched. If the property is not found in the default, the specified defaultValue is returned.


propertyNames

public java.util.Enumeration propertyNames()
Description copied from class: java.util.Properties
Returns an enumeration of all keys in this property list, including the keys in the default property list.


list

public void list(java.io.PrintStream ps)
Description copied from class: java.util.Properties
Prints the key/value pairs to the given print stream. This is mainly useful for debugging purposes.


list

public void list(java.io.PrintWriter ps)
Description copied from class: java.util.Properties
Prints the key/value pairs to the given print writer. This is mainly useful for debugging purposes.


size

public int size()
Description copied from class: java.util.Hashtable
Returns the number of key-value mappings currently in this hashtable.


isEmpty

public boolean isEmpty()
Description copied from class: java.util.Hashtable
Returns true if there are no key-value mappings currently in this table.


keys

public java.util.Enumeration keys()
Description copied from class: java.util.Hashtable
Return an enumeration of the keys of this table. There's no point in synchronizing this, as you have already been warned that the enumeration is not specified to be thread-safe.


elements

public java.util.Enumeration elements()
Description copied from class: java.util.Hashtable
Return an enumeration of the values of this table. There's no point in synchronizing this, as you have already been warned that the enumeration is not specified to be thread-safe.


contains

public boolean contains(java.lang.Object o)
Description copied from class: java.util.Hashtable
Returns true if this Hashtable contains a value o, such that o.equals(value). This is the same as containsValue(), and is O(n).


containsValue

public boolean containsValue(java.lang.Object o)
Description copied from class: java.util.Hashtable
Returns true if this Hashtable contains a value o, such that o.equals(value). This is the new API for the old contains().


containsKey

public boolean containsKey(java.lang.Object o)
Description copied from class: java.util.Hashtable
Returns true if the supplied object equals() a key in this Hashtable.


get

public java.lang.Object get(java.lang.Object o)
Description copied from class: java.util.Hashtable
Return the value in this Hashtable associated with the supplied key, or null if the key maps to nothing.


put

public java.lang.Object put(java.lang.Object o1,
                            java.lang.Object o2)
Description copied from class: java.util.Hashtable
Puts the supplied value into the Map, mapped by the supplied key. Neither parameter may be null. The value may be retrieved by any object which equals() this key.


remove

public java.lang.Object remove(java.lang.Object o)
Description copied from class: java.util.Hashtable
Removes from the table and returns the value which is mapped by the supplied key. If the key maps to nothing, then the table remains unchanged, and null is returned.


putAll

public void putAll(java.util.Map m)
Description copied from class: java.util.Hashtable
Copies all elements of the given map into this hashtable. However, no mapping can contain null as key or value. If this table already has a mapping for a key, the new mapping replaces the current one.


clear

public void clear()
Description copied from class: java.util.Hashtable
Clears the hashtable so it has no keys. This is O(1).


clone

public java.lang.Object clone()
Description copied from class: java.util.Hashtable
Returns a shallow clone of this Hashtable. The Map itself is cloned, but its contents are not. This is O(n).


toString

public java.lang.String toString()
Description copied from class: java.util.Hashtable
Converts this Hashtable to a String, surrounded by braces, and with key/value pairs listed with an equals sign between, separated by a comma and space. For example, "{a=1, b=2}".

NOTE: if the toString() method of any key or value throws an exception, this will fail for the same reason.


keySet

public java.util.Set keySet()
Description copied from class: java.util.Hashtable
Returns a "set view" of this Hashtable's keys. The set is backed by the hashtable, so changes in one show up in the other. The set supports element removal, but not element addition. The set is properly synchronized on the original hashtable. Sun has not documented the proper interaction of null with this set, but has inconsistent behavior in the JDK. Therefore, in this implementation, contains, remove, containsAll, retainAll, removeAll, and equals just ignore a null key rather than throwing a java.lang.NullPointerException.


entrySet

public java.util.Set entrySet()
Description copied from class: java.util.Hashtable
Returns a "set view" of this Hashtable's entries. The set is backed by the hashtable, so changes in one show up in the other. The set supports element removal, but not element addition. The set is properly synchronized on the original hashtable. Sun has not documented the proper interaction of null with this set, but has inconsistent behavior in the JDK. Therefore, in this implementation, contains, remove, containsAll, retainAll, removeAll, and equals just ignore a null entry, or an entry with a null key or value, rather than throwing a java.lang.NullPointerException. However, calling entry.setValue(null) will fail.

Note that the iterators for all three views, from keySet(), entrySet(), and values(), traverse the hashtable in the same sequence.


values

public java.util.Collection values()
Description copied from class: java.util.Hashtable
Returns a "collection view" (or "bag view") of this Hashtable's values. The collection is backed by the hashtable, so changes in one show up in the other. The collection supports element removal, but not element addition. The collection is properly synchronized on the original hashtable. Sun has not documented the proper interaction of null with this set, but has inconsistent behavior in the JDK. Therefore, in this implementation, contains, remove, containsAll, retainAll, removeAll, and equals just ignore a null value rather than throwing a java.lang.NullPointerException.


equals

public boolean equals(java.lang.Object o)
Description copied from class: java.util.Hashtable
Returns true if this Hashtable equals the supplied Object o. As specified by Map, this is: (o instanceof Map) && entrySet().equals(((Map) o).entrySet());


hashCode

public int hashCode()
Description copied from class: java.util.Hashtable
Returns the hashCode for this Hashtable. As specified by Map, this is the sum of the hashCodes of all of its Map.Entry objects