remm 2005/04/24 06:18:28
Modified: util/java/org/apache/tomcat/util/net/res
LocalStrings.properties
util/java/org/apache/tomcat/util/net AprEndpoint.java
Log:
- Proper logging.
Revision Changes Path
1.7 +8 -1
jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/net/res/LocalStrings.properties
Index: LocalStrings.properties
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/net/res/LocalStrings.properties,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- LocalStrings.properties 29 Jan 2005 19:29:55 -0000 1.6
+++ LocalStrings.properties 24 Apr 2005 13:18:28 -0000 1.7
@@ -10,4 +10,11 @@
endpoint.warn.nullSocket=Null socket returned by accept
endpoint.debug.unlock=Caught exception trying to unlock accept on port {0}
endpoint.err.close=Caught exception trying to close socket
-endpoint.noProcessor=No Processors - worker thread dead!
\ No newline at end of file
+endpoint.noProcessor=No Processors - worker thread dead!
+
+endpoint.poll.limitedpollsize=Failed to create poller with specified size,
uses 62 instead
+endpoint.poll.initfail=Poller creation failed
+endpoint.poll.fail=Critical poller failure, restarting poller
+endpoint.poll.error=Unexpected poller error
+endpoint.sendfile.error=Unexpected sendfile error
+endpoint.sendfile.addfail=Sednfile failure with status {0}
1.22 +35 -57
jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/net/AprEndpoint.java
Index: AprEndpoint.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/net/AprEndpoint.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- AprEndpoint.java 24 Apr 2005 10:40:48 -0000 1.21
+++ AprEndpoint.java 24 Apr 2005 13:18:28 -0000 1.22
@@ -19,7 +19,6 @@
import java.net.InetAddress;
import java.util.HashMap;
import java.util.Stack;
-import java.util.Vector;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -94,12 +93,6 @@
/**
- * All processors which have been created.
- */
- protected Vector created = new Vector();
-
-
- /**
* Running state of the endpoint.
*/
protected volatile boolean running = false;
@@ -395,33 +388,29 @@
if (initialized)
return;
- try {
- // Initialize APR
- Library.initialize(null);
- // Create the root APR memory pool
- rootPool = Pool.create(0);
- // Create the pool for the server socket
- serverSockPool = Pool.create(rootPool);
- // Create the APR address that will be bound
- String addressStr = null;
- if (address == null) {
- addressStr = null;
- } else {
- addressStr = "" + address;
- }
- long inetAddress = Address.info(addressStr, Socket.APR_INET,
- port, 0, rootPool);
- // Create the APR server socket
- serverSock = Socket.create(Socket.APR_INET, Socket.SOCK_STREAM,
- Socket.APR_PROTO_TCP, rootPool);
- // Bind the server socket
- Socket.bind(serverSock, inetAddress);
- // Start listening on the server socket
- Socket.listen(serverSock, backlog);
- } catch (Exception e) {
- // FIXME: proper logging
- throw e;
- }
+ // Initialize APR
+ Library.initialize(null);
+ // Create the root APR memory pool
+ rootPool = Pool.create(0);
+ // Create the pool for the server socket
+ serverSockPool = Pool.create(rootPool);
+ // Create the APR address that will be bound
+ String addressStr = null;
+ if (address == null) {
+ addressStr = null;
+ } else {
+ addressStr = "" + address;
+ }
+ long inetAddress = Address.info(addressStr, Socket.APR_INET,
+ port, 0, rootPool);
+ // Create the APR server socket
+ serverSock = Socket.create(Socket.APR_INET, Socket.SOCK_STREAM,
+ Socket.APR_PROTO_TCP, rootPool);
+ // Bind the server socket
+ Socket.bind(serverSock, inetAddress);
+ // Start listening on the server socket
+ Socket.listen(serverSock, backlog);
+
initialized = true;
}
@@ -632,7 +621,6 @@
Worker workerThread = new Worker();
workerThread.start();
- created.addElement(workerThread);
return (workerThread);
}
@@ -751,17 +739,14 @@
if (Status.APR_STATUS_IS_EINVAL(e.getError())) {
try {
// Use WIN32 maximum poll size
- // FIXME: Add WARN level logging about this, as
scalability will
- // be limited
pollerSize = 62;
serverPollset = Poll.create(pollerSize, pool, 0,
soTimeout * 1000);
+
log.warn(sm.getString("endpoint.poll.limitedpollsize"));
} catch (Error err) {
- // FIXME: more appropriate logging
- err.printStackTrace();
+ log.error(sm.getString("endpoint.poll.initfail"), e);
}
} else {
- // FIXME: more appropriate logging
- e.printStackTrace();
+ log.error(sm.getString("endpoint.poll.initfail"), e);
}
}
desc = new long[pollerSize * 4];
@@ -837,7 +822,7 @@
}
maintainTime += pollTime;
} else if (rv < -1) {
- // FIXME: Log with WARN at least
+ log.error(sm.getString("endpoint.poll.fail"));
// Handle poll critical failure
synchronized (this) {
destroy();
@@ -858,8 +843,7 @@
}
}
} catch (Throwable t) {
- // FIXME: Proper logging
- t.printStackTrace();
+ log.error(sm.getString("endpoint.poll.error"), t);
}
}
@@ -1030,17 +1014,14 @@
if (Status.APR_STATUS_IS_EINVAL(e.getError())) {
try {
// Use WIN32 maximum poll size
- // FIXME: Add WARN level logging about this, as
scalability will
- // be limited
sendfileSize = 62;
sendfilePollset = Poll.create(sendfileSize, pool, 0,
soTimeout * 1000);
+
log.warn(sm.getString("endpoint.poll.limitedpollsize"));
} catch (Error err) {
- // FIXME: more appropriate logging
- err.printStackTrace();
+ log.error(sm.getString("endpoint.poll.initfail"), e);
}
} else {
- // FIXME: more appropriate logging
- e.printStackTrace();
+ log.error(sm.getString("endpoint.poll.initfail"), e);
}
}
desc = new long[sendfileSize * 4];
@@ -1086,8 +1067,7 @@
}
}
} catch (Error e) {
- // FIXME: more appropriate logging
- e.printStackTrace();
+ log.error(sm.getString("endpoint.sendfile.error"), e);
return false;
}
synchronized (this) {
@@ -1097,8 +1077,7 @@
if (rv == Status.APR_SUCCESS) {
sendfileCount++;
} else {
- // FIXME: Log with a WARN at least, as the request will
- // fail from the user perspective
+ log.warn(sm.getString("endpoint.sendfile.addfail", "" +
rv));
// Can't do anything: close the socket right away
Pool.destroy(data.pool);
}
@@ -1187,16 +1166,15 @@
}
}
} else if (rv < -1) {
+ log.error(sm.getString("endpoint.poll.fail"));
// Handle poll critical failure
- // FIXME: Log with WARN at least
synchronized (this) {
destroy();
init();
}
}
} catch (Throwable t) {
- // FIXME: Proper logging
- t.printStackTrace();
+ log.error(sm.getString("endpoint.poll.error"), t);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]