Commit 47518cd388430798f710cd2367bafddb282e23d8
1 parent
7e161895
Fix per limite connessioni DB
Cambio configurazione c3p0 git-svn-id: http://svn.softecspa.it/desktopmate/DesktopMate%202.0/FileProxyServer/trunk@13404 edf0334f-4afc-450a-8f92-fe1409970e7d
Showing
13 changed files
with
89 additions
and
85 deletions
Show diff stats
WebContent/META-INF/LILIANA (web144db2).txt deleted
WebContent/META-INF/context.xml
| @@ -3,45 +3,43 @@ | @@ -3,45 +3,43 @@ | ||
| 3 | antiResourceLocking="false" | 3 | antiResourceLocking="false" |
| 4 | distributable="true" | 4 | distributable="true" |
| 5 | reloadable="false" crossContext="false"> | 5 | reloadable="false" crossContext="false"> |
| 6 | - | 6 | + |
| 7 | <Parameter name="localhost" value="yes" override="true" /> | 7 | <Parameter name="localhost" value="yes" override="true" /> |
| 8 | - <Parameter name="localhost.database" value="web144db2" override="true" /> | ||
| 9 | - <Parameter name="localhost.environment" value="liliana" override="true" /> | ||
| 10 | - <Parameter name="localhost.context" value="mwm.dev.ctsapplications.it/adt_test" override="true" /> | 8 | + <Parameter name="localhost.database" value="web77db12" override="true" /> |
| 9 | + <Parameter name="localhost.environment" value="jcluster" override="true" /> | ||
| 10 | + <Parameter name="localhost.context" value="mwm.ctsapplications.it/adt" override="true" /> | ||
| 11 | + | ||
| 11 | 12 | ||
| 12 | - | ||
| 13 | <!-- Default set of monitored resources --> | 13 | <!-- Default set of monitored resources --> |
| 14 | - <WatchedResource>WEB-INF/web.xml</WatchedResource> | 14 | + <WatchedResource>WEB-INF/web.xml</WatchedResource> |
| 15 | 15 | ||
| 16 | <!-- Uncomment this to disable session persistence across Tomcat restarts --> | 16 | <!-- Uncomment this to disable session persistence across Tomcat restarts --> |
| 17 | - <Manager pathname="" /> | 17 | + <Manager pathname="" /> |
| 18 | 18 | ||
| 19 | - | ||
| 20 | - <!-- SVILUPPO - ADT --> | 19 | + <!-- ADT --> |
| 21 | <Resource name="jdbc/mwm_app" | 20 | <Resource name="jdbc/mwm_app" |
| 22 | auth="Container" | 21 | auth="Container" |
| 23 | description="DB Connection" | 22 | description="DB Connection" |
| 24 | driverClass="com.mysql.jdbc.Driver" | 23 | driverClass="com.mysql.jdbc.Driver" |
| 25 | 24 | ||
| 26 | - initialPoolSize="2" | ||
| 27 | - minPoolSize="2" | 25 | + initialPoolSize="1" |
| 26 | + minPoolSize="1" | ||
| 28 | maxPoolSize="10" | 27 | maxPoolSize="10" |
| 29 | - acquireIncrement="2" | 28 | + acquireIncrement="1" |
| 30 | 29 | ||
| 31 | - checkoutTimeout="3600" | 30 | + checkoutTimeout="10000" |
| 32 | breakAfterAcquireFailure="false" | 31 | breakAfterAcquireFailure="false" |
| 33 | - maxIdleTimeExcessConnections = "30" | ||
| 34 | - maxIdleTime = "1800" | ||
| 35 | - maxConnectionAge="3600" | ||
| 36 | - idleConnectionTestPeriod="200" | 32 | + maxIdleTimeExcessConnections = "15" |
| 33 | + maxIdleTime = "30" | ||
| 34 | + maxConnectionAge="120" | ||
| 35 | + idleConnectionTestPeriod="30" | ||
| 37 | 36 | ||
| 38 | - user="web144u2" | ||
| 39 | - password="fdte5532" | 37 | + user="web77u12" |
| 38 | + password="Ghec56hj" | ||
| 40 | factory="org.apache.naming.factory.BeanFactory" | 39 | factory="org.apache.naming.factory.BeanFactory" |
| 41 | type="com.mchange.v2.c3p0.ComboPooledDataSource" | 40 | type="com.mchange.v2.c3p0.ComboPooledDataSource" |
| 42 | - jdbcUrl="jdbc:mysql://localhost:3306/web144db2?autoReconnect=true&characterEncoding=UTF-8" /> | ||
| 43 | - | ||
| 44 | - | 41 | + jdbcUrl="jdbc:mysql://localhost:3306/web77db12?autoReconnect=true&characterEncoding=UTF-8" /> |
| 42 | + | ||
| 45 | </Context> | 43 | </Context> |
| 46 | 44 | ||
| 47 | 45 |
conf/ADT/production/META-INF/context.xml
| @@ -15,17 +15,17 @@ | @@ -15,17 +15,17 @@ | ||
| 15 | description="DB Connection" | 15 | description="DB Connection" |
| 16 | driverClass="com.mysql.jdbc.Driver" | 16 | driverClass="com.mysql.jdbc.Driver" |
| 17 | 17 | ||
| 18 | - initialPoolSize="2" | ||
| 19 | - minPoolSize="2" | ||
| 20 | - maxPoolSize="10" | ||
| 21 | - acquireIncrement="2" | 18 | + initialPoolSize="1" |
| 19 | + minPoolSize="1" | ||
| 20 | + maxPoolSize="15" | ||
| 21 | + acquireIncrement="1" | ||
| 22 | 22 | ||
| 23 | - checkoutTimeout="3600" | 23 | + checkoutTimeout="10000" |
| 24 | breakAfterAcquireFailure="false" | 24 | breakAfterAcquireFailure="false" |
| 25 | - maxIdleTimeExcessConnections = "30" | ||
| 26 | - maxIdleTime = "1800" | ||
| 27 | - maxConnectionAge="3600" | ||
| 28 | - idleConnectionTestPeriod="200" | 25 | + maxIdleTimeExcessConnections = "15" |
| 26 | + maxIdleTime = "30" | ||
| 27 | + maxConnectionAge="120" | ||
| 28 | + idleConnectionTestPeriod="30" | ||
| 29 | 29 | ||
| 30 | user="web77u12" | 30 | user="web77u12" |
| 31 | password="Ghec56hj" | 31 | password="Ghec56hj" |
conf/ADT/production/WEB-INF/web.xml
| 1 | <?xml version="1.0" encoding="UTF-8"?> | 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | <web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> | 2 | <web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> |
| 3 | - <display-name>FileProxy 1.0.2 (17) - ADT/production [15/07/2014 14:39]</display-name> | 3 | + <display-name>FileProxy 1.0.3 (20) - ADT/production [30/07/2014 17:10]</display-name> |
| 4 | <!-- Ultime modifiche del 23/06/2014 --> | 4 | <!-- Ultime modifiche del 23/06/2014 --> |
| 5 | 5 | ||
| 6 | <!-- Configurazione per New Relic --> | 6 | <!-- Configurazione per New Relic --> |
| @@ -9,7 +9,7 @@ | @@ -9,7 +9,7 @@ | ||
| 9 | <param-value>FileProxyServer ADT (production)</param-value> | 9 | <param-value>FileProxyServer ADT (production)</param-value> |
| 10 | </context-param> | 10 | </context-param> |
| 11 | 11 | ||
| 12 | - <!-- ADT/production - 15/07/2014 14:39 --> | 12 | + <!-- ADT/production - 30/07/2014 17:10 --> |
| 13 | <!-- Configurazioni obbligatorie --> | 13 | <!-- Configurazioni obbligatorie --> |
| 14 | <context-param> | 14 | <context-param> |
| 15 | <param-name>ErrorPage</param-name> | 15 | <param-name>ErrorPage</param-name> |
conf/ADT/production/version.xml
| @@ -3,10 +3,10 @@ | @@ -3,10 +3,10 @@ | ||
| 3 | <properties> | 3 | <properties> |
| 4 | <comment>Version information</comment> | 4 | <comment>Version information</comment> |
| 5 | 5 | ||
| 6 | - <entry key="version.number">1.0.2</entry> | 6 | + <entry key="version.number">1.0.3</entry> |
| 7 | <entry key="version.release"></entry> | 7 | <entry key="version.release"></entry> |
| 8 | - <entry key="build.number">17</entry> | ||
| 9 | - <entry key="build.date">15/07/2014 14:39</entry> | 8 | + <entry key="build.number">20</entry> |
| 9 | + <entry key="build.date">30/07/2014 17:10</entry> | ||
| 10 | <entry key="build.installation">ADT/production</entry> | 10 | <entry key="build.installation">ADT/production</entry> |
| 11 | 11 | ||
| 12 | </properties> | 12 | </properties> |
conf/ADT/test-liliana/META-INF/context.xml
| @@ -18,17 +18,17 @@ | @@ -18,17 +18,17 @@ | ||
| 18 | description="DB Connection" | 18 | description="DB Connection" |
| 19 | driverClass="com.mysql.jdbc.Driver" | 19 | driverClass="com.mysql.jdbc.Driver" |
| 20 | 20 | ||
| 21 | - initialPoolSize="2" | ||
| 22 | - minPoolSize="2" | 21 | + initialPoolSize="1" |
| 22 | + minPoolSize="1" | ||
| 23 | maxPoolSize="10" | 23 | maxPoolSize="10" |
| 24 | - acquireIncrement="2" | 24 | + acquireIncrement="1" |
| 25 | 25 | ||
| 26 | - checkoutTimeout="3600" | 26 | + checkoutTimeout="10000" |
| 27 | breakAfterAcquireFailure="false" | 27 | breakAfterAcquireFailure="false" |
| 28 | - maxIdleTimeExcessConnections = "30" | ||
| 29 | - maxIdleTime = "1800" | ||
| 30 | - maxConnectionAge="3600" | ||
| 31 | - idleConnectionTestPeriod="200" | 28 | + maxIdleTimeExcessConnections = "15" |
| 29 | + maxIdleTime = "30" | ||
| 30 | + maxConnectionAge="120" | ||
| 31 | + idleConnectionTestPeriod="30" | ||
| 32 | 32 | ||
| 33 | user="web144u2" | 33 | user="web144u2" |
| 34 | password="fdte5532" | 34 | password="fdte5532" |
conf/ADT/test-liliana/WEB-INF/web.xml
| 1 | <?xml version="1.0" encoding="UTF-8"?> | 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | <web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> | 2 | <web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> |
| 3 | - <display-name>FileProxy 1.0.2 (11) - ADT/test-liliana [07/07/2014 15:08]</display-name> | 3 | + <display-name>FileProxy 1.0.3 (21) - ADT/test-liliana [30/07/2014 17:15]</display-name> |
| 4 | <!-- Ultime modifiche del 23/06/2014 --> | 4 | <!-- Ultime modifiche del 23/06/2014 --> |
| 5 | 5 | ||
| 6 | <!-- Configurazione per New Relic --> | 6 | <!-- Configurazione per New Relic --> |
| @@ -9,7 +9,7 @@ | @@ -9,7 +9,7 @@ | ||
| 9 | <param-value>FileProxyServer ADT (test)</param-value> | 9 | <param-value>FileProxyServer ADT (test)</param-value> |
| 10 | </context-param> | 10 | </context-param> |
| 11 | 11 | ||
| 12 | - <!-- ADT/test-liliana - 07/07/2014 15:08 --> | 12 | + <!-- ADT/test-liliana - 30/07/2014 17:15 --> |
| 13 | <!-- Configurazioni obbligatorie --> | 13 | <!-- Configurazioni obbligatorie --> |
| 14 | <context-param> | 14 | <context-param> |
| 15 | <param-name>ErrorPage</param-name> | 15 | <param-name>ErrorPage</param-name> |
conf/ADT/test-liliana/version.xml
| @@ -3,10 +3,10 @@ | @@ -3,10 +3,10 @@ | ||
| 3 | <properties> | 3 | <properties> |
| 4 | <comment>Version information</comment> | 4 | <comment>Version information</comment> |
| 5 | 5 | ||
| 6 | - <entry key="version.number">1.0.2</entry> | 6 | + <entry key="version.number">1.0.3</entry> |
| 7 | <entry key="version.release"></entry> | 7 | <entry key="version.release"></entry> |
| 8 | - <entry key="build.number">11</entry> | ||
| 9 | - <entry key="build.date">07/07/2014 15:08</entry> | 8 | + <entry key="build.number">21</entry> |
| 9 | + <entry key="build.date">30/07/2014 17:15</entry> | ||
| 10 | <entry key="build.installation">ADT/test-liliana</entry> | 10 | <entry key="build.installation">ADT/test-liliana</entry> |
| 11 | 11 | ||
| 12 | </properties> | 12 | </properties> |
conf/myMETA-INF/context-jcluster-web77db12.xml
| @@ -22,17 +22,17 @@ | @@ -22,17 +22,17 @@ | ||
| 22 | description="DB Connection" | 22 | description="DB Connection" |
| 23 | driverClass="com.mysql.jdbc.Driver" | 23 | driverClass="com.mysql.jdbc.Driver" |
| 24 | 24 | ||
| 25 | - initialPoolSize="2" | ||
| 26 | - minPoolSize="2" | 25 | + initialPoolSize="1" |
| 26 | + minPoolSize="1" | ||
| 27 | maxPoolSize="10" | 27 | maxPoolSize="10" |
| 28 | - acquireIncrement="2" | 28 | + acquireIncrement="1" |
| 29 | 29 | ||
| 30 | - checkoutTimeout="3600" | 30 | + checkoutTimeout="10000" |
| 31 | breakAfterAcquireFailure="false" | 31 | breakAfterAcquireFailure="false" |
| 32 | - maxIdleTimeExcessConnections = "30" | ||
| 33 | - maxIdleTime = "1800" | ||
| 34 | - maxConnectionAge="3600" | ||
| 35 | - idleConnectionTestPeriod="200" | 32 | + maxIdleTimeExcessConnections = "15" |
| 33 | + maxIdleTime = "30" | ||
| 34 | + maxConnectionAge="120" | ||
| 35 | + idleConnectionTestPeriod="30" | ||
| 36 | 36 | ||
| 37 | user="web77u12" | 37 | user="web77u12" |
| 38 | password="Ghec56hj" | 38 | password="Ghec56hj" |
conf/myMETA-INF/context-liliana-web144db2.xml
| @@ -23,17 +23,17 @@ | @@ -23,17 +23,17 @@ | ||
| 23 | description="DB Connection" | 23 | description="DB Connection" |
| 24 | driverClass="com.mysql.jdbc.Driver" | 24 | driverClass="com.mysql.jdbc.Driver" |
| 25 | 25 | ||
| 26 | - initialPoolSize="2" | ||
| 27 | - minPoolSize="2" | 26 | + initialPoolSize="1" |
| 27 | + minPoolSize="1" | ||
| 28 | maxPoolSize="10" | 28 | maxPoolSize="10" |
| 29 | - acquireIncrement="2" | 29 | + acquireIncrement="1" |
| 30 | 30 | ||
| 31 | - checkoutTimeout="3600" | 31 | + checkoutTimeout="10000" |
| 32 | breakAfterAcquireFailure="false" | 32 | breakAfterAcquireFailure="false" |
| 33 | - maxIdleTimeExcessConnections = "30" | ||
| 34 | - maxIdleTime = "1800" | ||
| 35 | - maxConnectionAge="3600" | ||
| 36 | - idleConnectionTestPeriod="200" | 33 | + maxIdleTimeExcessConnections = "15" |
| 34 | + maxIdleTime = "30" | ||
| 35 | + maxConnectionAge="120" | ||
| 36 | + idleConnectionTestPeriod="30" | ||
| 37 | 37 | ||
| 38 | user="web144u2" | 38 | user="web144u2" |
| 39 | password="fdte5532" | 39 | password="fdte5532" |
conf/version.properties
| 1 | #Build Number for ANT. Do not edit! | 1 | #Build Number for ANT. Do not edit! |
| 2 | -#Tue Jul 15 14:39:20 CEST 2014 | ||
| 3 | -build.number=18 | 2 | +#Wed Jul 30 17:15:29 CEST 2014 |
| 3 | +build.number=22 | ||
| 4 | version.release= | 4 | version.release= |
| 5 | -build.date=15/07/2014 14\:39 | ||
| 6 | -version.number=1.0.2 | 5 | +build.date=30/07/2014 17\:15 |
| 6 | +version.number=1.0.3 |
src/it/softecspa/fileproxy/proxyservices/manager/core/WorkflowSession.java
| @@ -2,6 +2,7 @@ package it.softecspa.fileproxy.proxyservices.manager.core; | @@ -2,6 +2,7 @@ package it.softecspa.fileproxy.proxyservices.manager.core; | ||
| 2 | 2 | ||
| 3 | import it.softecspa.database.dbconnect.ConnectionManager; | 3 | import it.softecspa.database.dbconnect.ConnectionManager; |
| 4 | import it.softecspa.database.dbconnect.DatabaseStatementUnplugged; | 4 | import it.softecspa.database.dbconnect.DatabaseStatementUnplugged; |
| 5 | +import it.softecspa.database.dbconnect.NoRecordFoundException; | ||
| 5 | import it.softecspa.fileproxy.proxyservices.core.GlobalHttpProxyRequest; | 6 | import it.softecspa.fileproxy.proxyservices.core.GlobalHttpProxyRequest; |
| 6 | import it.softecspa.fileproxy.services.ServerCacheFactory; | 7 | import it.softecspa.fileproxy.services.ServerCacheFactory; |
| 7 | import it.softecspa.fileproxy.services.common.CheckerException; | 8 | import it.softecspa.fileproxy.services.common.CheckerException; |
| @@ -10,9 +11,11 @@ import it.softecspa.fileproxy.services.common.ResponseOutcome; | @@ -10,9 +11,11 @@ import it.softecspa.fileproxy.services.common.ResponseOutcome; | ||
| 10 | import it.softecspa.fileproxy.services.common.core.UniversalSession; | 11 | import it.softecspa.fileproxy.services.common.core.UniversalSession; |
| 11 | import it.softecspa.jwebber.bo.Utente; | 12 | import it.softecspa.jwebber.bo.Utente; |
| 12 | import it.softecspa.kahuna.lang.XString; | 13 | import it.softecspa.kahuna.lang.XString; |
| 14 | +import it.softecspa.mvc.businessobject.DatabaseManager; | ||
| 13 | import it.softecspa.mvc.exceptions.AuthenticationException; | 15 | import it.softecspa.mvc.exceptions.AuthenticationException; |
| 14 | import it.softecspa.portal.Parameters; | 16 | import it.softecspa.portal.Parameters; |
| 15 | 17 | ||
| 18 | +import java.sql.Connection; | ||
| 16 | import java.sql.SQLException; | 19 | import java.sql.SQLException; |
| 17 | 20 | ||
| 18 | public class WorkflowSession<I extends GlobalHttpProxyRequest> extends UniversalSession<I> { | 21 | public class WorkflowSession<I extends GlobalHttpProxyRequest> extends UniversalSession<I> { |
| @@ -45,32 +48,35 @@ public class WorkflowSession<I extends GlobalHttpProxyRequest> extends Universal | @@ -45,32 +48,35 @@ public class WorkflowSession<I extends GlobalHttpProxyRequest> extends Universal | ||
| 45 | throw new ManagerException("Error encoding password",e); | 48 | throw new ManagerException("Error encoding password",e); |
| 46 | } | 49 | } |
| 47 | 50 | ||
| 48 | - DatabaseStatementUnplugged dbsu; | 51 | + |
| 52 | + | ||
| 53 | + Connection connection = null; | ||
| 49 | try { | 54 | try { |
| 50 | - dbsu = DatabaseStatementUnplugged.getInstance(cmReadonly); | ||
| 51 | - utente.login(dbsu.getConnection()); | ||
| 52 | - | ||
| 53 | - Parameters parameters = Parameters.getInstance(); | ||
| 54 | - | ||
| 55 | - if (!utente.hasPolicy(parameters.get("POL_SA","SA")) && | ||
| 56 | - !utente.hasPolicy(parameters.get("POL_UP_DOWN","UP_DOWN"))) { | ||
| 57 | - // Utente con polici non valida | ||
| 58 | - log.error("Not valid policy for username '"+request.getUsername()+"'"); | ||
| 59 | - throw new CheckerException(ResponseOutcome.USER_POLICY_NO_VALID); | ||
| 60 | - } | ||
| 61 | - | 55 | + connection = DatabaseManager.getInstance().getConnection(); |
| 56 | + utente.login(connection); | ||
| 62 | } catch (SQLException e) { | 57 | } catch (SQLException e) { |
| 63 | throw new ManagerException(e); | 58 | throw new ManagerException(e); |
| 64 | - | ||
| 65 | } catch (AuthenticationException e) { | 59 | } catch (AuthenticationException e) { |
| 66 | log.error("Error check credential with username '"+request.getUsername()+"': "+e.getMessage()); | 60 | log.error("Error check credential with username '"+request.getUsername()+"': "+e.getMessage()); |
| 67 | // Username/Password non validi | 61 | // Username/Password non validi |
| 68 | throw new CheckerException(ResponseOutcome.USER_PASSWORD_NO_VALID); | 62 | throw new CheckerException(ResponseOutcome.USER_PASSWORD_NO_VALID); |
| 69 | - | ||
| 70 | } catch (Exception e) { | 63 | } catch (Exception e) { |
| 71 | log.error("Error in check user checking",e); | 64 | log.error("Error in check user checking",e); |
| 72 | throw new CheckerException(ResponseOutcome.USER_NOT_VERIFY_RETRY); | 65 | throw new CheckerException(ResponseOutcome.USER_NOT_VERIFY_RETRY); |
| 66 | + } finally { | ||
| 67 | + DatabaseManager.closeConnection(connection); | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + Parameters parameters = Parameters.getInstance(); | ||
| 71 | + | ||
| 72 | + if (!utente.hasPolicy(parameters.get("POL_SA","SA")) && | ||
| 73 | + !utente.hasPolicy(parameters.get("POL_UP_DOWN","UP_DOWN"))) { | ||
| 74 | + // Utente con polici non valida | ||
| 75 | + log.error("Not valid policy for username '"+request.getUsername()+"'"); | ||
| 76 | + throw new CheckerException(ResponseOutcome.USER_POLICY_NO_VALID); | ||
| 73 | } | 77 | } |
| 78 | + | ||
| 79 | + | ||
| 74 | 80 | ||
| 75 | 81 | ||
| 76 | } | 82 | } |