Source Code Cross Referenced for ArcSDEConnectionPoolFactory.java in  » GIS » GeoTools-2.4.1 » org » geotools » arcsde » pool » 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 » GIS » GeoTools 2.4.1 » org.geotools.arcsde.pool 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *    Geotools2 - OpenSource mapping toolkit
003:         *    http://geotools.org
004:         *    (C) 2002-2006, Geotools Project Managment Committee (PMC)
005:         *
006:         *    This library is free software; you can redistribute it and/or
007:         *    modify it under the terms of the GNU Lesser General Public
008:         *    License as published by the Free Software Foundation;
009:         *    version 2.1 of the License.
010:         *
011:         *    This library is distributed in the hope that it will be useful,
012:         *    but WITHOUT ANY WARRANTY; without even the implied warranty of
013:         *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014:         *    Lesser General Public License for more details.
015:         *
016:         */
017:        package org.geotools.arcsde.pool;
018:
019:        import java.util.HashMap;
020:        import java.util.Iterator;
021:        import java.util.Map;
022:        import java.util.logging.Logger;
023:
024:        import org.geotools.data.DataSourceException;
025:
026:        /**
027:         * Singleton factory that maintains a single
028:         * {@link ArcSDEConnectionPool connection pool} per set of
029:         * {@link ArcSDEConnectionConfig connection parameters}.
030:         * 
031:         * @author Gabriel Roldan
032:         * @source $URL:
033:         *         http://svn.geotools.org/geotools/trunk/gt/modules/unsupported/arcsde/datastore/src/main/java/org/geotools/arcsde/pool/ArcSDEConnectionPoolFactory.java $
034:         * @version $Id: ArcSDEConnectionPoolFactory.java 24660 2007-03-02 16:10:44Z
035:         *          saul.farber $
036:         */
037:        public class ArcSDEConnectionPoolFactory {
038:            /** package logger */
039:            private static Logger LOGGER = org.geotools.util.logging.Logging
040:                    .getLogger(ArcSDEConnectionPoolFactory.class.getPackage()
041:                            .getName());
042:
043:            /** singleton pool factory */
044:            private static final ArcSDEConnectionPoolFactory singleton = new ArcSDEConnectionPoolFactory();
045:
046:            /**
047:             * Map{ArcSDEConnectionConfig,ArcSDEConnectionPool} with per config
048:             * connection pool
049:             */
050:            private final Map currentPools = new HashMap();
051:
052:            /**
053:             * Creates a new SdeConnectionPoolFactory object.
054:             */
055:            private ArcSDEConnectionPoolFactory() {
056:                // intentionally blank
057:            }
058:
059:            /**
060:             * Returns a connection pool factory instance
061:             * 
062:             * @return the connection pool factory singleton
063:             */
064:            public synchronized static ArcSDEConnectionPoolFactory getInstance() {
065:                return singleton;
066:            }
067:
068:            /**
069:             * Creates a connection pool factory for the given connection parameters, or
070:             * returns the existing one if there already exists one for that set of
071:             * connection params.
072:             * 
073:             * @param config
074:             *             contains the connection parameters and pool preferences
075:             * 
076:             * @return a pool for the given connection parameters, wether it already
077:             *         existed or had to be created.
078:             * 
079:             * @throws DataSourceException
080:             *             if the pool needs but can't be created
081:             */
082:            public synchronized ArcSDEConnectionPool createPool(
083:                    ArcSDEConnectionConfig config) throws DataSourceException {
084:                ArcSDEConnectionPool pool = (ArcSDEConnectionPool) this .currentPools
085:                        .get(config);
086:
087:                if (pool == null) {
088:                    // the new pool will be populated with config.minConnections
089:                    // connections
090:                    pool = new ArcSDEConnectionPool(config);
091:                    this .currentPools.put(config, pool);
092:                }
093:
094:                return pool;
095:            }
096:
097:            /**
098:             * Closes and removes all the existing connection pools
099:             */
100:            public void clear() {
101:                closeAll();
102:                this .currentPools.clear();
103:                LOGGER.fine("sde connection pools creared");
104:            }
105:
106:            /**
107:             * loses all the available connection pools
108:             */
109:            private void closeAll() {
110:                for (Iterator it = this .currentPools.values().iterator(); it
111:                        .hasNext();) {
112:                    ((ArcSDEConnectionPool) it.next()).close();
113:                }
114:            }
115:
116:            /**
117:             * Ensures proper closure of connection pools at this object's finalization
118:             * stage.
119:             */
120:            public void finalize() {
121:                closeAll();
122:            }
123:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.