View | Details | Raw Unified | Return to bug 56382
Collapse All | Expand All

(-)java/org/apache/catalina/startup/HostConfig.java (-4 / +22 lines)
Lines 605-613 Link Here
605
605
606
        DeployedApplication deployedApp =
606
        DeployedApplication deployedApp =
607
                new DeployedApplication(cn.getName(), true);
607
                new DeployedApplication(cn.getName(), true);
608
608
        long startTime = 0;
609
        // Assume this is a configuration descriptor and deploy it
609
        // Assume this is a configuration descriptor and deploy it
610
        if(log.isInfoEnabled()) {
610
        if(log.isInfoEnabled()) {
611
            startTime = System.currentTimeMillis();
611
            log.info(sm.getString("hostConfig.deployDescriptor",
612
            log.info(sm.getString("hostConfig.deployDescriptor",
612
                    contextXml.getAbsolutePath()));
613
                    contextXml.getAbsolutePath()));
613
        }
614
        }
Lines 744-749 Link Here
744
        if (host.findChild(context.getName()) != null) {
745
        if (host.findChild(context.getName()) != null) {
745
            deployed.put(context.getName(), deployedApp);
746
            deployed.put(context.getName(), deployedApp);
746
        }
747
        }
748
        if (log.isInfoEnabled()) {
749
            log.info(sm.getString("hostConfig.deployDescriptor.finished",
750
                contextXml.getAbsolutePath(), Long.valueOf(System.currentTimeMillis() - startTime)));
751
        }
747
    }
752
    }
748
753
749
754
Lines 864-869 Link Here
864
        InputStream istream = null;
869
        InputStream istream = null;
865
        FileOutputStream fos = null;
870
        FileOutputStream fos = null;
866
        BufferedOutputStream ostream = null;
871
        BufferedOutputStream ostream = null;
872
        long startTime = 0;
867
873
868
        File xml = new File(appBase(),
874
        File xml = new File(appBase(),
869
                cn.getBaseName() + "/META-INF/context.xml");
875
                cn.getBaseName() + "/META-INF/context.xml");
Lines 1041-1049 Link Here
1041
                xml.exists() && deployXML && copyThisXml);
1047
                xml.exists() && deployXML && copyThisXml);
1042
1048
1043
        // Deploy the application in this WAR file
1049
        // Deploy the application in this WAR file
1044
        if(log.isInfoEnabled())
1050
        if(log.isInfoEnabled()) {
1051
            startTime = System.currentTimeMillis();
1045
            log.info(sm.getString("hostConfig.deployWar",
1052
            log.info(sm.getString("hostConfig.deployWar",
1046
                    war.getAbsolutePath()));
1053
                    war.getAbsolutePath()));
1054
        }
1047
1055
1048
        try {
1056
        try {
1049
            // Populate redeploy resources with the WAR file
1057
            // Populate redeploy resources with the WAR file
Lines 1099-1104 Link Here
1099
        }
1107
        }
1100
1108
1101
        deployed.put(cn.getName(), deployedApp);
1109
        deployed.put(cn.getName(), deployedApp);
1110
        if (log.isInfoEnabled()) {
1111
            log.info(sm.getString("hostConfig.deployWar.finished",
1112
                war.getAbsolutePath(), Long.valueOf(System.currentTimeMillis() - startTime)));
1113
        }
1102
    }
1114
    }
1103
1115
1104
1116
Lines 1147-1157 Link Here
1147
     */
1159
     */
1148
    protected void deployDirectory(ContextName cn, File dir) {
1160
    protected void deployDirectory(ContextName cn, File dir) {
1149
1161
1150
1162
        long startTime = 0;
1151
        // Deploy the application in this directory
1163
        // Deploy the application in this directory
1152
        if( log.isInfoEnabled() )
1164
        if( log.isInfoEnabled() ) {
1165
            startTime = System.currentTimeMillis();
1153
            log.info(sm.getString("hostConfig.deployDir",
1166
            log.info(sm.getString("hostConfig.deployDir",
1154
                    dir.getAbsolutePath()));
1167
                    dir.getAbsolutePath()));
1168
        }
1155
1169
1156
        Context context = null;
1170
        Context context = null;
1157
        File xml = new File(dir, Constants.ApplicationContextXml);
1171
        File xml = new File(dir, Constants.ApplicationContextXml);
Lines 1275-1280 Link Here
1275
        }
1289
        }
1276
1290
1277
        deployed.put(cn.getName(), deployedApp);
1291
        deployed.put(cn.getName(), deployedApp);
1292
        if( log.isInfoEnabled() ) {
1293
            log.info(sm.getString("hostConfig.deployDir.finished",
1294
                    dir.getAbsolutePath(), Long.valueOf(System.currentTimeMillis() - startTime)));
1295
        }
1278
    }
1296
    }
1279
1297
1280
1298
(-)java/org/apache/catalina/startup/LocalStrings.properties (+3 lines)
Lines 88-101 Link Here
88
hostConfig.createDirs=Unable to create directory for deployment: {0}
88
hostConfig.createDirs=Unable to create directory for deployment: {0}
89
hostConfig.deploy=Deploying web application directory {0}
89
hostConfig.deploy=Deploying web application directory {0}
90
hostConfig.deployDescriptor=Deploying configuration descriptor {0}
90
hostConfig.deployDescriptor=Deploying configuration descriptor {0}
91
hostConfig.deployDescriptor.finished=Deployment of configuration descriptor {0} has finished in {1} ms
91
hostConfig.deployDescriptor.blocked=The web application with context path [{0}] was not deployed because it contained a deployment descriptor [{1}] which may include configuration necessary for the secure deployment of the application but processing of deployment descriptors is prevented by the deployXML setting of this host. An appropriate descriptor should be created at [{2}] to deploy this application.
92
hostConfig.deployDescriptor.blocked=The web application with context path [{0}] was not deployed because it contained a deployment descriptor [{1}] which may include configuration necessary for the secure deployment of the application but processing of deployment descriptors is prevented by the deployXML setting of this host. An appropriate descriptor should be created at [{2}] to deploy this application.
92
hostConfig.deployDescriptor.error=Error deploying configuration descriptor {0}
93
hostConfig.deployDescriptor.error=Error deploying configuration descriptor {0}
93
hostConfig.deployDescriptor.threaded.error=Error waiting for multi-thread deployment of context descriptors to complete
94
hostConfig.deployDescriptor.threaded.error=Error waiting for multi-thread deployment of context descriptors to complete
94
hostConfig.deployDescriptor.localDocBaseSpecified=A docBase {0} inside the host appBase has been specified, and will be ignored
95
hostConfig.deployDescriptor.localDocBaseSpecified=A docBase {0} inside the host appBase has been specified, and will be ignored
95
hostConfig.deployDir=Deploying web application directory {0}
96
hostConfig.deployDir=Deploying web application directory {0}
97
hostConfig.deployDir.finished=Deployment of web application directory {0} has finished in {1} ms
96
hostConfig.deployDir.error=Error deploying web application directory {0}
98
hostConfig.deployDir.error=Error deploying web application directory {0}
97
hostConfig.deployDir.threaded.error=Error waiting for multi-thread deployment of directories to complete
99
hostConfig.deployDir.threaded.error=Error waiting for multi-thread deployment of directories to complete
98
hostConfig.deployWar=Deploying web application archive {0}
100
hostConfig.deployWar=Deploying web application archive {0}
101
hostConfig.deployWar.finished=Deployment of web application archive {0} has finished in {1} ms
99
hostConfig.deployWar.error=Error deploying web application archive {0}
102
hostConfig.deployWar.error=Error deploying web application archive {0}
100
hostConfig.deployWar.hiddenDir=The directory [{0}] will be ignored because the WAR [{1}] takes priority and unpackWARs is false
103
hostConfig.deployWar.hiddenDir=The directory [{0}] will be ignored because the WAR [{1}] takes priority and unpackWARs is false
101
hostConfig.deployWar.threaded.error=Error waiting for multi-thread deployment of WAR files to complete
104
hostConfig.deployWar.threaded.error=Error waiting for multi-thread deployment of WAR files to complete
(-)modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/StatementFinalizer.java (-10 / +46 lines)
Lines 20-29 Link Here
20
import java.lang.reflect.Method;
20
import java.lang.reflect.Method;
21
import java.sql.Statement;
21
import java.sql.Statement;
22
import java.util.ArrayList;
22
import java.util.ArrayList;
23
import java.util.Map;
23
24
24
import org.apache.juli.logging.Log;
25
import org.apache.juli.logging.Log;
25
import org.apache.juli.logging.LogFactory;
26
import org.apache.juli.logging.LogFactory;
26
import org.apache.tomcat.jdbc.pool.ConnectionPool;
27
import org.apache.tomcat.jdbc.pool.ConnectionPool;
28
import org.apache.tomcat.jdbc.pool.PoolProperties;
27
import org.apache.tomcat.jdbc.pool.PooledConnection;
29
import org.apache.tomcat.jdbc.pool.PooledConnection;
28
/**
30
/**
29
 * Keeps track of statements associated with a connection and invokes close upon {@link java.sql.Connection#close()}
31
 * Keeps track of statements associated with a connection and invokes close upon {@link java.sql.Connection#close()}
Lines 34-48 Link Here
34
public class StatementFinalizer extends AbstractCreateStatementInterceptor {
36
public class StatementFinalizer extends AbstractCreateStatementInterceptor {
35
    private static final Log log = LogFactory.getLog(StatementFinalizer.class);
37
    private static final Log log = LogFactory.getLog(StatementFinalizer.class);
36
38
37
    protected ArrayList<WeakReference<Statement>> statements = new ArrayList<WeakReference<Statement>>();
39
    private boolean logCreationStack = false;
38
40
41
    protected ArrayList<WeakReference<StatementEntry>> statements = new ArrayList<WeakReference<StatementEntry>>();
42
39
    @Override
43
    @Override
40
    public Object createStatement(Object proxy, Method method, Object[] args, Object statement, long time) {
44
    public Object createStatement(Object proxy, Method method, Object[] args, Object statement, long time) {
41
        try {
45
        if (statement instanceof Statement) {
42
            if (statement instanceof Statement)
46
            statements.add(new WeakReference<StatementEntry>(new StatementEntry((Statement) statement)));
43
                statements.add(new WeakReference<Statement>((Statement)statement));
44
        }catch (ClassCastException x) {
45
            //ignore this one
46
        }
47
        }
47
        return statement;
48
        return statement;
48
    }
49
    }
Lines 50-60 Link Here
50
    @Override
51
    @Override
51
    public void closeInvoked() {
52
    public void closeInvoked() {
52
        while (statements.size()>0) {
53
        while (statements.size()>0) {
53
            WeakReference<Statement> ws = statements.remove(0);
54
            WeakReference<StatementEntry> ws = statements.remove(0);
54
            Statement st = ws.get();
55
            StatementEntry se = ws.get();
55
            if (st!=null) {
56
            if (se!=null) {
57
                Statement st = se.getStatement();
56
                try {
58
                try {
57
                    st.close();
59
                    if (!st.isClosed()) {
60
                        if (logCreationStack) {
61
                            log.warn("Statement created, but was not closed ", se.getAllocationStack());
62
                        }
63
                        st.close();
64
                    }
58
                } catch (Exception ignore) {
65
                } catch (Exception ignore) {
59
                    if (log.isDebugEnabled()) {
66
                    if (log.isDebugEnabled()) {
60
                        log.debug("Unable to closed statement upon connection close.",ignore);
67
                        log.debug("Unable to closed statement upon connection close.",ignore);
Lines 65-70 Link Here
65
    }
72
    }
66
73
67
    @Override
74
    @Override
75
    public void setProperties(Map<String, PoolProperties.InterceptorProperty> properties) {
76
        super.setProperties(properties);
77
78
        PoolProperties.InterceptorProperty logProperty = properties.get("logCreationStack");
79
        if (null != logProperty) {
80
            logCreationStack = logProperty.getValueAsBoolean(logCreationStack);
81
        }
82
    }
83
84
    @Override
68
    public void reset(ConnectionPool parent, PooledConnection con) {
85
    public void reset(ConnectionPool parent, PooledConnection con) {
69
        statements.clear();
86
        statements.clear();
70
        super.reset(parent, con);
87
        super.reset(parent, con);
Lines 71-74 Link Here
71
    }
88
    }
72
89
73
90
91
    protected class StatementEntry {
92
        private Statement statement;
93
        private Throwable allocationStack;
94
95
        public StatementEntry(Statement statement) {
96
            this.statement = statement;
97
            if (logCreationStack) {
98
                this.allocationStack = new Throwable();
99
            }
100
        }
101
102
        public Statement getStatement() {
103
            return statement;
104
        }
105
106
        public Throwable getAllocationStack() {
107
            return allocationStack;
108
        }
109
    }
74
}
110
}

Return to bug 56382