jfarcand 2004/11/19 12:06:07
Modified: catalina/src/share/org/apache/catalina/valves
ByteBufferAccessLogValve.java
mbeans-descriptors.xml
Log:
Per Remy's recommendation, remove the writer thread. Next step will consist
of integrating the logic into the FastCommonAccessLogValve.
Revision Changes Path
1.2 +4 -116
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/valves/ByteBufferAccessLogValve.java
Index: ByteBufferAccessLogValve.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/valves/ByteBufferAccessLogValve.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ByteBufferAccessLogValve.java 19 Nov 2004 16:46:26 -0000 1.1
+++ ByteBufferAccessLogValve.java 19 Nov 2004 20:06:07 -0000 1.2
@@ -62,21 +62,12 @@
*
* This us an NIO adaptation of the default AccessLogValve.
*
- * <IMPLEMENTATION NOTE>
- * The backgroundProcessorDelay is currently not used when flusing the
- * <code>ByteBuffer</code> since setting that value affect all others
- * component.
- *
- * An AccessWriterThread is used instead, which times out after 5
minutes.
- *
- * </IMPLEMENTATIOn NOTE>
- *
* @author Jean-Francois Arcand
*/
public final class ByteBufferAccessLogValve
extends ValveBase
- implements Lifecycle, Runnable {
+ implements Lifecycle {
// -----------------------------------------------------------
Constructors
@@ -125,7 +116,7 @@
* The descriptive information about this implementation.
*/
protected static final String info =
- "org.apache.catalina.valves.AccessLogValve/1.0";
+ "org.apache.catalina.valves.ByteBufferAccessLogValve/1.0";
/**
@@ -291,12 +282,6 @@
/**
- * The background writerThread.
- */
- private Thread writerThread = null;
-
-
- /**
* The background writerThread completion semaphore.
*/
private boolean threadDone = false;
@@ -334,12 +319,6 @@
/**
- * The interval (in seconds) between writting the log.
- */
- private int writeInterval = 5 * 60;
-
-
- /**
* Per-Thread <code>StringBuffer</code> used to store the log.
*/
static private ThreadLocal stringBufferThreadLocal = new ThreadLocal(){
@@ -381,21 +360,6 @@
}
- /**
- * Return writerThread interval (seconds)
- */
- public int getWriterInterval() {
- return this.writeInterval;
- }
-
-
- /**
- * Set writerthread interval (seconds)
- */
- public void setWriterInterval(int t) {
- this.writeInterval = t;
- }
-
// -------------------------------------------------------------
Properties
@@ -722,7 +686,7 @@
} else {
currentByteBuffer = viewBuffer1;
}
- // Now we can store the results since the currentCharBuffer
+ // Now we can store the results since the currentByteBuffer
// is empty.
currentByteBuffer.put(bytesToWrite);
}
@@ -994,8 +958,6 @@
dateStamp = dateFormatter.format(new Date());
open();
-
- threadStart();
}
@@ -1018,9 +980,6 @@
started = false;
close();
-
- threadStop();
-
}
@@ -1030,77 +989,6 @@
* throwables will be caught and logged.
*/
public void backgroundProcess() {
- // XXX Shoud the backgroud thread be used here?
- // log();
- }
-
-
- /**
- * The background writerThread that checks for write the log.
- */
- public void run() {
-
- // Loop until the termination semaphore is set
- while (!threadDone) {
- threadWait();
- log();
- }
+ log();
}
-
-
- /**
- * Sleep for the duration specified by the <code>writeInterval</code>
- * property.
- */
- private void threadWait() {
-
- synchronized(lock){
- try {
- lock.wait(writeInterval * 1000L);
- } catch (InterruptedException e) {
- ;
- }
- }
-
- }
-
-
- /**
- * Start the background writerThread that will periodically write access
log
- */
- private void threadStart() {
-
- if (writerThread != null)
- return;
-
- threadDone = false;
- String threadName = "AccessLogWriter";
- writerThread = new Thread(this, threadName);
- writerThread.setDaemon(true);
- writerThread.start();
-
- }
-
-
- /**
- * Stop the background writerThread that is periodically write logs
- */
- private void threadStop() {
-
- if (writerThread == null)
- return;
-
- threadDone = true;
- writerThread.interrupt();
- try {
- writerThread.join();
- } catch (InterruptedException e) {
- ;
- }
-
- writerThread = null;
-
- }
-
-
}
1.9 +1 -6
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/valves/mbeans-descriptors.xml
Index: mbeans-descriptors.xml
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/valves/mbeans-descriptors.xml,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- mbeans-descriptors.xml 19 Nov 2004 16:46:26 -0000 1.8
+++ mbeans-descriptors.xml 19 Nov 2004 20:06:07 -0000 1.9
@@ -100,14 +100,9 @@
description="The format for the date date based log
rotation."
type="java.lang.String"/>
- <attribute name="directByteBufferSize"
+ <attribute name="byteBufferSize"
description="The size of the byte buffer used to store the
log."
type="java.lang.String"/>
-
- <attribute name="writeInterval"
- description="The interval (in seconds) between writting the
log."
- type="int"/>
-
</mbean>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]