bloritsch 01/01/29 11:12:12
Modified: src/org/apache/cocoon/components/datasource Tag: xml-cocoon2
JdbcConnectionPool.java
src/org/apache/cocoon/components/language/programming/java
Tag: xml-cocoon2 JavaLanguage.java
Log:
Fixed some errors in the compilation--NullPointer if a compilation error
occured.
Altered the Jdbc DataSource Pool
Revision Changes Path
No revision
No revision
1.1.2.5 +13 -5
xml-cocoon/src/org/apache/cocoon/components/datasource/Attic/JdbcConnectionPool.java
Index: JdbcConnectionPool.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/components/datasource/Attic/JdbcConnectionPool.java,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -u -r1.1.2.4 -r1.1.2.5
--- JdbcConnectionPool.java 2001/01/22 21:56:34 1.1.2.4
+++ JdbcConnectionPool.java 2001/01/29 19:12:01 1.1.2.5
@@ -26,7 +26,7 @@
* thread to manage the number of SQL Connections.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a>
- * @version CVS $Revision: 1.1.2.4 $ $Date: 2001/01/22 21:56:34 $
+ * @version CVS $Revision: 1.1.2.5 $ $Date: 2001/01/29 19:12:01 $
*/
public class JdbcConnectionPool implements Pool, Runnable, Disposable,
Loggable, Initializable {
private final String dburl;
@@ -140,17 +140,25 @@
if (this.ready.size() < this.min) {
log.debug("There are not enough Connections for pool: " +
this.dburl);
while ((this.ready.size() < this.min) && (this.currentCount
< this.max)) {
- this.ready.add(this.createJdbcConnection());
+ synchronized (this.ready) {
+ this.ready.add(this.createJdbcConnection());
+ }
}
- } else {
+ }
+
+ if (this.ready.size() > this.min) {
log.debug("Trimming excess fat from pool: " + this.dburl);
while (this.ready.size() > this.min) {
- this.recycle((Recyclable) this.ready.remove(0));
+ synchronized (this.ready) {
+ this.recycle((Recyclable) this.ready.remove(0));
+ }
+
+ log.debug("JdbcConnection '" + this.dburl + "' has been
removed from the pool.");
}
}
try {
- Thread.sleep(1 * 60 * 1000);
+ this.wait(1 * 60 * 1000);
} catch (InterruptedException ie) {
log.warn("Caught an InterruptedException", ie);
}
No revision
No revision
1.1.2.18 +11 -7
xml-cocoon/src/org/apache/cocoon/components/language/programming/java/Attic/JavaLanguage.java
Index: JavaLanguage.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/components/language/programming/java/Attic/JavaLanguage.java,v
retrieving revision 1.1.2.17
retrieving revision 1.1.2.18
diff -u -r1.1.2.17 -r1.1.2.18
--- JavaLanguage.java 2001/01/18 19:12:09 1.1.2.17
+++ JavaLanguage.java 2001/01/29 19:12:08 1.1.2.18
@@ -19,6 +19,7 @@
import org.apache.avalon.Component;
import org.apache.avalon.ComponentManager;
import org.apache.avalon.ThreadSafe;
+import org.apache.avalon.Loggable;
import org.apache.cocoon.Roles;
import org.apache.cocoon.util.ClassUtils;
@@ -31,7 +32,7 @@
* The Java programming language processor
*
* @author <a href="mailto:[EMAIL PROTECTED]">Ricardo Rocha</a>
- * @version CVS $Revision: 1.1.2.17 $ $Date: 2001/01/18 19:12:09 $
+ * @version CVS $Revision: 1.1.2.18 $ $Date: 2001/01/29 19:12:08 $
*/
public class JavaLanguage extends CompiledProgrammingLanguage implements
ThreadSafe {
@@ -139,6 +140,9 @@
try {
AbstractJavaCompiler compiler = (AbstractJavaCompiler)
this.compilerClass.newInstance();
+ if (compiler instanceof Loggable) {
+ ((Loggable) compiler).setLogger(this.log);
+ }
int pos = name.lastIndexOf(File.separatorChar);
String filename = name.substring(pos + 1);
@@ -260,12 +264,12 @@
private String expandDirs(String d) throws LanguageException {
File dir = new File(d);
- if ( ! dir.isDirectory() ) {
- throw new LanguageException(
- "Attempted to retrieve directory listing of
non-directory "
- + dir.toString()
- );
- }
+ if ( ! dir.isDirectory() ) {
+ throw new LanguageException(
+ "Attempted to retrieve directory listing of non-directory "
+ + dir.toString()
+ );
+ }
File[] files = dir.listFiles(new JavaArchiveFilter());
StringBuffer buffer = new StringBuffer();
for (int i = 0; i < files.length; i++) {