Package KFM.Exceptions

Examples of KFM.Exceptions.KFMException


        // Check for the presence of the required attributes

        if (tJdbcDriver == null || tJdbcConnectionURL == null || tJdbcUser == null ||
            tJdbcPassword == null || tLogFile == null || tOriginator == null) {
             throw new KFMException("KFM_DbConnectionBrokerPool::init: Some required pool attribute missing.");
        }

        // Set the defaults for the optional attributes if they were not provided

        int tMinConnectionsNr = 2;
        String tMinConnections = (String) poolAttributes.get("MinConnections");
        if (tMinConnections != null) {
            try {
                tMinConnectionsNr = Integer.parseInt(tMinConnections);
            } catch (NumberFormatException ex) {}
        }

        int tMaxConnectionsNr = 5;
        String tMaxConnections = (String) poolAttributes.get("MaxConnections");
        if (tMaxConnections != null) {
            try {
                tMaxConnectionsNr = Integer.parseInt(tMaxConnections);
            } catch (NumberFormatException ex) {}
        }

        double tMaxConnectionsTimeNr = 7.0;
        String tMaxConnectionTime = (String) poolAttributes.get("MaxConnectionTime");
        if (tMaxConnectionTime != null) {
            try {
                tMaxConnectionsTimeNr = Double.valueOf(tMaxConnectionTime).doubleValue();
            } catch (NumberFormatException ex) {}
        }

        try {
            KFMLog tLog = KFMLog.getInstance(tOriginator, tLogFile, KFMLog.ERROR_LEVEL,
                    // Hack but works.
                    KFMSystem.log.getAdminMail(), KFMSystem.log.getMailHost());
            mDbConnectionBroker = new DbConnectionBroker(
                tJdbcDriver,
                tJdbcConnectionURL,
                tJdbcUser,
                tJdbcPassword,
                tMinConnectionsNr,
                tMaxConnectionsNr,
                tLog,
                tMaxConnectionsTimeNr);
        } catch(IOException e1) {
            throw new KFMException(e1, "KFM_DbConnectionBrokerPool::init: Failed to initialize DbConnectionBroker.");
        } catch(ClassNotFoundException e2) {
            throw new KFMException(e2, "KFM_DbConnectionBrokerPool::init: Failed to initialize DbConnectionBroker.");
        }
    }
View Full Code Here

TOP

Related Classes of KFM.Exceptions.KFMException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.