You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by ba...@apache.org on 2006/04/27 11:43:35 UTC
svn commit: r397494 - in
/james/server/trunk/src/java/org/apache/james/mailrepository:
JDBCMailRepository.java MessageInputStream.java
Author: bago
Date: Thu Apr 27 02:43:34 2006
New Revision: 397494
URL: http://svn.apache.org/viewcvs?rev=397494&view=rev
Log:
Temp workaround for JAMES-466. Default size for in-memory bytearray usage instead of new streaming code is now 400MB.
The streaming support can be "re-enabled" by adding a config.xml property to the repositories (inMemorySizeLimit)
Modified:
james/server/trunk/src/java/org/apache/james/mailrepository/JDBCMailRepository.java
james/server/trunk/src/java/org/apache/james/mailrepository/MessageInputStream.java
Modified: james/server/trunk/src/java/org/apache/james/mailrepository/JDBCMailRepository.java
URL: http://svn.apache.org/viewcvs/james/server/trunk/src/java/org/apache/james/mailrepository/JDBCMailRepository.java?rev=397494&r1=397493&r2=397494&view=diff
==============================================================================
--- james/server/trunk/src/java/org/apache/james/mailrepository/JDBCMailRepository.java (original)
+++ james/server/trunk/src/java/org/apache/james/mailrepository/JDBCMailRepository.java Thu Apr 27 02:43:34 2006
@@ -162,6 +162,11 @@
protected boolean jdbcMailAttributesReady = false;
/**
+ * The size threshold for in memory handling of storing operations
+ */
+ private int inMemorySizeLimit;
+
+ /**
* @see org.apache.avalon.framework.context.Contextualizable#contextualize(Context)
*/
public void contextualize(final Context context)
@@ -252,6 +257,8 @@
.append("'");
getLogger().debug(logBuffer.toString());
}
+
+ inMemorySizeLimit = conf.getChild("inMemorySizeLimit").getValueAsInteger(409600000);
String filestore = conf.getChild("filestore").getValue(null);
sqlFileName = conf.getChild("sqlFile").getValue();
@@ -665,7 +672,7 @@
PreparedStatement updateMessageBody =
conn.prepareStatement(sqlQueries.getSqlString("updateMessageBodySQL", true));
try {
- MessageInputStream is = new MessageInputStream(mc,sr);
+ MessageInputStream is = new MessageInputStream(mc,sr,inMemorySizeLimit);
updateMessageBody.setBinaryStream(1,is,(int) is.getSize());
updateMessageBody.setString(2, mc.getName());
updateMessageBody.setString(3, repositoryName);
@@ -706,7 +713,7 @@
insertMessage.setString(8, mc.getRemoteAddr());
insertMessage.setTimestamp(9, new java.sql.Timestamp(mc.getLastUpdated().getTime()));
- MessageInputStream is = new MessageInputStream(mc,sr);
+ MessageInputStream is = new MessageInputStream(mc, sr, inMemorySizeLimit);
insertMessage.setBinaryStream(10, is, (int) is.getSize());
Modified: james/server/trunk/src/java/org/apache/james/mailrepository/MessageInputStream.java
URL: http://svn.apache.org/viewcvs/james/server/trunk/src/java/org/apache/james/mailrepository/MessageInputStream.java?rev=397494&r1=397493&r2=397494&view=diff
==============================================================================
--- james/server/trunk/src/java/org/apache/james/mailrepository/MessageInputStream.java (original)
+++ james/server/trunk/src/java/org/apache/james/mailrepository/MessageInputStream.java Thu Apr 27 02:43:34 2006
@@ -46,14 +46,14 @@
* Main constructor. If srep is not null than we are using dbfiles and we stream
* the body to file and only the header to db.
*/
- public MessageInputStream(Mail mc, StreamRepository srep) throws IOException, MessagingException {
+ public MessageInputStream(Mail mc, StreamRepository srep, int sizeLimit) throws IOException, MessagingException {
super();
caughtException = null;
streamRep = srep;
size = mc.getMessageSize();
// we use the pipes only when streamRep is null and the message size is greater than 4096
// Otherwise we should calculate the header size and not the message size when streamRep is not null (JAMES-475)
- if (streamRep == null && size > 4096) {
+ if (streamRep == null && size > sizeLimit) {
PipedOutputStream headerOut = new PipedOutputStream();
new Thread() {
private Mail mail;
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org