001: /*
002: * JBoss, Home of Professional Open Source.
003: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
004: * as indicated by the @author tags. See the copyright.txt file in the
005: * distribution for a full listing of individual contributors.
006: *
007: * This is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU Lesser General Public License as
009: * published by the Free Software Foundation; either version 2.1 of
010: * the License, or (at your option) any later version.
011: *
012: * This software is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this software; if not, write to the Free
019: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
021: */
022: package org.jnp.interfaces;
023:
024: import java.io.InputStream;
025: import java.io.PrintStream;
026: import java.io.PrintWriter;
027: import java.util.Enumeration;
028: import java.util.Map;
029: import java.util.Properties;
030:
031: /**
032: * This class exists because the JNDI API set wisely uses java.util.Properties
033: * which extends Hashtable, a threadsafe class. The NamingParser uses a static
034: * instance, making it a global source of contention. This results in
035: * a huge scalability problem, which can be seen in ECPerf, as sometimes half
036: * of the worker threads are stuck waiting for this stupid lock, sometimes
037: * themselves holdings global locks, e.g. to the AbstractInstanceCache.
038: *
039: * @version <tt>$Revision: 57199 $</tt>
040: * @author <a href="mailto:sreich@apple.com">Stefan Reich</a>
041: */
042: class FastNamingProperties extends Properties {
043: /** serialVersionUID */
044: private static final long serialVersionUID = 190486940953472275L;
045:
046: FastNamingProperties() {
047: }
048:
049: public Object setProperty(String s1, String s2) {
050: throw new UnsupportedOperationException();
051: }
052:
053: public void load(InputStream is) throws java.io.IOException {
054: throw new UnsupportedOperationException();
055: }
056:
057: public String getProperty(String s) {
058: if (s.equals("jndi.syntax.direction")) {
059: return "left_to_right";
060: } else if (s.equals("jndi.syntax.ignorecase")) {
061: return "false";
062: } else if (s.equals("jndi.syntax.separator")) {
063: return "/";
064: } else {
065: return null;
066: }
067: }
068:
069: public String getProperty(String name, String defaultValue) {
070: String ret = getProperty(name);
071: if (ret == null) {
072: ret = defaultValue;
073: }
074: return ret;
075: }
076:
077: public Enumeration propertyNames() {
078: throw new UnsupportedOperationException();
079: }
080:
081: public void list(PrintStream ps) {
082: throw new UnsupportedOperationException();
083: }
084:
085: public void list(PrintWriter ps) {
086: throw new UnsupportedOperationException();
087: }
088:
089: // methods from Hashtable
090:
091: public int size() {
092: throw new UnsupportedOperationException();
093: }
094:
095: public boolean isEmpty() {
096: throw new UnsupportedOperationException();
097: }
098:
099: public Enumeration keys() {
100: throw new UnsupportedOperationException();
101: }
102:
103: public Enumeration elements() {
104: throw new UnsupportedOperationException();
105: }
106:
107: public boolean contains(Object o) {
108: throw new UnsupportedOperationException();
109: }
110:
111: public boolean containsValue(Object o) {
112: throw new UnsupportedOperationException();
113: }
114:
115: public boolean containsKey(Object o) {
116: throw new UnsupportedOperationException();
117: }
118:
119: public Object get(Object o) {
120: throw new UnsupportedOperationException();
121: }
122:
123: public Object put(Object o1, Object o2) {
124: throw new UnsupportedOperationException();
125: }
126:
127: public Object remove(Object o) {
128: throw new UnsupportedOperationException();
129: }
130:
131: public void putAll(Map m) {
132: throw new UnsupportedOperationException();
133: }
134:
135: public void clear() {
136: throw new UnsupportedOperationException();
137: }
138:
139: public Object clone() {
140: throw new UnsupportedOperationException();
141: }
142:
143: public String toString() {
144: throw new UnsupportedOperationException();
145: }
146:
147: public java.util.Set keySet() {
148: throw new UnsupportedOperationException();
149: }
150:
151: public java.util.Set entrySet() {
152: throw new UnsupportedOperationException();
153: }
154:
155: public java.util.Collection values() {
156: throw new UnsupportedOperationException();
157: }
158:
159: public boolean equals(Object o) {
160: throw new UnsupportedOperationException();
161: }
162:
163: public int hashCode() {
164: throw new UnsupportedOperationException();
165: }
166: }
|