Source Code Cross Referenced for AutoInternalTables.java in  » Scripting » jython » org » python » core » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Scripting » jython » org.python.core 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // Copyright 2000 Samuele Pedroni
002:
003:        package org.python.core;
004:
005:        import java.lang.ref.*;
006:        import java.util.*;
007:
008:        public abstract class AutoInternalTables extends InternalTables2 {
009:
010:            protected ReferenceQueue queue = new ReferenceQueue();
011:
012:            protected abstract Reference newAutoRef(short type, Object key,
013:                    Object obj);
014:
015:            protected abstract short getAutoRefType(Reference ref);
016:
017:            protected abstract Object getAutoRefKey(Reference ref);
018:
019:            private synchronized void cleanup() {
020:                if (this .keepstable >= this .GSTABLE)
021:                    return;
022:                this .adapters.remove(null); // trick
023:                Reference ref;
024:                while ((ref = this .queue.poll()) != null) {
025:                    Object key = getAutoRefKey(ref);
026:                    switch (getAutoRefType(ref)) {
027:                    case JCLASS:
028:                        Class cl = (Class) key;
029:                        this .classes.remove(cl);
030:                        classesDec(cl.getName());
031:                        break;
032:                    case LAZY_JCLASS:
033:                        this .lazyClasses.remove(key);
034:                        break;
035:                    case ADAPTER_CLASS:
036:                        this .adapterClasses.remove(key);
037:                    }
038:                }
039:            }
040:
041:            protected boolean queryCanonical(String name) {
042:                cleanup();
043:                return super .queryCanonical(name);
044:            }
045:
046:            protected PyJavaClass getCanonical(Class c) {
047:                cleanup();
048:                Reference ref = (Reference) classesGet(c);
049:                if (ref == null)
050:                    return null;
051:                return (PyJavaClass) ref.get();
052:            }
053:
054:            protected PyJavaClass getLazyCanonical(String name) {
055:                cleanup();
056:                Reference ref = (Reference) this .lazyClasses.get(name);
057:                if (ref == null)
058:                    return null;
059:                return (PyJavaClass) ref.get();
060:            }
061:
062:            protected void putCanonical(Class c, PyJavaClass canonical) {
063:                cleanup();
064:                classesPut(c, newAutoRef(JCLASS, c, canonical));
065:            }
066:
067:            protected void putLazyCanonical(String name, PyJavaClass canonical) {
068:                cleanup();
069:                this .lazyClasses.put(name, newAutoRef(LAZY_JCLASS, name,
070:                        canonical));
071:            }
072:
073:            protected Class getAdapterClass(Class c) {
074:                cleanup();
075:                Reference ref = (Reference) this .adapterClasses.get(c);
076:                if (ref == null)
077:                    return null;
078:                return (Class) ref.get();
079:            }
080:
081:            protected void putAdapterClass(Class c, Class ac) {
082:                cleanup();
083:                this .adapterClasses.put(c, newAutoRef(ADAPTER_CLASS, c, ac));
084:            }
085:
086:            protected Object getAdapter(Object o, String evc) {
087:                cleanup();
088:                return super .getAdapter(o, evc);
089:            }
090:
091:            protected void putAdapter(Object o, String evc, Object ad) {
092:                cleanup();
093:                super .putAdapter(o, evc, ad);
094:            }
095:
096:            public boolean _doesSomeAutoUnload() {
097:                return true;
098:            }
099:
100:            public void _forceCleanup() {
101:                cleanup();
102:            }
103:
104:            public void _beginCanonical() {
105:                cleanup();
106:                super ._beginCanonical();
107:            }
108:
109:            public void _beginLazyCanonical() {
110:                cleanup();
111:                super ._beginLazyCanonical();
112:            }
113:
114:            public void _beginOverAdapterClasses() {
115:                cleanup();
116:                super ._beginOverAdapterClasses();
117:
118:            }
119:
120:            public void _beginOverAdapters() {
121:                cleanup();
122:                super ._beginOverAdapters();
123:            }
124:
125:            public Object _next() {
126:                if (this .iterType == ADAPTER) {
127:                    Object ret = super ._next();
128:                    if (ret != null)
129:                        return ret;
130:                } else {
131:                    while (this .iter.hasNext()) {
132:                        this .cur = this .iter.next();
133:                        switch (this .iterType) {
134:                        case JCLASS:
135:                            PyJavaClass jc = (PyJavaClass) ((Reference) this .cur)
136:                                    .get();
137:                            if (jc == null)
138:                                continue;
139:                            this .cur = jc;
140:                            return jc;
141:                        case LAZY_JCLASS:
142:                            PyJavaClass lazy = (PyJavaClass) ((Reference) this .cur)
143:                                    .get();
144:                            if (lazy == null)
145:                                continue;
146:                            return new _LazyRep(lazy.__name__, lazy.__mgr__);
147:                        case ADAPTER_CLASS:
148:                            Map.Entry entry = (Map.Entry) this .cur;
149:                            if (((Reference) entry.getValue()).get() == null)
150:                                continue;
151:                            return entry.getKey();
152:                        }
153:                    }
154:                    this .cur = null;
155:                    this .iter = null;
156:                    endStable();
157:                }
158:                cleanup();
159:                return null;
160:            }
161:
162:            public void _flush(PyJavaClass jc) {
163:                cleanup();
164:                super._flush(jc);
165:            }
166:
167:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.