[GUMP@vmgump]: Project tomcat-tc8.0.x (in module tomcat-8.0.x) failed

2015-01-08 Thread Bill Barker
To whom it may engage...

This is an automated request, but not an unsolicited one. For 
more information please visit http://gump.apache.org/nagged.html, 
and/or contact the folk at gene...@gump.apache.org.

Project tomcat-tc8.0.x has an issue affecting its community integration.
This issue affects 5 projects,
 and has been outstanding for 30 runs.
The current state of this project is 'Failed', with reason 'Build Failed'.
For reference only, the following projects are affected by this:
- tomcat-tc8.0.x :  Tomcat 8.x, a web server implementing the Java Servlet 
3.1,
...
- tomcat-tc8.0.x-test-apr :  Tomcat 8.x, a web server implementing the Java 
Servlet 3.1,
...
- tomcat-tc8.0.x-test-bio :  Tomcat 8.x, a web server implementing the Java 
Servlet 3.1,
...
- tomcat-tc8.0.x-test-nio :  Tomcat 8.x, a web server implementing the Java 
Servlet 3.1,
...
- tomcat-tc8.0.x-test-nio2 :  Tomcat 8.x, a web server implementing the 
Java Servlet 3.1,
...


Full details are available at:
http://vmgump.apache.org/gump/public/tomcat-8.0.x/tomcat-tc8.0.x/index.html

That said, some information snippets are provided here.

The following annotations (debug/informational/warning/error messages) were 
provided:
 -DEBUG- Dependency on commons-daemon exists, no need to add for property 
commons-daemon.native.src.tgz.
 -DEBUG- Dependency on commons-daemon exists, no need to add for property 
tomcat-native.tar.gz.
 -DEBUG- Dependency on junit exists, no need to add for property junit.jar.
 -INFO- Made directory [/srv/gump/public/workspace/tomcat-8.0.x/tomcat-deps]
 -INFO- Failed with reason build failed
 -DEBUG- Extracted fallback artifacts from Gump Repository



The following work was performed:
http://vmgump.apache.org/gump/public/tomcat-8.0.x/tomcat-tc8.0.x/gump_work/build_tomcat-8.0.x_tomcat-tc8.0.x.html
Work Name: build_tomcat-8.0.x_tomcat-tc8.0.x (Type: Build)
Work ended in a state of : Failed
Elapsed: 45 secs
Command Line: /usr/lib/jvm/java-8-oracle/bin/java -Djava.awt.headless=true 
-Dbuild.sysclasspath=only org.apache.tools.ant.Main 
-Dgump.merge=/srv/gump/public/gump/work/merge.xml 
-Djdt.jar=/srv/gump/packages/eclipse/plugins/R-4.4-201406061215/ecj-4.4.jar 
-Dtomcat-native.tar.gz=/srv/gump/public/workspace/apache-commons/daemon/dist/bin/commons-daemon-20150109-native-src.tar.gz
 
-Dcommons-daemon.native.src.tgz=/srv/gump/public/workspace/apache-commons/daemon/dist/bin/commons-daemon-20150109-native-src.tar.gz
 
-Dcommons-daemon.jar=/srv/gump/public/workspace/apache-commons/daemon/dist/commons-daemon-20150109.jar
 -Djunit.jar=/srv/gump/public/workspace/junit/target/junit-4.13-SNAPSHOT.jar 
[Working Directory: /srv/gump/public/workspace/tomcat-8.0.x]
CLASSPATH: 
/usr/lib/jvm/java-8-oracle/lib/tools.jar:/srv/gump/public/workspace/tomcat-8.0.x/output/classes:/srv/gump/public/workspace/ant/dist/lib/ant.jar:/srv/gump/public/workspace/ant/dist/lib/ant-launcher.jar:/srv/gump/public/workspace/ant/dist/lib/ant-jmf.jar:/srv/gump/public/workspace/ant/dist/lib/ant-junit.jar:/srv/gump/public/workspace/ant/dist/lib/ant-junit4.jar:/srv/gump/public/workspace/ant/dist/lib/ant-swing.jar:/srv/gump/public/workspace/ant/dist/lib/ant-apache-resolver.jar:/srv/gump/public/workspace/ant/dist/lib/ant-apache-xalan2.jar:/srv/gump/public/workspace/xml-commons/java/build/resolver.jar:/srv/gump/public/workspace/junit/target/junit-4.13-SNAPSHOT.jar:/srv/gump/packages/eclipse/plugins/R-4.4-201406061215/ecj-4.4.jar:/srv/gump/public/workspace/apache-commons/daemon/dist/commons-daemon-20150109.jar
-
at 
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1259)
at org.apache.tools.ant.Main.runBuild(Main.java:853)
at org.apache.tools.ant.Main.startAnt(Main.java:235)
at org.apache.tools.ant.Main.start(Main.java:198)
at org.apache.tools.ant.Main.main(Main.java:286)
-
org.xml.sax.SAXParseException; systemId: 
file:/srv/gump/public/workspace/tomcat-8.0.x/webapps/docs/changelog.xml; 
lineNumber: 56; columnNumber: 45; Element type section must be followed by 
either attribute specifications,  or /.
at 
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203)
at 
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:177)
at 
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:441)
at 
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:368)
at 
com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1436)
at 
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.seekCloseOfStartTag(XMLDocumentFragmentScannerImpl.java:1395)
at 

Re: Release of Apache Taglibs

2015-01-08 Thread Jeremy Boynes
On Jan 8, 2015, at 1:42 PM, Konstantin Kolinko knst.koli...@gmail.com wrote:
 
 2015-01-08 9:42 GMT+03:00 Jeremy Boynes jboy...@apache.org:
 I made a couple of minor improvements to Apache Taglibs last year related to 
 XML parsing and to how we load libraries (it now uses the TCCL which means 
 the jars can be shared between webapps as well as be included in a webapp as 
 before). I would like to perform a minor release (1.2.2) to include these. 
 Before I do, are there any other issues that should be addressed?
 
 One change in 1.2 I think was not useful was the split of the 1.0 EL 
 evaluator into its own jar. I propose to merge that back so we end up with 
 two jars: one with the javax classes and one with our implementation.
 
 I do not see a point in merging them back. Personally, I do not use
 JSTL 1.0 EL implementation and do not plan to use it. (IIRC, the only
 occurrence when I used them was when I made a typo in tag library url,
 like copy-pasting from a wrong tld file. Hilarity ensued).
 Unexpectedly using a wrong implementation may be confusing.

That was the kind of thing that prompted me to split it off in the first place.

The other was to the allow users to use a newer EL implementation (such as the 
one from the container) which could have performance or efficiency improvements 
over the original one, especially now EL has been decoupled from JSTL and JSP. 
However, I found a problem with the -compat packaging that would prevent that 
jar being used; see #57427. As no-one else had reported that my assumption was 
that this was not that useful.

 Another point is that I do not like changing release packaging in a
 point release.  Is this driven by a real users' demand? Have there
 been any public complaints from real users (e.g. an issue in
 Bugzilla)? What do we do with Maven artifacts? Abandon one of them?

As I’d not seen any feedback on the split (public or private) I was thinking of 
simply reverting to the 1.1.x model. Sounds better though to fix the problems 
with the -compat version and defer merging until a potential 1.3 release.

—
Jeremy



signature.asc
Description: Message signed with OpenPGP using GPGMail


[Bug 57427] New: 1.0 TLDs are missing from -compat jar

2015-01-08 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=57427

Bug ID: 57427
   Summary: 1.0 TLDs are missing from -compat jar
   Product: Taglibs
   Version: 1.2.1
  Hardware: All
OS: All
Status: NEW
  Severity: major
  Priority: P2
 Component: Standard Taglib
  Assignee: dev@tomcat.apache.org
  Reporter: jboy...@apache.org

The jar for taglibs-standard-compat does not contain the TLDs for the 1.0 tags
that it supports. This prevents the libraries from being used.

This jar is intended to allow the user to utilize a different implementation of
EL such as the one from the container. However, the missing TLDs prevent that.

A work-around may be to package the TLDs directly into /WEB-INF.

-- 
You are receiving this mail because:
You are the assignee for the bug.

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[GUMP@vmgump]: Project tomcat-tc8.0.x (in module tomcat-8.0.x) failed

2015-01-08 Thread Bill Barker
To whom it may engage...

This is an automated request, but not an unsolicited one. For 
more information please visit http://gump.apache.org/nagged.html, 
and/or contact the folk at gene...@gump.apache.org.

Project tomcat-tc8.0.x has an issue affecting its community integration.
This issue affects 5 projects.
The current state of this project is 'Failed', with reason 'Build Failed'.
For reference only, the following projects are affected by this:
- tomcat-tc8.0.x :  Tomcat 8.x, a web server implementing the Java Servlet 
3.1,
...
- tomcat-tc8.0.x-test-apr :  Tomcat 8.x, a web server implementing the Java 
Servlet 3.1,
...
- tomcat-tc8.0.x-test-bio :  Tomcat 8.x, a web server implementing the Java 
Servlet 3.1,
...
- tomcat-tc8.0.x-test-nio :  Tomcat 8.x, a web server implementing the Java 
Servlet 3.1,
...
- tomcat-tc8.0.x-test-nio2 :  Tomcat 8.x, a web server implementing the 
Java Servlet 3.1,
...


Full details are available at:
http://vmgump.apache.org/gump/public/tomcat-8.0.x/tomcat-tc8.0.x/index.html

That said, some information snippets are provided here.

The following annotations (debug/informational/warning/error messages) were 
provided:
 -DEBUG- Dependency on commons-daemon exists, no need to add for property 
commons-daemon.native.src.tgz.
 -DEBUG- Dependency on commons-daemon exists, no need to add for property 
tomcat-native.tar.gz.
 -DEBUG- Dependency on junit exists, no need to add for property junit.jar.
 -INFO- Made directory [/srv/gump/public/workspace/tomcat-8.0.x/tomcat-deps]
 -INFO- Failed with reason build failed
 -DEBUG- Extracted fallback artifacts from Gump Repository



The following work was performed:
http://vmgump.apache.org/gump/public/tomcat-8.0.x/tomcat-tc8.0.x/gump_work/build_tomcat-8.0.x_tomcat-tc8.0.x.html
Work Name: build_tomcat-8.0.x_tomcat-tc8.0.x (Type: Build)
Work ended in a state of : Failed
Elapsed: 44 secs
Command Line: /usr/lib/jvm/java-8-oracle/bin/java -Djava.awt.headless=true 
-Dbuild.sysclasspath=only org.apache.tools.ant.Main 
-Dgump.merge=/srv/gump/public/gump/work/merge.xml 
-Djdt.jar=/srv/gump/packages/eclipse/plugins/R-4.4-201406061215/ecj-4.4.jar 
-Dtomcat-native.tar.gz=/srv/gump/public/workspace/apache-commons/daemon/dist/bin/commons-daemon-20150109-native-src.tar.gz
 
-Dcommons-daemon.native.src.tgz=/srv/gump/public/workspace/apache-commons/daemon/dist/bin/commons-daemon-20150109-native-src.tar.gz
 
-Dcommons-daemon.jar=/srv/gump/public/workspace/apache-commons/daemon/dist/commons-daemon-20150109.jar
 -Djunit.jar=/srv/gump/public/workspace/junit/target/junit-4.13-SNAPSHOT.jar 
[Working Directory: /srv/gump/public/workspace/tomcat-8.0.x]
CLASSPATH: 
/usr/lib/jvm/java-8-oracle/lib/tools.jar:/srv/gump/public/workspace/tomcat-8.0.x/output/classes:/srv/gump/public/workspace/ant/dist/lib/ant.jar:/srv/gump/public/workspace/ant/dist/lib/ant-launcher.jar:/srv/gump/public/workspace/ant/dist/lib/ant-jmf.jar:/srv/gump/public/workspace/ant/dist/lib/ant-junit.jar:/srv/gump/public/workspace/ant/dist/lib/ant-junit4.jar:/srv/gump/public/workspace/ant/dist/lib/ant-swing.jar:/srv/gump/public/workspace/ant/dist/lib/ant-apache-resolver.jar:/srv/gump/public/workspace/ant/dist/lib/ant-apache-xalan2.jar:/srv/gump/public/workspace/xml-commons/java/build/resolver.jar:/srv/gump/public/workspace/junit/target/junit-4.13-SNAPSHOT.jar:/srv/gump/packages/eclipse/plugins/R-4.4-201406061215/ecj-4.4.jar:/srv/gump/public/workspace/apache-commons/daemon/dist/commons-daemon-20150109.jar
-
at 
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1259)
at org.apache.tools.ant.Main.runBuild(Main.java:853)
at org.apache.tools.ant.Main.startAnt(Main.java:235)
at org.apache.tools.ant.Main.start(Main.java:198)
at org.apache.tools.ant.Main.main(Main.java:286)
-
org.xml.sax.SAXParseException; systemId: 
file:/srv/gump/public/workspace/tomcat-8.0.x/webapps/docs/changelog.xml; 
lineNumber: 56; columnNumber: 45; Element type section must be followed by 
either attribute specifications,  or /.
at 
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203)
at 
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:177)
at 
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:441)
at 
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:368)
at 
com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1436)
at 
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.seekCloseOfStartTag(XMLDocumentFragmentScannerImpl.java:1395)
at 

Re: [CANCELLED][VOTE] Release Apache Tomcat 8.0.16

2015-01-08 Thread Konstantin Kolinko
2015-01-08 22:16 GMT+03:00 Mark Thomas ma...@apache.org:

 I've fixed this issue in trunk. I need to commit, back-port it and run
 through the unit tests. I should be able to do that this evening and I
 plan to tag 8.0.17 tomorrow morning.

There is the following issue about thread safety in URL_ENCODER and
DirContextURLConnection.list() generating garbage:
https://issues.apache.org/bugzilla/show_bug.cgi?id=57420

I remember that this was first reported in November 2014 (Spurious
Problem starting Tomcat7 (garbled class names) thread)
http://tomcat.markmail.org/thread/j7nrhb3nsqtxkaxn

Now the source cause of the issue seems to be found. (I have not
evaluated the BZ issue yet).

Best regards,
Konstantin Kolinko

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Re: Release of Apache Taglibs

2015-01-08 Thread Konstantin Kolinko
2015-01-08 9:42 GMT+03:00 Jeremy Boynes jboy...@apache.org:
 I made a couple of minor improvements to Apache Taglibs last year related to 
 XML parsing and to how we load libraries (it now uses the TCCL which means 
 the jars can be shared between webapps as well as be included in a webapp as 
 before). I would like to perform a minor release (1.2.2) to include these. 
 Before I do, are there any other issues that should be addressed?

 One change in 1.2 I think was not useful was the split of the 1.0 EL 
 evaluator into its own jar. I propose to merge that back so we end up with 
 two jars: one with the javax classes and one with our implementation.

I do not see a point in merging them back. Personally, I do not use
JSTL 1.0 EL implementation and do not plan to use it. (IIRC, the only
occurrence when I used them was when I made a typo in tag library url,
like copy-pasting from a wrong tld file. Hilarity ensued).
Unexpectedly using a wrong implementation may be confusing.

Another point is that I do not like changing release packaging in a
point release.  Is this driven by a real users' demand? Have there
been any public complaints from real users (e.g. an issue in
Bugzilla)? What do we do with Maven artifacts? Abandon one of them?

Best regards,
Konstantin Kolinko

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Re: tcnative trunk versus 1.1 branch

2015-01-08 Thread Rainer Jung

Am 07.01.2015 um 18:58 schrieb Christopher Schultz:

All,

As far as I can tell, the 1.1 branch has gotten way out of sync with the
trunk, here. Rainer has been doing a lot of work on the trunk, lately,
with nothing being back-ported.


I don't get that. What work do you mean? The first possibly not 
backported change I can find from me is dated 2013-06.


I did some merging in July 2011 but that was from 1.1 to trunk. Trunk 
was branched in 2008 to make use of APR 1.3. In its early life got some 
changes by Mladen which were not part of 1.1. Later many commits applied 
to 1.1 were not applied to trunk.


See also http://marc.info/?t=13593721922r=1w=2


Is anyone interested in an effort to bring these two back into sync with
each other?

There are whole features (e.g. anything in sslext.c) in trunk that
aren't available in the 1.1 branch, which is where all the releases are
coming from, and there are Java features that rely on these native
features being there, which they will never be unless we either
back-port a huge amount of patches or decide to go to a 1.2 branch or
something similar.

Rainer, do you have a plan for all the changes you are making?


Chris: I guess you are mixing the mod_jk changes with tcnative when 
addressing me. At least I don't understand what tcnative trunk changes 
done by me you mean.


Regards,

Rainer


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Re: [tcnative] Unused function in src/poll.c

2015-01-08 Thread Rainer Jung

Am 07.01.2015 um 19:00 schrieb Christopher Schultz:

All,

There is a function in src/poll.c that is completely unused:

  450737  mturk static void remove_all(tcn_pollset_t *p)
  450737  mturk {
  450737  mturk apr_int32_t i;
  450737  mturk for (i = 0; i  p-nelts; i++) {
  450737  mturk apr_pollset_remove(p-pollset,
(p-socket_set[i]));
  450737  mturk #ifdef TCN_DO_STATISTICS
  450737  mturk p-sp_removed++;
  450737  mturk #endif
  450737  mturk }
  450737  mturk p-nelts = 0;
  450737  mturk }

It was added in the revision indicated, is static, and is not used in
poll.c. Should it be removed?


Subversion history shows, it was introduced and used in r450737 by 
Mladen, but the code block that used it was removed in r1342024/1342025 
by Mark. Assuming the correctness of these changes, it looks safe and 
correct to me to remove remove_all().


Regards,

Rainer


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1650265 - in /tomcat/trunk: java/org/apache/coyote/http11/ test/org/apache/coyote/http11/filters/

2015-01-08 Thread markt
Author: markt
Date: Thu Jan  8 13:09:31 2015
New Revision: 1650265

URL: http://svn.apache.org/r1650265
Log:
Add SocketWrapper to AbstractOutputBuffer.
While this allows a little code reduction now, the primary reason for
this is a step towards the goal of having a single OutputBuffer
implementation with the APR/NIO/NIO2 code moving to the SocketWrapper or
Endpoint as appropriate.

Modified:
tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java
tomcat/trunk/java/org/apache/coyote/http11/AbstractOutputBuffer.java
tomcat/trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java
tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java
tomcat/trunk/java/org/apache/coyote/http11/InternalNioOutputBuffer.java
tomcat/trunk/test/org/apache/coyote/http11/filters/TesterOutputBuffer.java

Modified: 
tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java?rev=1650265r1=1650264r2=1650265view=diff
==
--- tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java Thu 
Jan  8 13:09:31 2015
@@ -939,7 +939,7 @@ public abstract class AbstractHttp11Proc
 // Setting up the I/O
 setSocketWrapper(socketWrapper);
 getInputBuffer().init(socketWrapper, endpoint);
-getOutputBuffer().init(socketWrapper, endpoint);
+getOutputBuffer().init(socketWrapper);
 
 // Flags
 keepAlive = true;

Modified: tomcat/trunk/java/org/apache/coyote/http11/AbstractOutputBuffer.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/AbstractOutputBuffer.java?rev=1650265r1=1650264r2=1650265view=diff
==
--- tomcat/trunk/java/org/apache/coyote/http11/AbstractOutputBuffer.java 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/AbstractOutputBuffer.java Thu 
Jan  8 13:09:31 2015
@@ -33,7 +33,6 @@ import org.apache.juli.logging.LogFactor
 import org.apache.tomcat.util.buf.ByteChunk;
 import org.apache.tomcat.util.buf.MessageBytes;
 import org.apache.tomcat.util.http.HttpMessages;
-import org.apache.tomcat.util.net.AbstractEndpoint;
 import org.apache.tomcat.util.net.SocketWrapperBase;
 import org.apache.tomcat.util.res.StringManager;
 
@@ -96,6 +95,12 @@ public abstract class AbstractOutputBuff
 protected OutputBuffer outputStreamOutputBuffer;
 
 /**
+ * Wrapper for socket where data will be written to.
+ */
+protected SocketWrapperBaseS socketWrapper;
+
+
+/**
  * Bytes written to client for the current request
  */
 protected long byteCount = 0;
@@ -316,6 +321,7 @@ public abstract class AbstractOutputBuff
 public void recycle() {
 // Sub-classes may wish to do more than this.
 nextRequest();
+socketWrapper = null;
 bufferedWrites.clear();
 writeBufferFlipped = false;
 }
@@ -368,8 +374,10 @@ public abstract class AbstractOutputBuff
 }
 
 
-public abstract void init(SocketWrapperBaseS socketWrapper,
-AbstractEndpointS endpoint) throws IOException;
+public void init(SocketWrapperBaseS socketWrapper) {
+this.socketWrapper = socketWrapper;
+}
+
 
 public abstract void sendAck() throws IOException;
 

Modified: 
tomcat/trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java?rev=1650265r1=1650264r2=1650265view=diff
==
--- tomcat/trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java Thu 
Jan  8 13:09:31 2015
@@ -64,21 +64,16 @@ public class InternalAprOutputBuffer ext
 private long socket;
 
 
-private SocketWrapperBaseLong wrapper;
-
-
 private AbstractEndpointLong endpoint;
 
 
 // - Public Methods
 
 @Override
-public void init(SocketWrapperBaseLong socketWrapper,
-AbstractEndpointLong endpoint) throws IOException {
-
-wrapper = socketWrapper;
+public void init(SocketWrapperBaseLong socketWrapper) {
+super.init(socketWrapper);
 socket = socketWrapper.getSocket().longValue();
-this.endpoint = endpoint;
+this.endpoint = socketWrapper.getEndpoint();
 
 Socket.setsbb(this.socket, socketWriteBuffer);
 }
@@ -93,7 +88,6 @@ public class InternalAprOutputBuffer ext
 super.recycle();
 socketWriteBuffer.clear();
 socket = 0;
-wrapper = null;
 }
 
 
@@ -191,12 

svn commit: r1650267 - in /tomcat/trunk/java/org/apache: coyote/ coyote/ajp/ coyote/http11/ tomcat/util/buf/

2015-01-08 Thread markt
Author: markt
Date: Thu Jan  8 13:09:42 2015
New Revision: 1650267

URL: http://svn.apache.org/r1650267
Log:
Move ByteBufferHolder so it can be used by SocketWrapper

Added:
tomcat/trunk/java/org/apache/tomcat/util/buf/ByteBufferHolder.java   
(contents, props changed)
  - copied, changed from r1650266, 
tomcat/trunk/java/org/apache/coyote/ByteBufferHolder.java
Removed:
tomcat/trunk/java/org/apache/coyote/ByteBufferHolder.java
Modified:
tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java
tomcat/trunk/java/org/apache/coyote/http11/AbstractOutputBuffer.java
tomcat/trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java
tomcat/trunk/java/org/apache/coyote/http11/InternalNioOutputBuffer.java

Modified: tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java?rev=1650267r1=1650266r2=1650267view=diff
==
--- tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java (original)
+++ tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java Thu Jan  8 
13:09:42 2015
@@ -35,7 +35,6 @@ import javax.servlet.http.HttpUpgradeHan
 import org.apache.coyote.AbstractProcessor;
 import org.apache.coyote.ActionCode;
 import org.apache.coyote.AsyncContextCallback;
-import org.apache.coyote.ByteBufferHolder;
 import org.apache.coyote.ErrorState;
 import org.apache.coyote.InputBuffer;
 import org.apache.coyote.OutputBuffer;
@@ -45,6 +44,7 @@ import org.apache.coyote.Response;
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
 import org.apache.tomcat.util.ExceptionUtils;
+import org.apache.tomcat.util.buf.ByteBufferHolder;
 import org.apache.tomcat.util.buf.ByteChunk;
 import org.apache.tomcat.util.buf.HexUtils;
 import org.apache.tomcat.util.buf.MessageBytes;

Modified: tomcat/trunk/java/org/apache/coyote/http11/AbstractOutputBuffer.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/AbstractOutputBuffer.java?rev=1650267r1=1650266r2=1650267view=diff
==
--- tomcat/trunk/java/org/apache/coyote/http11/AbstractOutputBuffer.java 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/AbstractOutputBuffer.java Thu 
Jan  8 13:09:42 2015
@@ -24,12 +24,12 @@ import java.util.Iterator;
 import java.util.concurrent.LinkedBlockingDeque;
 
 import org.apache.coyote.ActionCode;
-import org.apache.coyote.ByteBufferHolder;
 import org.apache.coyote.OutputBuffer;
 import org.apache.coyote.Response;
 import org.apache.coyote.http11.filters.GzipOutputFilter;
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
+import org.apache.tomcat.util.buf.ByteBufferHolder;
 import org.apache.tomcat.util.buf.ByteChunk;
 import org.apache.tomcat.util.buf.MessageBytes;
 import org.apache.tomcat.util.http.HttpMessages;

Modified: 
tomcat/trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java?rev=1650267r1=1650266r2=1650267view=diff
==
--- tomcat/trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java Thu 
Jan  8 13:09:42 2015
@@ -23,10 +23,10 @@ import java.util.Iterator;
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock;
 
-import org.apache.coyote.ByteBufferHolder;
 import org.apache.coyote.Response;
 import org.apache.tomcat.jni.Socket;
 import org.apache.tomcat.jni.Status;
+import org.apache.tomcat.util.buf.ByteBufferHolder;
 import org.apache.tomcat.util.net.AbstractEndpoint;
 import org.apache.tomcat.util.net.AprEndpoint;
 import org.apache.tomcat.util.net.SocketWrapperBase;

Modified: 
tomcat/trunk/java/org/apache/coyote/http11/InternalNioOutputBuffer.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/InternalNioOutputBuffer.java?rev=1650267r1=1650266r2=1650267view=diff
==
--- tomcat/trunk/java/org/apache/coyote/http11/InternalNioOutputBuffer.java 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/InternalNioOutputBuffer.java Thu 
Jan  8 13:09:42 2015
@@ -23,8 +23,8 @@ import java.nio.channels.SelectionKey;
 import java.nio.channels.Selector;
 import java.util.Iterator;
 
-import org.apache.coyote.ByteBufferHolder;
 import org.apache.coyote.Response;
+import org.apache.tomcat.util.buf.ByteBufferHolder;
 import org.apache.tomcat.util.net.NioChannel;
 import org.apache.tomcat.util.net.NioEndpoint;
 import org.apache.tomcat.util.net.NioSelectorPool;

Copied: tomcat/trunk/java/org/apache/tomcat/util/buf/ByteBufferHolder.java 

svn commit: r1650268 - /tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java

2015-01-08 Thread markt
Author: markt
Date: Thu Jan  8 13:09:47 2015
New Revision: 1650268

URL: http://svn.apache.org/r1650268
Log:
DequeByteBufferHolder is a little more complex than ListByteBuffer
but using the same structure for all connectors will improve code re-use
and thereby improve maintainability.

Modified:
tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java

Modified: 
tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java?rev=1650268r1=1650267r2=1650268view=diff
==
--- tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java 
Thu Jan  8 13:09:47 2015
@@ -31,6 +31,7 @@ import java.util.concurrent.TimeoutExcep
 import javax.servlet.RequestDispatcher;
 
 import org.apache.coyote.Response;
+import org.apache.tomcat.util.buf.ByteBufferHolder;
 import org.apache.tomcat.util.net.AbstractEndpoint;
 import org.apache.tomcat.util.net.Nio2Channel;
 import org.apache.tomcat.util.net.Nio2Endpoint;
@@ -79,11 +80,6 @@ public class InternalNio2OutputBuffer ex
 protected AbstractEndpointNio2Channel endpoint = null;
 
 /**
- * Used instead of the deque since it looks equivalent and simpler.
- */
-protected ArrayListByteBuffer bufferedWrites = new ArrayList();
-
-/**
  * Exception that occurred during writing.
  */
 protected IOException e = null;
@@ -109,9 +105,9 @@ public class InternalNio2OutputBuffer ex
 if (attachment.hasRemaining()) {
 arrayList.add(attachment);
 }
-for (ByteBuffer buffer : bufferedWrites) {
+for (ByteBufferHolder buffer : bufferedWrites) {
 buffer.flip();
-arrayList.add(buffer);
+arrayList.add(buffer.getBuf());
 }
 bufferedWrites.clear();
 ByteBuffer[] array = 
arrayList.toArray(EMPTY_BUF_ARRAY);
@@ -164,9 +160,9 @@ public class InternalNio2OutputBuffer ex
 arrayList.add(buffer);
 }
 }
-for (ByteBuffer buffer : bufferedWrites) {
+for (ByteBufferHolder buffer : bufferedWrites) {
 buffer.flip();
-arrayList.add(buffer);
+arrayList.add(buffer.getBuf());
 }
 bufferedWrites.clear();
 ByteBuffer[] array = 
arrayList.toArray(EMPTY_BUF_ARRAY);
@@ -303,7 +299,7 @@ public class InternalNio2OutputBuffer ex
 private void addToBuffers(byte[] buf, int offset, int length) {
 ByteBuffer buffer = ByteBuffer.allocate(length);
 buffer.put(buf, offset, length);
-bufferedWrites.add(buffer);
+bufferedWrites.add(new ByteBufferHolder(buffer, false));
 }
 
 
@@ -336,8 +332,9 @@ public class InternalNio2OutputBuffer ex
 }
 try {
 if (bufferedWrites.size()  0) {
-for (ByteBuffer buffer : bufferedWrites) {
-buffer.flip();
+for (ByteBufferHolder holder : bufferedWrites) {
+holder.flip();
+ByteBuffer buffer = holder.getBuf();
 while (buffer.hasRemaining()) {
 if 
(socketWrapper.getSocket().write(buffer).get(socketWrapper.getTimeout(), 
TimeUnit.MILLISECONDS).intValue()  0) {
 throw new 
EOFException(sm.getString(iob.failedwrite));
@@ -383,9 +380,9 @@ public class InternalNio2OutputBuffer ex
 if (socketWriteBuffer.hasRemaining()) {
 arrayList.add(socketWriteBuffer);
 }
-for (ByteBuffer buffer : bufferedWrites) {
+for (ByteBufferHolder buffer : bufferedWrites) {
 buffer.flip();
-arrayList.add(buffer);
+arrayList.add(buffer.getBuf());
 }
 bufferedWrites.clear();
 ByteBuffer[] array = 
arrayList.toArray(EMPTY_BUF_ARRAY);



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1650269 - in /tomcat/trunk/java/org/apache: coyote/ajp/ coyote/http11/ coyote/http11/upgrade/ tomcat/util/net/

2015-01-08 Thread markt
Author: markt
Date: Thu Jan  8 13:09:54 2015
New Revision: 1650269

URL: http://svn.apache.org/r1650269
Log:
Move writes and associated buffers to SocketWrapper for NIO. NIO2/APR likely 
broken at this point.

Modified:
tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java
tomcat/trunk/java/org/apache/coyote/http11/AbstractOutputBuffer.java
tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java
tomcat/trunk/java/org/apache/coyote/http11/InternalNioOutputBuffer.java

tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeServletOutputStream.java
tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java
tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java

Modified: tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java?rev=1650269r1=1650268r2=1650269view=diff
==
--- tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java (original)
+++ tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java Thu Jan  8 
13:09:54 2015
@@ -24,8 +24,6 @@ import java.nio.ByteBuffer;
 import java.security.NoSuchProviderException;
 import java.security.cert.CertificateFactory;
 import java.security.cert.X509Certificate;
-import java.util.Iterator;
-import java.util.concurrent.LinkedBlockingDeque;
 import java.util.concurrent.atomic.AtomicBoolean;
 
 import javax.servlet.RequestDispatcher;
@@ -44,7 +42,6 @@ import org.apache.coyote.Response;
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
 import org.apache.tomcat.util.ExceptionUtils;
-import org.apache.tomcat.util.buf.ByteBufferHolder;
 import org.apache.tomcat.util.buf.ByteChunk;
 import org.apache.tomcat.util.buf.HexUtils;
 import org.apache.tomcat.util.buf.MessageBytes;
@@ -183,22 +180,6 @@ public class AjpProcessorS extends Abs
 
 
 /**
- * The max size of the buffered write buffer
- */
-private int bufferedWriteSize = 64*1024; //64k default write buffer
-
-
-/**
- * For non-blocking writes use an external set of buffers. Although the
- * API only allows one non-blocking write at a time, due to buffering and
- * the possible need to write HTTP headers, there may be more than one 
write
- * to the OutputBuffer.
- */
-private final LinkedBlockingDequeByteBufferHolder bufferedWrites =
-new LinkedBlockingDeque();
-
-
-/**
  * Host name (used to avoid useless B2C conversion on the host name).
  */
 protected char[] hostNameC = new char[0];
@@ -605,7 +586,7 @@ public class AjpProcessorS extends Abs
 }
 case NB_WRITE_INTEREST: {
 AtomicBoolean isReady = (AtomicBoolean)param;
-boolean result = bufferedWrites.size() == 0  responseMsgPos == 
-1;
+boolean result = !socketWrapper.hasDataToWrite()  responseMsgPos 
== -1;
 isReady.set(result);
 if (!result) {
 registerForEvent(false, true);
@@ -647,7 +628,8 @@ public class AjpProcessorS extends Abs
 asyncStateMachine.asyncOperation();
 try {
 if (hasDataToWrite()) {
-flushBufferedData();
+boolean blocking = (response.getWriteListener() == 
null);
+socketWrapper.flush(blocking);
 if (hasDataToWrite()) {
 // There is data to write but go via Response to
 // maintain a consistent view of non-blocking state
@@ -755,7 +737,7 @@ public class AjpProcessorS extends Abs
 }
 cping = true;
 try {
-output(pongMessageArray, 0, pongMessageArray.length, 
true);
+socketWrapper.write(true, pongMessageArray, 0, 
pongMessageArray.length);
 } catch (IOException e) {
 setErrorState(ErrorState.CLOSE_NOW, e);
 }
@@ -1053,7 +1035,7 @@ public class AjpProcessorS extends Abs
 
 // Request more data immediately
 if (!waitingForBodyMessage) {
-output(getBodyMessageArray, 0, getBodyMessageArray.length, true);
+socketWrapper.write(true, getBodyMessageArray, 0, 
getBodyMessageArray.length);
 waitingForBodyMessage = true;
 }
 
@@ -1460,7 +1442,7 @@ public class AjpProcessorS extends Abs
 
 // Write to buffer
 responseMessage.end();
-output(responseMessage.getBuffer(), 0, responseMessage.getLen(), true);
+socketWrapper.write(true, responseMessage.getBuffer(), 0, 
responseMessage.getLen());
 }
 
 
@@ -1473,7 +1455,7 @@ public class 

svn commit: r1650266 - /tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java

2015-01-08 Thread markt
Author: markt
Date: Thu Jan  8 13:09:36 2015
New Revision: 1650266

URL: http://svn.apache.org/r1650266
Log:
Never add to buffer once created so only allocate what is required.

Modified:
tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java

Modified: 
tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java?rev=1650266r1=1650265r2=1650266view=diff
==
--- tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java 
Thu Jan  8 13:09:36 2015
@@ -301,7 +301,7 @@ public class InternalNio2OutputBuffer ex
 
 
 private void addToBuffers(byte[] buf, int offset, int length) {
-ByteBuffer buffer = ByteBuffer.allocate(Math.max(bufferedWriteSize, 
length));
+ByteBuffer buffer = ByteBuffer.allocate(length);
 buffer.put(buf, offset, length);
 bufferedWrites.add(buffer);
 }



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1650271 - in /tomcat/trunk/java/org/apache: coyote/http11/InternalAprOutputBuffer.java tomcat/util/net/AprEndpoint.java tomcat/util/net/Nio2Endpoint.java tomcat/util/net/NioEndpoint.java

2015-01-08 Thread markt
Author: markt
Date: Thu Jan  8 13:10:05 2015
New Revision: 1650271

URL: http://svn.apache.org/r1650271
Log:
First (untested) pass at moving APR writes to SocketWrapper

Modified:
tomcat/trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java
tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java
tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java

Modified: 
tomcat/trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java?rev=1650271r1=1650270r2=1650271view=diff
==
--- tomcat/trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java Thu 
Jan  8 13:10:05 2015
@@ -19,14 +19,9 @@ package org.apache.coyote.http11;
 
 import java.io.IOException;
 import java.nio.ByteBuffer;
-import java.util.Iterator;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock;
 
 import org.apache.coyote.Response;
 import org.apache.tomcat.jni.Socket;
-import org.apache.tomcat.jni.Status;
-import org.apache.tomcat.util.buf.ByteBufferHolder;
 import org.apache.tomcat.util.net.AbstractEndpoint;
 import org.apache.tomcat.util.net.AprEndpoint;
 import org.apache.tomcat.util.net.SocketWrapperBase;
@@ -76,6 +71,7 @@ public class InternalAprOutputBuffer ext
 this.endpoint = socketWrapper.getEndpoint();
 
 Socket.setsbb(this.socket, socketWriteBuffer);
+socketWrapper.socketWriteBuffer = socketWriteBuffer;
 }
 
 
@@ -99,166 +95,25 @@ public class InternalAprOutputBuffer ext
 @Override
 public void sendAck() throws IOException {
 if (!committed) {
-if (Socket.send(socket, Constants.ACK_BYTES, 0, 
Constants.ACK_BYTES.length)  0)
+addToBB(Constants.ACK_BYTES, 0, Constants.ACK_BYTES.length);
+if (flushBuffer(true)) {
 throw new IOException(sm.getString(iob.failedwrite.ack));
-}
-}
-
-
-// -- Protected Methods
-
-@Override
-protected synchronized void addToBB(byte[] buf, int offset, int length)
-throws IOException {
-
-if (length == 0) return;
-
-// If bbuf is currently being used for writes, add this data to the
-// write buffer
-if (writeBufferFlipped) {
-addToBuffers(buf, offset, length);
-return;
-}
-
-// Keep writing until all the data is written or a non-blocking write
-// leaves data in the buffer
-while (length  0) {
-int thisTime = length;
-if (socketWriteBuffer.position() == socketWriteBuffer.capacity()) {
-if (flushBuffer(isBlocking())) {
-break;
-}
-}
-if (thisTime  socketWriteBuffer.capacity() - 
socketWriteBuffer.position()) {
-thisTime = socketWriteBuffer.capacity() - 
socketWriteBuffer.position();
 }
-socketWriteBuffer.put(buf, offset, thisTime);
-length = length - thisTime;
-offset = offset + thisTime;
-}
-
-if (!isBlocking()  length0) {
-// Buffer the remaining data
-addToBuffers(buf, offset, length);
 }
 }
 
 
-private void addToBuffers(byte[] buf, int offset, int length) {
-ByteBufferHolder holder = bufferedWrites.peekLast();
-if (holder==null || holder.isFlipped() || 
holder.getBuf().remaining()length) {
-ByteBuffer buffer = 
ByteBuffer.allocate(Math.max(bufferedWriteSize,length));
-holder = new ByteBufferHolder(buffer,false);
-bufferedWrites.add(holder);
-}
-holder.getBuf().put(buf,offset,length);
-}
-
+// -- Protected Methods
 
 @Override
-protected synchronized boolean flushBuffer(boolean block)
-throws IOException {
-
-if (hasMoreDataToFlush()) {
-writeToSocket(block);
-}
-
-if (bufferedWrites.size()  0) {
-IteratorByteBufferHolder bufIter = bufferedWrites.iterator();
-while (!hasMoreDataToFlush()  bufIter.hasNext()) {
-ByteBufferHolder buffer = bufIter.next();
-buffer.flip();
-while (!hasMoreDataToFlush()  buffer.getBuf().remaining()0) 
{
-transfer(buffer.getBuf(), socketWriteBuffer);
-if (buffer.getBuf().remaining() == 0) {
-bufIter.remove();
-}
-writeToSocket(block);
-   

svn commit: r1650272 - in /tomcat/trunk/java/org/apache/coyote/http11: AbstractOutputBuffer.java InternalAprOutputBuffer.java InternalNio2OutputBuffer.java InternalNioOutputBuffer.java

2015-01-08 Thread markt
Author: markt
Date: Thu Jan  8 13:10:10 2015
New Revision: 1650272

URL: http://svn.apache.org/r1650272
Log:
Pull up sendAck()

Modified:
tomcat/trunk/java/org/apache/coyote/http11/AbstractOutputBuffer.java
tomcat/trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java
tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java
tomcat/trunk/java/org/apache/coyote/http11/InternalNioOutputBuffer.java

Modified: tomcat/trunk/java/org/apache/coyote/http11/AbstractOutputBuffer.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/AbstractOutputBuffer.java?rev=1650272r1=1650271r2=1650272view=diff
==
--- tomcat/trunk/java/org/apache/coyote/http11/AbstractOutputBuffer.java 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/AbstractOutputBuffer.java Thu 
Jan  8 13:10:10 2015
@@ -378,7 +378,15 @@ public abstract class AbstractOutputBuff
 }
 
 
-public abstract void sendAck() throws IOException;
+public void sendAck() throws IOException {
+if (!committed) {
+addToBB(Constants.ACK_BYTES, 0, Constants.ACK_BYTES.length);
+if (flushBuffer(true)) {
+throw new IOException(sm.getString(iob.failedwrite.ack));
+}
+}
+}
+
 
 /**
  * Commit the response.

Modified: 
tomcat/trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java?rev=1650272r1=1650271r2=1650272view=diff
==
--- tomcat/trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java Thu 
Jan  8 13:10:10 2015
@@ -87,22 +87,6 @@ public class InternalAprOutputBuffer ext
 }
 
 
-//  HTTP/1.1 Output Methods
-
-/**
- * Send an acknowledgment.
- */
-@Override
-public void sendAck() throws IOException {
-if (!committed) {
-addToBB(Constants.ACK_BYTES, 0, Constants.ACK_BYTES.length);
-if (flushBuffer(true)) {
-throw new IOException(sm.getString(iob.failedwrite.ack));
-}
-}
-}
-
-
 // -- Protected Methods
 
 @Override

Modified: 
tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java?rev=1650272r1=1650271r2=1650272view=diff
==
--- tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java 
Thu Jan  8 13:10:10 2015
@@ -223,18 +223,6 @@ public class InternalNio2OutputBuffer ex
 writeBufferFlipped = false;
 }
 
-//  HTTP/1.1 Output Methods
-
-/**
- * Send an acknowledgment.
- */
-@Override
-public void sendAck() throws IOException {
-if (!committed) {
-addToBB(Constants.ACK_BYTES, 0, Constants.ACK_BYTES.length);
-flushBuffer(true);
-}
-}
 
 // -- Protected Methods
 

Modified: 
tomcat/trunk/java/org/apache/coyote/http11/InternalNioOutputBuffer.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/InternalNioOutputBuffer.java?rev=1650272r1=1650271r2=1650272view=diff
==
--- tomcat/trunk/java/org/apache/coyote/http11/InternalNioOutputBuffer.java 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/InternalNioOutputBuffer.java Thu 
Jan  8 13:10:10 2015
@@ -63,22 +63,6 @@ public class InternalNioOutputBuffer ext
 }
 
 
-//  HTTP/1.1 Output Methods
-
-/**
- * Send an acknowledgment.
- */
-@Override
-public void sendAck() throws IOException {
-if (!committed) {
-addToBB(Constants.ACK_BYTES, 0, Constants.ACK_BYTES.length);
-if (flushBuffer(true)) {
-throw new IOException(sm.getString(iob.failedwrite.ack));
-}
-}
-}
-
-
 // -- Protected Methods
 
 @Override
@@ -87,9 +71,6 @@ public class InternalNioOutputBuffer ext
 }
 
 
-/**
- * Callback to write data from the buffer.
- */
 @Override
 protected boolean flushBuffer(boolean block) throws IOException {
 return socketWrapper.flush(block);




svn commit: r1650274 - /tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java

2015-01-08 Thread markt
Author: markt
Date: Thu Jan  8 13:10:20 2015
New Revision: 1650274

URL: http://svn.apache.org/r1650274
Log:
Refactoring with an eye to NIO2.

Modified:
tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java?rev=1650274r1=1650273r2=1650274view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java Thu Jan 
 8 13:10:20 2015
@@ -292,7 +292,7 @@ public abstract class SocketWrapperBase
  */
 public void write(boolean block, byte[] b, int off, int len) throws 
IOException {
 // Always flush any data remaining in the buffers
-boolean dataLeft = flush(block);
+boolean dataLeft = flush(block, true);
 
 if (len == 0 || b == null) {
 return;
@@ -308,7 +308,7 @@ public abstract class SocketWrapperBase
 if (written == 0) {
 dataLeft = true;
 } else {
-dataLeft = flush(block);
+dataLeft = flush(block, true);
 }
 }
 
@@ -322,7 +322,6 @@ public abstract class SocketWrapperBase
 }
 
 
-
 /**
  * Writes as much data as possible from any that remains in the buffers.
  *
@@ -336,6 +335,28 @@ public abstract class SocketWrapperBase
  * @throws IOException If an IO error occurs during the write
  */
 public boolean flush(boolean block) throws IOException {
+return flush(block, false);
+}
+
+
+/**
+ * Writes as much data as possible from any that remains in the buffers.
+ * This method exists for those implementations (e.g. NIO2) that need
+ * slightly different behaviour depending on if flush() was called directly
+ * or by another method in this class or a sub-class.
+ *
+ * @param blockcodetruecode if a blocking write should be used,
+ * otherwise a non-blocking write will be used
+ * @param internal codetruecode if flush() was called by another method
+ * in class or sub-class
+ *
+ * @return codetrue/code if data remains to be flushed after this 
method
+ * completes, otherwise codefalse/code. In blocking mode
+ * therefore, the return value should always be codefalse/code
+ *
+ * @throws IOException If an IO error occurs during the write
+ */
+protected boolean flush(boolean block, boolean internal) throws 
IOException {
 
 // Prevent timeout for async
 access();



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1650273 - in /tomcat/trunk/java/org/apache/coyote/http11: InternalAprOutputBuffer.java InternalNioOutputBuffer.java

2015-01-08 Thread markt
Author: markt
Date: Thu Jan  8 13:10:15 2015
New Revision: 1650273

URL: http://svn.apache.org/r1650273
Log:
Aligning NIO and APR

Modified:
tomcat/trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java
tomcat/trunk/java/org/apache/coyote/http11/InternalNioOutputBuffer.java

Modified: 
tomcat/trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java?rev=1650273r1=1650272r2=1650273view=diff
==
--- tomcat/trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java Thu 
Jan  8 13:10:15 2015
@@ -21,8 +21,6 @@ import java.io.IOException;
 import java.nio.ByteBuffer;
 
 import org.apache.coyote.Response;
-import org.apache.tomcat.jni.Socket;
-import org.apache.tomcat.util.net.AbstractEndpoint;
 import org.apache.tomcat.util.net.AprEndpoint;
 import org.apache.tomcat.util.net.SocketWrapperBase;
 
@@ -50,27 +48,11 @@ public class InternalAprOutputBuffer ext
 }
 
 
-// - Instance Variables
-
-
-/**
- * Underlying socket.
- */
-private long socket;
-
-
-private AbstractEndpointLong endpoint;
-
-
 // - Public Methods
 
 @Override
 public void init(SocketWrapperBaseLong socketWrapper) {
 super.init(socketWrapper);
-socket = socketWrapper.getSocket().longValue();
-this.endpoint = socketWrapper.getEndpoint();
-
-Socket.setsbb(this.socket, socketWriteBuffer);
 socketWrapper.socketWriteBuffer = socketWriteBuffer;
 }
 
@@ -83,7 +65,6 @@ public class InternalAprOutputBuffer ext
 public void recycle() {
 super.recycle();
 socketWriteBuffer.clear();
-socket = 0;
 }
 
 
@@ -103,6 +84,7 @@ public class InternalAprOutputBuffer ext
 
 @Override
 protected void registerWriteInterest() {
-((AprEndpoint) endpoint).getPoller().add(socket, -1, false, true);
+((AprEndpoint) socketWrapper.getEndpoint()).getPoller().add(
+socketWrapper.getSocket().longValue(), -1, false, true);
 }
 }

Modified: 
tomcat/trunk/java/org/apache/coyote/http11/InternalNioOutputBuffer.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/InternalNioOutputBuffer.java?rev=1650273r1=1650272r2=1650273view=diff
==
--- tomcat/trunk/java/org/apache/coyote/http11/InternalNioOutputBuffer.java 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/InternalNioOutputBuffer.java Thu 
Jan  8 13:10:15 2015
@@ -59,7 +59,6 @@ public class InternalNioOutputBuffer ext
 public void recycle() {
 super.recycle();
 socketWriteBuffer.clear();
-socketWrapper = null;
 }
 
 



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1650275 - in /tomcat/trunk/java/org/apache: coyote/http11/ tomcat/util/net/

2015-01-08 Thread markt
Author: markt
Date: Thu Jan  8 13:10:26 2015
New Revision: 1650275

URL: http://svn.apache.org/r1650275
Log:
Push register write-interest down into the SocketWrapper

Modified:
tomcat/trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java
tomcat/trunk/java/org/apache/coyote/http11/InternalNioOutputBuffer.java
tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java
tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java

Modified: 
tomcat/trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java?rev=1650275r1=1650274r2=1650275view=diff
==
--- tomcat/trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java Thu 
Jan  8 13:10:26 2015
@@ -14,14 +14,12 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-
 package org.apache.coyote.http11;
 
 import java.io.IOException;
 import java.nio.ByteBuffer;
 
 import org.apache.coyote.Response;
-import org.apache.tomcat.util.net.AprEndpoint;
 import org.apache.tomcat.util.net.SocketWrapperBase;
 
 /**
@@ -83,8 +81,7 @@ public class InternalAprOutputBuffer ext
 
 
 @Override
-protected void registerWriteInterest() {
-((AprEndpoint) socketWrapper.getEndpoint()).getPoller().add(
-socketWrapper.getSocket().longValue(), -1, false, true);
+protected void registerWriteInterest() throws IOException {
+socketWrapper.registerWriteInterest();
 }
 }

Modified: 
tomcat/trunk/java/org/apache/coyote/http11/InternalNioOutputBuffer.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/InternalNioOutputBuffer.java?rev=1650275r1=1650274r2=1650275view=diff
==
--- tomcat/trunk/java/org/apache/coyote/http11/InternalNioOutputBuffer.java 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/InternalNioOutputBuffer.java Thu 
Jan  8 13:10:26 2015
@@ -14,15 +14,12 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-
 package org.apache.coyote.http11;
 
 import java.io.IOException;
-import java.nio.channels.SelectionKey;
 
 import org.apache.coyote.Response;
 import org.apache.tomcat.util.net.NioChannel;
-import org.apache.tomcat.util.net.NioEndpoint.NioSocketWrapper;
 import org.apache.tomcat.util.net.SocketWrapperBase;
 
 /**
@@ -78,6 +75,6 @@ public class InternalNioOutputBuffer ext
 
 @Override
 protected void registerWriteInterest() throws IOException {
-((NioSocketWrapper) 
socketWrapper).getPoller().add(socketWrapper.getSocket(), 
SelectionKey.OP_WRITE);
+socketWrapper.registerWriteInterest();
 }
 }

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java?rev=1650275r1=1650274r2=1650275view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java Thu Jan  8 
13:10:26 2015
@@ -2615,6 +2615,12 @@ public class AprEndpoint extends Abstrac
 
 
 @Override
+public void registerWriteInterest() throws IOException {
+((AprEndpoint) 
getEndpoint()).getPoller().add(getSocket().longValue(), -1, false, true);
+}
+
+
+@Override
 public void regsiterForEvent(boolean read, boolean write) {
 ((AprEndpoint) getEndpoint()).getPoller().add(
 getSocket().longValue(), -1, read, write);

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java?rev=1650275r1=1650274r2=1650275view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java Thu Jan  8 
13:10:26 2015
@@ -1070,10 +1070,17 @@ public class Nio2Endpoint extends Abstra
 
 
 @Override
+public void registerWriteInterest() throws IOException {
+// TODO Auto-generated method stub
+}
+
+
+@Override
 public void regsiterForEvent(boolean read, boolean write) {
 // NO-OP. Appropriate handlers will already have been registered.
 }
 
+
 @Override
 public boolean flush(boolean 

svn commit: r1650276 - in /tomcat/trunk: java/org/apache/coyote/http11/ java/org/apache/tomcat/util/net/ test/org/apache/coyote/http11/filters/

2015-01-08 Thread markt
Author: markt
Date: Thu Jan  8 13:10:34 2015
New Revision: 1650276

URL: http://svn.apache.org/r1650276
Log:
Fix failing NIO2 unit tests with a largish plaster until the writes are
fully moved to the NIO2 SocketWrapper.

Modified:
tomcat/trunk/java/org/apache/coyote/http11/AbstractOutputBuffer.java
tomcat/trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java
tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java
tomcat/trunk/java/org/apache/coyote/http11/InternalNioOutputBuffer.java
tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java
tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java
tomcat/trunk/test/org/apache/coyote/http11/filters/TesterOutputBuffer.java

Modified: tomcat/trunk/java/org/apache/coyote/http11/AbstractOutputBuffer.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/AbstractOutputBuffer.java?rev=1650276r1=1650275r2=1650276view=diff
==
--- tomcat/trunk/java/org/apache/coyote/http11/AbstractOutputBuffer.java 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/AbstractOutputBuffer.java Thu 
Jan  8 13:10:34 2015
@@ -20,7 +20,6 @@ import java.io.IOException;
 import java.nio.ByteBuffer;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
-import java.util.concurrent.LinkedBlockingDeque;
 
 import org.apache.coyote.ActionCode;
 import org.apache.coyote.OutputBuffer;
@@ -28,7 +27,6 @@ import org.apache.coyote.Response;
 import org.apache.coyote.http11.filters.GzipOutputFilter;
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
-import org.apache.tomcat.util.buf.ByteBufferHolder;
 import org.apache.tomcat.util.buf.ByteChunk;
 import org.apache.tomcat.util.buf.MessageBytes;
 import org.apache.tomcat.util.http.HttpMessages;
@@ -104,23 +102,6 @@ public abstract class AbstractOutputBuff
  */
 protected long byteCount = 0;
 
-protected ByteBuffer socketWriteBuffer;
-protected volatile boolean writeBufferFlipped;
-
-/**
- * For non-blocking writes use an external set of buffers. Although the
- * API only allows one non-blocking write at a time, due to buffering and
- * the possible need to write HTTP headers, there may be more than one 
write
- * to the OutputBuffer.
- */
-protected final LinkedBlockingDequeByteBufferHolder bufferedWrites =
-new LinkedBlockingDeque();
-
-/**
- * The max size of the buffered write buffer
- */
-protected int bufferedWriteSize = 64*1024; //64k default write buffer
-
 
 protected AbstractOutputBuffer(Response response, int headerBufferSize) {
 
@@ -208,16 +189,6 @@ public abstract class AbstractOutputBuff
 }
 
 
-public void setBufferedWriteSize(int bufferedWriteSize) {
-this.bufferedWriteSize = bufferedWriteSize;
-}
-
-
-public int getBufferedWriteSize() {
-return bufferedWriteSize;
-}
-
-
 // --- OutputBuffer Methods
 
 /**
@@ -321,8 +292,6 @@ public abstract class AbstractOutputBuff
 // Sub-classes may wish to do more than this.
 nextRequest();
 socketWrapper = null;
-bufferedWrites.clear();
-writeBufferFlipped = false;
 }
 
 /**
@@ -625,12 +594,6 @@ public abstract class AbstractOutputBuff
 protected abstract void registerWriteInterest() throws IOException;
 
 
-protected boolean hasMoreDataToFlush() {
-return (writeBufferFlipped  socketWriteBuffer.remaining()  0) ||
-(!writeBufferFlipped  socketWriteBuffer.position()  0);
-}
-
-
 /**
  * Writes any remaining buffered data.
  *

Modified: 
tomcat/trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java?rev=1650276r1=1650275r2=1650276view=diff
==
--- tomcat/trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java Thu 
Jan  8 13:10:34 2015
@@ -17,10 +17,8 @@
 package org.apache.coyote.http11;
 
 import java.io.IOException;
-import java.nio.ByteBuffer;
 
 import org.apache.coyote.Response;
-import org.apache.tomcat.util.net.SocketWrapperBase;
 
 /**
  * Output buffer.
@@ -35,34 +33,7 @@ public class InternalAprOutputBuffer ext
  * Default constructor.
  */
 public InternalAprOutputBuffer(Response response, int headerBufferSize) {
-
 super(response, headerBufferSize);
-
-if (headerBufferSize  (8 * 1024)) {
-socketWriteBuffer = ByteBuffer.allocateDirect(6 * 1500);
-} else {
-socketWriteBuffer = 

svn commit: r1650270 - in /tomcat/trunk/java/org/apache/tomcat/util/net: AprEndpoint.java NioEndpoint.java

2015-01-08 Thread markt
Author: markt
Date: Thu Jan  8 13:09:59 2015
New Revision: 1650270

URL: http://svn.apache.org/r1650270
Log:
Start to align write methods

Modified:
tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java?rev=1650270r1=1650269r2=1650270view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java Thu Jan  8 
13:09:59 2015
@@ -2506,7 +2506,10 @@ public class AprEndpoint extends Abstrac
 
 @Override
 public void write(boolean block, byte[] b, int off, int len) throws 
IOException {
+doWrite(block, b, off, len);
+}
 
+private void doWrite(boolean block, byte[] b, int off, int len) throws 
IOException {
 if (closed) {
 throw new IOException(sm.getString(apr.closed, getSocket()));
 }

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java?rev=1650270r1=1650269r2=1650270view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Thu Jan  8 
13:09:59 2015
@@ -1526,7 +1526,7 @@ public class NioEndpoint extends Abstrac
 int thisTime = transfer(b, off, len, socketWriteBuffer);
 len = len - thisTime;
 off = off + thisTime;
-int written = writeToSocket(socketWriteBuffer, block, true);
+int written = doWrite(socketWriteBuffer, block, true);
 if (written == 0) {
 dataLeft = true;
 } else {
@@ -1558,7 +1558,7 @@ public class NioEndpoint extends Abstrac
 
 //write to the socket, if there is anything to write
 if (dataLeft) {
-writeToSocket(socketWriteBuffer, block, !writeBufferFlipped);
+doWrite(socketWriteBuffer, block, !writeBufferFlipped);
 }
 
 dataLeft = hasMoreDataToFlush();
@@ -1573,7 +1573,7 @@ public class NioEndpoint extends Abstrac
 if (buffer.getBuf().remaining() == 0) {
 bufIter.remove();
 }
-writeToSocket(socketWriteBuffer, block, true);
+doWrite(socketWriteBuffer, block, true);
 //here we must break if we didn't finish the write
 }
 }
@@ -1594,7 +1594,7 @@ public class NioEndpoint extends Abstrac
 }
 
 
-private synchronized int writeToSocket(ByteBuffer bytebuffer, boolean 
block, boolean flip) throws IOException {
+private synchronized int doWrite(ByteBuffer bytebuffer, boolean block, 
boolean flip) throws IOException {
 if (flip) {
 bytebuffer.flip();
 writeBufferFlipped = true;



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1650277 - in /tomcat/trunk/java/org/apache: coyote/http11/ tomcat/util/net/

2015-01-08 Thread markt
Author: markt
Date: Thu Jan  8 13:10:41 2015
New Revision: 1650277

URL: http://svn.apache.org/r1650277
Log:
Partial NIO2 refactoring

Modified:
tomcat/trunk/java/org/apache/coyote/http11/AbstractOutputBuffer.java
tomcat/trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java
tomcat/trunk/java/org/apache/coyote/http11/InternalNio2InputBuffer.java
tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java
tomcat/trunk/java/org/apache/coyote/http11/InternalNioOutputBuffer.java
tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java
tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java

Modified: tomcat/trunk/java/org/apache/coyote/http11/AbstractOutputBuffer.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/AbstractOutputBuffer.java?rev=1650277r1=1650276r2=1650277view=diff
==
--- tomcat/trunk/java/org/apache/coyote/http11/AbstractOutputBuffer.java 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/AbstractOutputBuffer.java Thu 
Jan  8 13:10:41 2015
@@ -591,7 +591,7 @@ public abstract class AbstractOutputBuff
 
 //-- Non-blocking 
writes
 
-protected abstract void registerWriteInterest() throws IOException;
+protected abstract void registerWriteInterest();
 
 
 /**

Modified: 
tomcat/trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java?rev=1650277r1=1650276r2=1650277view=diff
==
--- tomcat/trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java Thu 
Jan  8 13:10:41 2015
@@ -52,7 +52,7 @@ public class InternalAprOutputBuffer ext
 
 
 @Override
-protected void registerWriteInterest() throws IOException {
+protected void registerWriteInterest() {
 socketWrapper.registerWriteInterest();
 }
 }

Modified: 
tomcat/trunk/java/org/apache/coyote/http11/InternalNio2InputBuffer.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/InternalNio2InputBuffer.java?rev=1650277r1=1650276r2=1650277view=diff
==
--- tomcat/trunk/java/org/apache/coyote/http11/InternalNio2InputBuffer.java 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/InternalNio2InputBuffer.java Thu 
Jan  8 13:10:41 2015
@@ -172,12 +172,12 @@ public class InternalNio2InputBuffer ext
 
 @Override
 public void failed(Throwable exc, SocketWrapperBaseNio2Channel 
attachment) {
-attachment.setError(true);
 if (exc instanceof IOException) {
 e = (IOException) exc;
 } else {
 e = new IOException(exc);
 }
+attachment.setError(e);
 request.setAttribute(RequestDispatcher.ERROR_EXCEPTION, e);
 readPending = false;
 endpoint.processSocket(attachment, SocketStatus.OPEN_READ, 
true);

Modified: 
tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java?rev=1650277r1=1650276r2=1650277view=diff
==
--- tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java 
Thu Jan  8 13:10:41 2015
@@ -21,22 +21,16 @@ import java.io.EOFException;
 import java.io.IOException;
 import java.net.SocketTimeoutException;
 import java.nio.ByteBuffer;
-import java.nio.channels.CompletionHandler;
 import java.util.ArrayList;
 import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Semaphore;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
 
-import javax.servlet.RequestDispatcher;
-
 import org.apache.coyote.Response;
 import org.apache.tomcat.util.buf.ByteBufferHolder;
-import org.apache.tomcat.util.net.AbstractEndpoint;
 import org.apache.tomcat.util.net.Nio2Channel;
 import org.apache.tomcat.util.net.Nio2Endpoint;
-import org.apache.tomcat.util.net.SocketStatus;
-import org.apache.tomcat.util.net.SocketWrapperBase;
+import org.apache.tomcat.util.net.Nio2Endpoint.Nio2SocketWrapper;
 
 /**
  * Output buffer implementation for NIO2.
@@ -52,186 +46,9 @@ public class InternalNio2OutputBuffer ex
 super(response, headerBufferSize);
 }
 
-

svn commit: r1650278 - in /tomcat/trunk/java/org/apache: coyote/http11/InternalNio2OutputBuffer.java tomcat/util/net/Nio2Endpoint.java tomcat/util/net/SocketWrapperBase.java

2015-01-08 Thread markt
Author: markt
Date: Thu Jan  8 13:10:46 2015
New Revision: 1650278

URL: http://svn.apache.org/r1650278
Log:
Untested first pass at pushing down NIO2 writes.

Modified:
tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java
tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java
tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java

Modified: 
tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java?rev=1650278r1=1650277r2=1650278view=diff
==
--- tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java 
Thu Jan  8 13:10:46 2015
@@ -17,20 +17,10 @@
 
 package org.apache.coyote.http11;
 
-import java.io.EOFException;
 import java.io.IOException;
-import java.net.SocketTimeoutException;
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
 
 import org.apache.coyote.Response;
-import org.apache.tomcat.util.buf.ByteBufferHolder;
 import org.apache.tomcat.util.net.Nio2Channel;
-import org.apache.tomcat.util.net.Nio2Endpoint;
-import org.apache.tomcat.util.net.Nio2Endpoint.Nio2SocketWrapper;
 
 /**
  * Output buffer implementation for NIO2.
@@ -50,178 +40,16 @@ public class InternalNio2OutputBuffer ex
 // -- Protected Methods
 
 @Override
-protected void addToBB(byte[] buf, int offset, int length)
-throws IOException {
-
-if (length == 0)
-return;
-if (socketWrapper == null || socketWrapper.getSocket() == null)
-return;
-
-if (isBlocking()) {
-while (length  0) {
-int thisTime = transfer(buf, offset, length, 
socketWrapper.socketWriteBuffer);
-length = length - thisTime;
-offset = offset + thisTime;
-if (socketWrapper.socketWriteBuffer.remaining() == 0) {
-flushBuffer(true);
-}
-}
-} else {
-// FIXME: Possible new behavior:
-// If there's non blocking abuse (like a test writing 1MB in a 
single
-// non blocking write), then block until the previous write is
-// done rather than continue buffering
-// Also allows doing autoblocking
-// Could be smart with coordination with the main 
CoyoteOutputStream to
-// indicate the end of a write
-// Uses: if (writePending.tryAcquire(socketWrapper.getTimeout(), 
TimeUnit.MILLISECONDS))
-if (((Nio2SocketWrapper)socketWrapper).writePending.tryAcquire()) {
-synchronized 
(((Nio2SocketWrapper)socketWrapper).writeCompletionHandler) {
-// No pending completion handler, so writing to the main 
buffer
-// is possible
-int thisTime = transfer(buf, offset, length, 
socketWrapper.socketWriteBuffer);
-length = length - thisTime;
-offset = offset + thisTime;
-if (length  0) {
-// Remaining data must be buffered
-addToBuffers(buf, offset, length);
-}
-flushBufferInternal(false, true);
-}
-} else {
-synchronized 
(((Nio2SocketWrapper)socketWrapper).writeCompletionHandler) {
-addToBuffers(buf, offset, length);
-}
-}
-}
-}
-
-
-private void addToBuffers(byte[] buf, int offset, int length) {
-ByteBuffer buffer = ByteBuffer.allocate(length);
-buffer.put(buf, offset, length);
-socketWrapper.bufferedWrites.add(new ByteBufferHolder(buffer, false));
+protected void addToBB(byte[] buf, int offset, int length) throws 
IOException {
+socketWrapper.write(isBlocking(), buf, offset, length);
 }
 
 
-/**
- * Callback to write data from the buffer.
- */
 @Override
 protected boolean flushBuffer(boolean block) throws IOException {
-if (socketWrapper.getError() != null) {
-throw socketWrapper.getError();
-}
-return flushBufferInternal(block, false);
+return socketWrapper.flush(block);
 }
 
-private boolean flushBufferInternal(boolean block, boolean hasPermit) 
throws IOException {
-if (socketWrapper == null || socketWrapper.getSocket() == null)
-return false;
-
-if (block) {
-if (!isBlocking()) {
-// The final flush is blocking, but the processing was using
-  

svn commit: r1650283 - /tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java

2015-01-08 Thread markt
Author: markt
Date: Thu Jan  8 13:11:13 2015
New Revision: 1650283

URL: http://svn.apache.org/r1650283
Log:
Better comment

Modified:
tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java?rev=1650283r1=1650282r2=1650283view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java Thu Jan  8 
13:11:13 2015
@@ -1139,7 +1139,8 @@ public class Nio2Endpoint extends Abstra
 
 @Override
 protected int doWrite(ByteBuffer buffer, boolean block, boolean flip) 
throws IOException {
-// NO-OP for NIO2 since write() is over-ridden above.
+// NO-OP for NIO2 since write(boolean, byte[], int, int)  and
+// flush(boolean, boolean) are over-ridden.
 return 0;
 }
 



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1650285 - /tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java

2015-01-08 Thread markt
Author: markt
Date: Thu Jan  8 13:11:24 2015
New Revision: 1650285

URL: http://svn.apache.org/r1650285
Log:
Rework notify to handle nested inline completion handlers correctly.

Modified:
tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java?rev=1650285r1=1650284r2=1650285view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java Thu Jan  8 
13:11:24 2015
@@ -714,6 +714,13 @@ public class Nio2Endpoint extends Abstra
 
 public static class Nio2SocketWrapper extends 
SocketWrapperBaseNio2Channel {
 
+private static final ThreadLocalBoolean writeCompletionInProgress = 
new ThreadLocalBoolean() {
+@Override
+protected Boolean initialValue() {
+return Boolean.FALSE;
+}
+};
+
 private SendfileData sendfileData = null;
 private boolean upgradeInit = false;
 
@@ -726,6 +733,7 @@ public class Nio2Endpoint extends Abstra
 private final CompletionHandlerLong, ByteBuffer[] 
gatheringWriteCompletionHandler;
 private final Semaphore writePending = new Semaphore(1);
 private volatile boolean writeInterest = true;
+private boolean writeNotify = false;
 
 
 public Nio2SocketWrapper(Nio2Channel channel, Nio2Endpoint endpoint) {
@@ -774,11 +782,12 @@ public class Nio2Endpoint extends Abstra
 this.writeCompletionHandler = new CompletionHandlerInteger, 
ByteBuffer() {
 @Override
 public void completed(Integer nBytes, ByteBuffer attachment) {
-boolean notify = false;
+writeNotify = false;
 synchronized (writeCompletionHandler) {
 if (nBytes.intValue()  0) {
 failed(new 
EOFException(sm.getString(iob.failedwrite)), attachment);
 } else if 
(Nio2SocketWrapper.this.bufferedWrites.size()  0) {
+writeCompletionInProgress.set(Boolean.TRUE);
 // Continue writing data using a gathering write
 ArrayListByteBuffer arrayList = new 
ArrayList();
 if (attachment.hasRemaining()) {
@@ -793,22 +802,25 @@ public class Nio2Endpoint extends Abstra
 Nio2SocketWrapper.this.getSocket().write(array, 0, 
array.length,
 Nio2SocketWrapper.this.getTimeout(), 
TimeUnit.MILLISECONDS,
 array, gatheringWriteCompletionHandler);
+writeCompletionInProgress.set(Boolean.FALSE);
 } else if (attachment.hasRemaining()) {
 // Regular write
+writeCompletionInProgress.set(Boolean.TRUE);
 
Nio2SocketWrapper.this.getSocket().write(attachment, 
Nio2SocketWrapper.this.getTimeout(),
 TimeUnit.MILLISECONDS, attachment, 
writeCompletionHandler);
+writeCompletionInProgress.set(Boolean.FALSE);
 } else {
 // All data has been written
-if (writeInterest  !Nio2Endpoint.isInline()) {
+if (writeInterest) {
 writeInterest = false;
-notify = true;
+writeNotify = true;
 }
 writePending.release();
 socketWriteBuffer.clear();
 writeBufferFlipped = false;
 }
 }
-if (notify) {
+if (writeNotify  
!writeCompletionInProgress.get().booleanValue()) {
 endpoint.processSocket(Nio2SocketWrapper.this, 
SocketStatus.OPEN_WRITE, false);
 }
 }
@@ -830,12 +842,13 @@ public class Nio2Endpoint extends Abstra
 gatheringWriteCompletionHandler = new CompletionHandlerLong, 
ByteBuffer[]() {
 @Override
 public void completed(Long nBytes, ByteBuffer[] attachment) {
-boolean notify = false;
+writeNotify = false;
 synchronized (writeCompletionHandler) {
 if (nBytes.longValue()  0) {
 failed(new 
EOFException(sm.getString(iob.failedwrite)), attachment);
 } else if 
(Nio2SocketWrapper.this.bufferedWrites.size()  0 || 

svn commit: r1650286 - in /tomcat/trunk/java/org/apache: coyote/ajp/AjpProcessor.java coyote/http11/upgrade/UpgradeServletOutputStream.java tomcat/util/net/Nio2Endpoint.java tomcat/util/net/SocketWrap

2015-01-08 Thread markt
Author: markt
Date: Thu Jan  8 13:11:31 2015
New Revision: 1650286

URL: http://svn.apache.org/r1650286
Log:
Differentiate between checking to see if OutputBuffer has data to write
and isReady() (for write). The later requires a write registration if it
is not ready.

Modified:
tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java

tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeServletOutputStream.java
tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java
tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java

Modified: tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java?rev=1650286r1=1650285r2=1650286view=diff
==
--- tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java (original)
+++ tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java Thu Jan  8 
13:11:31 2015
@@ -586,7 +586,7 @@ public class AjpProcessorS extends Abs
 }
 case NB_WRITE_INTEREST: {
 AtomicBoolean isReady = (AtomicBoolean)param;
-boolean result = !socketWrapper.hasDataToWrite()  responseMsgPos 
== -1;
+boolean result = socketWrapper.isReadyForWrite()  responseMsgPos 
== -1;
 isReady.set(result);
 if (!result) {
 registerForEvent(false, true);

Modified: 
tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeServletOutputStream.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeServletOutputStream.java?rev=1650286r1=1650285r2=1650286view=diff
==
--- 
tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeServletOutputStream.java
 (original)
+++ 
tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeServletOutputStream.java
 Thu Jan  8 13:11:31 2015
@@ -72,7 +72,7 @@ public class UpgradeServletOutputStream
 // Make sure isReady() and onWritePossible() have a consistent view of
 // buffer and fireListener when determining if the listener should fire
 synchronized (fireListenerLock) {
-boolean result = !socketWrapper.hasDataToWrite();
+boolean result = socketWrapper.isReadyForWrite();
 fireListener = !result;
 return result;
 }
@@ -170,7 +170,7 @@ public class UpgradeServletOutputStream
 // should fire
 boolean fire = false;
 synchronized (fireListenerLock) {
-if (!socketWrapper.hasDataToWrite()  fireListener) {
+if (socketWrapper.isReadyForWrite()  fireListener) {
 fireListener = false;
 fire = true;
 }

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java?rev=1650286r1=1650285r2=1650286view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java Thu Jan  8 
13:11:31 2015
@@ -1268,6 +1268,16 @@ public class Nio2Endpoint extends Abstra
 
 
 @Override
+public boolean isReadyForWrite() {
+boolean result = super.isReadyForWrite();
+if (!result) {
+writeInterest = true;
+}
+return result;
+}
+
+
+@Override
 public void registerWriteInterest() {
 synchronized (writeCompletionHandler) {
 if (writePending.availablePermits() == 0) {

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java?rev=1650286r1=1650285r2=1650286view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java Thu Jan 
 8 13:11:31 2015
@@ -198,6 +198,9 @@ public abstract class SocketWrapperBase
 return hasMoreDataToFlush() || hasBufferedData();
 }
 
+public boolean isReadyForWrite() {
+return !hasDataToWrite();
+}
 
 public void addDispatch(DispatchType dispatchType) {
 synchronized (dispatches) {



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1650287 - /tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java

2015-01-08 Thread markt
Author: markt
Date: Thu Jan  8 13:11:36 2015
New Revision: 1650287

URL: http://svn.apache.org/r1650287
Log:
Fix regression in APR refactoring

Modified:
tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java?rev=1650287r1=1650286r2=1650287view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java Thu Jan  8 
13:11:36 2015
@@ -2572,7 +2572,6 @@ public class AprEndpoint extends Abstrac
 sslOutputBuffer.clear();
 transfer(bytebuffer, sslOutputBuffer);
 sslOutputBuffer.flip();
-thisTime = sslOutputBuffer.remaining();
 } else {
 // Buffer still has data from previous attempt to write
 // APR + SSL requires that exactly the same parameters 
are



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1650280 - /tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java

2015-01-08 Thread markt
Author: markt
Date: Thu Jan  8 13:10:59 2015
New Revision: 1650280

URL: http://svn.apache.org/r1650280
Log:
Fix failing unit test
testMessagesBlocking(org.apache.coyote.http11.upgrade.TestUpgrade)

Modified:
tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java?rev=1650280r1=1650279r2=1650280view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java Thu Jan  8 
13:10:59 2015
@@ -1099,9 +1099,7 @@ public class Nio2Endpoint extends Abstra
 int thisTime = transfer(buf, off, len, socketWriteBuffer);
 len = len - thisTime;
 off = off + thisTime;
-if (socketWriteBuffer.remaining() == 0) {
-flush(true);
-}
+flush(true);
 }
 } else {
 // FIXME: Possible new behavior:



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1650279 - in /tomcat/trunk: java/org/apache/coyote/http11/ test/org/apache/coyote/http11/filters/

2015-01-08 Thread markt
Author: markt
Date: Thu Jan  8 13:10:54 2015
New Revision: 1650279

URL: http://svn.apache.org/r1650279
Log:
Drop implementation specific InternalXxxOutputBuffer implementations and
make the abstract base class the only concrete implementation.

Added:
tomcat/trunk/java/org/apache/coyote/http11/Http11OutputBuffer.java   
(contents, props changed)
  - copied, changed from r1650278, 
tomcat/trunk/java/org/apache/coyote/http11/AbstractOutputBuffer.java
Removed:
tomcat/trunk/java/org/apache/coyote/http11/AbstractOutputBuffer.java
tomcat/trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java
tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java
tomcat/trunk/java/org/apache/coyote/http11/InternalNioOutputBuffer.java
Modified:
tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java
tomcat/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java
tomcat/trunk/java/org/apache/coyote/http11/Http11Nio2Processor.java
tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java
tomcat/trunk/test/org/apache/coyote/http11/filters/TesterOutputBuffer.java

Modified: 
tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java?rev=1650279r1=1650278r2=1650279view=diff
==
--- tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java Thu 
Jan  8 13:10:54 2015
@@ -78,7 +78,7 @@ public abstract class AbstractHttp11Proc
 /**
  * Output.
  */
-protected AbstractOutputBufferS outputBuffer;
+protected Http11OutputBufferS outputBuffer;
 
 
 /**
@@ -624,7 +624,7 @@ public abstract class AbstractHttp11Proc
  * Exposes output buffer to super class to allow better code re-use.
  * @return  The output buffer used by the processor.
  */
-protected AbstractOutputBufferS getOutputBuffer() {
+protected Http11OutputBufferS getOutputBuffer() {
 return outputBuffer;
 }
 
@@ -858,12 +858,7 @@ public abstract class AbstractHttp11Proc
 }
 case NB_WRITE_INTEREST: {
 AtomicBoolean isReady = (AtomicBoolean)param;
-try {
-isReady.set(getOutputBuffer().isReady());
-} catch (IOException e) {
-getLog().debug(isReady() failed, e);
-setErrorState(ErrorState.CLOSE_NOW, e);
-}
+isReady.set(getOutputBuffer().isReady());
 break;
 }
 case NB_READ_INTEREST: {

Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java?rev=1650279r1=1650278r2=1650279view=diff
==
--- tomcat/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java Thu Jan  
8 13:10:54 2015
@@ -60,7 +60,7 @@ public class Http11AprProcessor extends
 inputBuffer = new InternalAprInputBuffer(request, headerBufferSize);
 request.setInputBuffer(getInputBuffer());
 
-outputBuffer = new InternalAprOutputBuffer(response, headerBufferSize);
+outputBuffer = new Http11OutputBuffer(response, headerBufferSize);
 response.setOutputBuffer(getOutputBuffer());
 
 initializeFilters(maxTrailerSize, maxExtensionSize, maxSwallowSize);

Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11Nio2Processor.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11Nio2Processor.java?rev=1650279r1=1650278r2=1650279view=diff
==
--- tomcat/trunk/java/org/apache/coyote/http11/Http11Nio2Processor.java 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/Http11Nio2Processor.java Thu Jan 
 8 13:10:54 2015
@@ -64,7 +64,7 @@ public class Http11Nio2Processor extends
 inputBuffer = new InternalNio2InputBuffer(request, maxHttpHeaderSize);
 request.setInputBuffer(getInputBuffer());
 
-outputBuffer = new InternalNio2OutputBuffer(response, 
maxHttpHeaderSize);
+outputBuffer = new Http11OutputBuffer(response, maxHttpHeaderSize);
 response.setOutputBuffer(getOutputBuffer());
 
 initializeFilters(maxTrailerSize, maxExtensionSize, maxSwallowSize);
@@ -99,7 +99,7 @@ public class Http11Nio2Processor extends
 ((InternalNio2InputBuffer) 
getInputBuffer()).registerReadInterest();
 }
 if (write) {
-((InternalNio2OutputBuffer) 
getOutputBuffer()).registerWriteInterest();
+((Http11OutputBuffer?) 

svn commit: r1650282 - /tomcat/trunk/java/org/apache/catalina/security/SecurityClassLoad.java

2015-01-08 Thread markt
Author: markt
Date: Thu Jan  8 13:11:09 2015
New Revision: 1650282

URL: http://svn.apache.org/r1650282
Log:
Update class name

Modified:
tomcat/trunk/java/org/apache/catalina/security/SecurityClassLoad.java

Modified: tomcat/trunk/java/org/apache/catalina/security/SecurityClassLoad.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/security/SecurityClassLoad.java?rev=1650282r1=1650281r2=1650282view=diff
==
--- tomcat/trunk/java/org/apache/catalina/security/SecurityClassLoad.java 
(original)
+++ tomcat/trunk/java/org/apache/catalina/security/SecurityClassLoad.java Thu 
Jan  8 13:11:09 2015
@@ -163,7 +163,7 @@ public final class SecurityClassLoad {
 private static final void loadCoyotePackage(ClassLoader loader)
 throws Exception {
 final String basePackage = org.apache.coyote.;
-loader.loadClass(basePackage + http11.AbstractOutputBuffer$1);
+loader.loadClass(basePackage + http11.Http11OutputBuffer$1);
 loader.loadClass(basePackage + http11.Constants);
 // Make sure system property is read at this point
 Class? clazz = loader.loadClass(basePackage + Constants);



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1650281 - /tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java

2015-01-08 Thread markt
Author: markt
Date: Thu Jan  8 13:11:04 2015
New Revision: 1650281

URL: http://svn.apache.org/r1650281
Log:
Separate readInterest and writeInterest
Fix failing unit test
testMessagesNonBlocking(org.apache.coyote.http11.upgrade.TestUpgrade)

Modified:
tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java?rev=1650281r1=1650280r2=1650281view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java Thu Jan  8 
13:11:04 2015
@@ -720,11 +720,12 @@ public class Nio2Endpoint extends Abstra
 private final CompletionHandlerInteger, 
SocketWrapperBaseNio2Channel readCompletionHandler;
 private boolean flipped = false;
 private volatile boolean readPending = false;
-private volatile boolean interest = true;
+private volatile boolean readInterest = true;
 
 private final CompletionHandlerInteger, ByteBuffer 
writeCompletionHandler;
 private final CompletionHandlerLong, ByteBuffer[] 
gatheringWriteCompletionHandler;
 private final Semaphore writePending = new Semaphore(1);
+private volatile boolean writeInterest = true;
 
 
 public Nio2SocketWrapper(Nio2Channel channel, Nio2Endpoint endpoint) {
@@ -735,15 +736,15 @@ public class Nio2Endpoint extends Abstra
 public void completed(Integer nBytes, 
SocketWrapperBaseNio2Channel attachment) {
 boolean notify = false;
 if (log.isDebugEnabled()) {
-log.debug(Socket: [ +  + attachment + ], Interest: 
[ + interest + ]);
+log.debug(Socket: [ +  + attachment + ], Interest: 
[ + readInterest + ]);
 }
 synchronized (readCompletionHandler) {
 if (nBytes.intValue()  0) {
 failed(new EOFException(), attachment);
 } else {
 readPending = false;
-if (interest  !Nio2Endpoint.isInline()) {
-interest = false;
+if (readInterest  !Nio2Endpoint.isInline()) {
+readInterest = false;
 notify = true;
 }
 }
@@ -798,11 +799,13 @@ public class Nio2Endpoint extends Abstra
 TimeUnit.MILLISECONDS, attachment, 
writeCompletionHandler);
 } else {
 // All data has been written
-if (interest  !Nio2Endpoint.isInline()) {
-interest = false;
+if (writeInterest  !Nio2Endpoint.isInline()) {
+writeInterest = false;
 notify = true;
 }
 writePending.release();
+socketWriteBuffer.clear();
+writeBufferFlipped = false;
 }
 }
 if (notify) {
@@ -850,11 +853,13 @@ public class Nio2Endpoint extends Abstra
 array, gatheringWriteCompletionHandler);
 } else {
 // All data has been written
-if (interest  !Nio2Endpoint.isInline()) {
-interest = false;
+if (writeInterest  !Nio2Endpoint.isInline()) {
+writeInterest = false;
 notify = true;
 }
 writePending.release();
+socketWriteBuffer.clear();
+writeBufferFlipped = false;
 }
 }
 if (notify) {
@@ -923,7 +928,7 @@ public class Nio2Endpoint extends Abstra
 public boolean isReady() throws IOException {
 synchronized (readCompletionHandler) {
 if (readPending) {
-interest = true;
+readInterest = true;
 return false;
 }
 ByteBuffer readBuffer = 
getSocket().getBufHandler().getReadBuffer();
@@ -946,7 +951,7 @@ public class Nio2Endpoint extends Abstra
 flipped = true;
 }
 } else {
-interest = true;
+readInterest = true;
 }
 return isReady;
  

svn commit: r1650284 - in /tomcat/trunk: java/org/apache/coyote/http11/Http11OutputBuffer.java test/org/apache/coyote/http11/filters/TesterOutputBuffer.java

2015-01-08 Thread markt
Author: markt
Date: Thu Jan  8 13:11:19 2015
New Revision: 1650284

URL: http://svn.apache.org/r1650284
Log:
Simplify - call socketWrapper.write() directly

Modified:
tomcat/trunk/java/org/apache/coyote/http11/Http11OutputBuffer.java
tomcat/trunk/test/org/apache/coyote/http11/filters/TesterOutputBuffer.java

Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11OutputBuffer.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11OutputBuffer.java?rev=1650284r1=1650283r2=1650284view=diff
==
--- tomcat/trunk/java/org/apache/coyote/http11/Http11OutputBuffer.java 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/Http11OutputBuffer.java Thu Jan  
8 13:11:19 2015
@@ -350,7 +350,7 @@ public class Http11OutputBufferS imple
 
 public void sendAck() throws IOException {
 if (!committed) {
-addToBB(Constants.ACK_BYTES, 0, Constants.ACK_BYTES.length);
+socketWrapper.write(isBlocking(), Constants.ACK_BYTES, 0, 
Constants.ACK_BYTES.length);
 if (flushBuffer(true)) {
 throw new IOException(sm.getString(iob.failedwrite.ack));
 }
@@ -370,7 +370,7 @@ public class Http11OutputBufferS imple
 
 if (pos  0) {
 // Sending the response header buffer
-addToBB(headerBuffer, 0, pos);
+socketWrapper.write(isBlocking(), headerBuffer, 0, pos);
 }
 }
 
@@ -587,11 +587,6 @@ public class Http11OutputBufferS imple
 }
 
 
-protected void addToBB(byte[] buf, int offset, int length) throws 
IOException {
-socketWrapper.write(isBlocking(), buf, offset, length);
-}
-
-
 //-- Non-blocking 
writes
 
 protected void registerWriteInterest() {
@@ -668,7 +663,7 @@ public class Http11OutputBufferS imple
 int len = chunk.getLength();
 int start = chunk.getStart();
 byte[] b = chunk.getBuffer();
-addToBB(b, start, len);
+socketWrapper.write(isBlocking(), b, start, len);
 byteCount += len;
 return len;
 }

Modified: 
tomcat/trunk/test/org/apache/coyote/http11/filters/TesterOutputBuffer.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/coyote/http11/filters/TesterOutputBuffer.java?rev=1650284r1=1650283r2=1650284view=diff
==
--- tomcat/trunk/test/org/apache/coyote/http11/filters/TesterOutputBuffer.java 
(original)
+++ tomcat/trunk/test/org/apache/coyote/http11/filters/TesterOutputBuffer.java 
Thu Jan  8 13:11:19 2015
@@ -94,13 +94,6 @@ public class TesterOutputBuffer extends
 }
 
 
-@Override
-protected void addToBB(byte[] buf, int offset, int length)
-throws IOException {
-// NO-OP: Unused
-}
-
-
 /*
  * Expose data written for use by unit tests.
  */



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1650288 - /tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java

2015-01-08 Thread markt
Author: markt
Date: Thu Jan  8 13:11:40 2015
New Revision: 1650288

URL: http://svn.apache.org/r1650288
Log:
Fix another APR refactoring regression

Modified:
tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java?rev=1650288r1=1650287r2=1650288view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java Thu Jan  8 
13:11:40 2015
@@ -2617,6 +2617,16 @@ public class AprEndpoint extends Abstrac
 
 
 @Override
+public boolean isReadyForWrite() {
+boolean result = super.isReadyForWrite();
+if (!result) {
+registerWriteInterest();
+}
+return result;
+}
+
+
+@Override
 public void registerWriteInterest() {
 ((AprEndpoint) 
getEndpoint()).getPoller().add(getSocket().longValue(), -1, false, true);
 }



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1650289 - /tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java

2015-01-08 Thread markt
Author: markt
Date: Thu Jan  8 13:11:45 2015
New Revision: 1650289

URL: http://svn.apache.org/r1650289
Log:
Add TODO

Modified:
tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java?rev=1650289r1=1650288r2=1650289view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java Thu Jan 
 8 13:11:45 2015
@@ -199,6 +199,7 @@ public abstract class SocketWrapperBase
 }
 
 public boolean isReadyForWrite() {
+// TODO Review use of this, hasDataForWrite() and 
registerWriteInterest()
 return !hasDataToWrite();
 }
 



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Re: svn commit: r1650268 - /tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java

2015-01-08 Thread Rémy Maucherat
2015-01-08 14:09 GMT+01:00 ma...@apache.org:

 Author: markt
 Date: Thu Jan  8 13:09:47 2015
 New Revision: 1650268

 URL: http://svn.apache.org/r1650268
 Log:
 DequeByteBufferHolder is a little more complex than ListByteBuffer
 but using the same structure for all connectors will improve code re-use
 and thereby improve maintainability.

 When I tried that originally in this connector, I ran into corruption
problems. Maybe it is fine now, but it is worth running the relevant
testsuite sections repeatedly just in case. Also it adds an additional
layer of objects without providing additional reuse I could see, so this
structure should be removed IMO rather than generalized.

Rémy


Re: svn commit: r1650277 - in /tomcat/trunk/java/org/apache: coyote/http11/ tomcat/util/net/

2015-01-08 Thread Rémy Maucherat
2015-01-08 14:10 GMT+01:00 ma...@apache.org:

 @@ -766,32 +776,120 @@ public class Nio2Endpoint extends Abstra
  this.writeCompletionHandler = new CompletionHandlerInteger,
 ByteBuffer() {
  @Override
  public void completed(Integer nBytes, ByteBuffer
 attachment) {
 -if (nBytes.intValue()  0) {
 -failed(new EOFException(), attachment);
 -} else if (attachment.hasRemaining()) {
 -getSocket().write(attachment, getTimeout(),
 -TimeUnit.MILLISECONDS, attachment,
 writeCompletionHandler);
 -} else {
 -writePending.release();
 -if (!Nio2Endpoint.isInline()) {
 -
 getEndpoint().processSocket(Nio2SocketWrapper.this,
 SocketStatus.OPEN_WRITE, false);
 +boolean notify = false;
 +synchronized (writeCompletionHandler) {
 +if (nBytes.intValue()  0) {
 +failed(new
 EOFException(sm.getString(iob.failedwrite)), attachment);
 +} else if
 (Nio2SocketWrapper.this.bufferedWrites.size()  0) {
 +// Continue writing data using a gathering
 write
 +ArrayListByteBuffer arrayList = new
 ArrayList();
 +if (attachment.hasRemaining()) {
 +arrayList.add(attachment);
 +}
 +for (ByteBufferHolder buffer :
 Nio2SocketWrapper.this.bufferedWrites) {
 +buffer.flip();
 +arrayList.add(buffer.getBuf());
 +}
 +Nio2SocketWrapper.this.bufferedWrites.clear();
 +ByteBuffer[] array = arrayList.toArray(new
 ByteBuffer[arrayList.size()]);
 +
 Nio2SocketWrapper.this.getSocket().write(array, 0, array.length,
 +Nio2SocketWrapper.this.getTimeout(),
 TimeUnit.MILLISECONDS,
 +array,
 gatheringWriteCompletionHandler);
 +} else if (attachment.hasRemaining()) {
 +// Regular write
 +
 Nio2SocketWrapper.this.getSocket().write(attachment,
 Nio2SocketWrapper.this.getTimeout(),
 +TimeUnit.MILLISECONDS, attachment,
 writeCompletionHandler);
 +} else {
 +// All data has been written
 +if (interest  !Nio2Endpoint.isInline()) {
 +interest = false;
 +notify = true;
 +}
 +writePending.release();
  }
  }

 There's a big deadlock risk if the recursion if incomplete and error
processing are inside the sync.

Rémy


Re: svn commit: r1650268 - /tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java

2015-01-08 Thread Mark Thomas
On 08/01/2015 13:30, Rémy Maucherat wrote:
 2015-01-08 14:09 GMT+01:00 ma...@apache.org:
 
 Author: markt
 Date: Thu Jan  8 13:09:47 2015
 New Revision: 1650268

 URL: http://svn.apache.org/r1650268
 Log:
 DequeByteBufferHolder is a little more complex than ListByteBuffer
 but using the same structure for all connectors will improve code re-use
 and thereby improve maintainability.

 When I tried that originally in this connector, I ran into corruption
 problems. Maybe it is fine now, but it is worth running the relevant
 testsuite sections repeatedly just in case.

I've been running the unit tests over this for several days any haven't
seen any issues in this area. I'll keep an eye on the CI system in case
it finds issues that didn't crop up on my dev machine.

 Also it adds an additional layer of objects without providing additional 
 reuse  I could see, so this structure should be removed IMO rather than
generalized.

Removing it is on the TODO list along with a handful of other things I
spotted while I was working on this refactoring. Having got to a point
where I had a single Http11OutputBuffer and passing unit tests I wanted
to get it into svn before continuing.

Mark

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Re: svn commit: r1650277 - in /tomcat/trunk/java/org/apache: coyote/http11/ tomcat/util/net/

2015-01-08 Thread Mark Thomas
On 08/01/2015 13:46, Rémy Maucherat wrote:
 2015-01-08 14:10 GMT+01:00 ma...@apache.org:
 
 @@ -766,32 +776,120 @@ public class Nio2Endpoint extends Abstra
  this.writeCompletionHandler = new CompletionHandlerInteger,
 ByteBuffer() {
  @Override
  public void completed(Integer nBytes, ByteBuffer
 attachment) {
 -if (nBytes.intValue()  0) {
 -failed(new EOFException(), attachment);
 -} else if (attachment.hasRemaining()) {
 -getSocket().write(attachment, getTimeout(),
 -TimeUnit.MILLISECONDS, attachment,
 writeCompletionHandler);
 -} else {
 -writePending.release();
 -if (!Nio2Endpoint.isInline()) {
 -
 getEndpoint().processSocket(Nio2SocketWrapper.this,
 SocketStatus.OPEN_WRITE, false);
 +boolean notify = false;
 +synchronized (writeCompletionHandler) {
 +if (nBytes.intValue()  0) {
 +failed(new
 EOFException(sm.getString(iob.failedwrite)), attachment);
 +} else if
 (Nio2SocketWrapper.this.bufferedWrites.size()  0) {
 +// Continue writing data using a gathering
 write
 +ArrayListByteBuffer arrayList = new
 ArrayList();
 +if (attachment.hasRemaining()) {
 +arrayList.add(attachment);
 +}
 +for (ByteBufferHolder buffer :
 Nio2SocketWrapper.this.bufferedWrites) {
 +buffer.flip();
 +arrayList.add(buffer.getBuf());
 +}
 +Nio2SocketWrapper.this.bufferedWrites.clear();
 +ByteBuffer[] array = arrayList.toArray(new
 ByteBuffer[arrayList.size()]);
 +
 Nio2SocketWrapper.this.getSocket().write(array, 0, array.length,
 +Nio2SocketWrapper.this.getTimeout(),
 TimeUnit.MILLISECONDS,
 +array,
 gatheringWriteCompletionHandler);
 +} else if (attachment.hasRemaining()) {
 +// Regular write
 +
 Nio2SocketWrapper.this.getSocket().write(attachment,
 Nio2SocketWrapper.this.getTimeout(),
 +TimeUnit.MILLISECONDS, attachment,
 writeCompletionHandler);
 +} else {
 +// All data has been written
 +if (interest  !Nio2Endpoint.isInline()) {
 +interest = false;
 +notify = true;
 +}
 +writePending.release();
  }
  }

 There's a big deadlock risk if the recursion if incomplete and error
 processing are inside the sync.

I came across some of those while doing the refactoring. I think - as of
r1650289 - they are addressed but it is possible I missed something. If
you have a particular sequence in mind then I'd be happy to take another
look.

Mark
 
 Rémy
 


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Re: svn commit: r1650280 - /tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java

2015-01-08 Thread Rémy Maucherat
2015-01-08 14:11 GMT+01:00 ma...@apache.org:

 Author: markt
 Date: Thu Jan  8 13:10:59 2015
 New Revision: 1650280

 URL: http://svn.apache.org/r1650280
 Log:
 Fix failing unit test
 testMessagesBlocking(org.apache.coyote.http11.upgrade.TestUpgrade)

 Modified:
 tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java

 Modified: tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java
 URL:
 http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java?rev=1650280r1=1650279r2=1650280view=diff

 ==
 --- tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java
 (original)
 +++ tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java Thu
 Jan  8 13:10:59 2015
 @@ -1099,9 +1099,7 @@ public class Nio2Endpoint extends Abstra
  int thisTime = transfer(buf, off, len,
 socketWriteBuffer);
  len = len - thisTime;
  off = off + thisTime;
 -if (socketWriteBuffer.remaining() == 0) {
 -flush(true);
 -}
 +flush(true);
  }

 This doesn't look very good. Removing buffering = worse performance. This
is probably because upgrade wouldn't deal with buffering as the message
implies, so this could need an extra flag.

Rémy


Re: svn commit: r1650277 - in /tomcat/trunk/java/org/apache: coyote/http11/ tomcat/util/net/

2015-01-08 Thread Rémy Maucherat
2015-01-08 14:50 GMT+01:00 Mark Thomas ma...@apache.org:

  There's a big deadlock risk if the recursion if incomplete and error
  processing are inside the sync.

 I came across some of those while doing the refactoring. I think - as of
 r1650289 - they are addressed but it is possible I missed something. If
 you have a particular sequence in mind then I'd be happy to take another
 look.

 If that new code is also used in upgrade mode, then abusing the drawboard
in localhost is a good way to find deadlocks and corruption. But I don't
see why these shouldn't be out of the sync block even if it doesn't cause a
deadlock.

Rémy


Re: svn commit: r1650277 - in /tomcat/trunk/java/org/apache: coyote/http11/ tomcat/util/net/

2015-01-08 Thread Mark Thomas
On 08/01/2015 13:54, Rémy Maucherat wrote:
 2015-01-08 14:50 GMT+01:00 Mark Thomas ma...@apache.org:
 
 There's a big deadlock risk if the recursion if incomplete and error
 processing are inside the sync.

 I came across some of those while doing the refactoring. I think - as of
 r1650289 - they are addressed but it is possible I missed something. If
 you have a particular sequence in mind then I'd be happy to take another
 look.

 If that new code is also used in upgrade mode, then abusing the drawboard
 in localhost is a good way to find deadlocks and corruption. But I don't
 see why these shouldn't be out of the sync block even if it doesn't cause a
 deadlock.

When you say I don't see why these shouldn't be out of the sync block
which code do you have in mind because it isn't clear to me what you mean.

Mark


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Re: svn commit: r1650268 - /tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java

2015-01-08 Thread Rémy Maucherat
2015-01-08 14:46 GMT+01:00 Mark Thomas ma...@apache.org:

 On 08/01/2015 13:30, Rémy Maucherat wrote:
  2015-01-08 14:09 GMT+01:00 ma...@apache.org:
 
  Author: markt
  Date: Thu Jan  8 13:09:47 2015
  New Revision: 1650268
 
  URL: http://svn.apache.org/r1650268
  Log:
  DequeByteBufferHolder is a little more complex than ListByteBuffer
  but using the same structure for all connectors will improve code re-use
  and thereby improve maintainability.
 
  When I tried that originally in this connector, I ran into corruption
  problems. Maybe it is fine now, but it is worth running the relevant
  testsuite sections repeatedly just in case.

 I've been running the unit tests over this for several days any haven't
 seen any issues in this area. I'll keep an eye on the CI system in case
 it finds issues that didn't crop up on my dev machine.


Well, ok, it's kind of obvious the structure itself cannot create
corruption. Things back then worked well with a simple list and not this
deque.


  Also it adds an additional layer of objects without providing additional
 reuse  I could see, so this structure should be removed IMO rather than
 generalized.

 Removing it is on the TODO list along with a handful of other things I
 spotted while I was working on this refactoring. Having got to a point
 where I had a single Http11OutputBuffer and passing unit tests I wanted
 to get it into svn before continuing.


Good. It would be fun to have but is probably dramatically risky if at all
possible.

Rémy


Re: svn commit: r1650280 - /tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java

2015-01-08 Thread Mark Thomas
On 08/01/2015 13:50, Rémy Maucherat wrote:
 2015-01-08 14:11 GMT+01:00 ma...@apache.org:
 
 Author: markt
 Date: Thu Jan  8 13:10:59 2015
 New Revision: 1650280

 URL: http://svn.apache.org/r1650280
 Log:
 Fix failing unit test
 testMessagesBlocking(org.apache.coyote.http11.upgrade.TestUpgrade)

 Modified:
 tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java

 Modified: tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java
 URL:
 http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java?rev=1650280r1=1650279r2=1650280view=diff

 ==
 --- tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java
 (original)
 +++ tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java Thu
 Jan  8 13:10:59 2015
 @@ -1099,9 +1099,7 @@ public class Nio2Endpoint extends Abstra
  int thisTime = transfer(buf, off, len,
 socketWriteBuffer);
  len = len - thisTime;
  off = off + thisTime;
 -if (socketWriteBuffer.remaining() == 0) {
 -flush(true);
 -}
 +flush(true);
  }

 This doesn't look very good. Removing buffering = worse performance.

Agreed.

 This is probably because upgrade wouldn't deal with buffering as the message
 implies, so this could need an extra flag.

On taking another look the problem is further up the call stack - the
patch above was just working around it. I need to look into why I only
saw the issue with NIO2.

Mark

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Re: svn commit: r1650277 - in /tomcat/trunk/java/org/apache: coyote/http11/ tomcat/util/net/

2015-01-08 Thread Rémy Maucherat
2015-01-08 14:58 GMT+01:00 Mark Thomas ma...@apache.org:

 On 08/01/2015 13:54, Rémy Maucherat wrote:
  2015-01-08 14:50 GMT+01:00 Mark Thomas ma...@apache.org:
 
  There's a big deadlock risk if the recursion if incomplete and error
  processing are inside the sync.
 
  I came across some of those while doing the refactoring. I think - as of
  r1650289 - they are addressed but it is possible I missed something. If
  you have a particular sequence in mind then I'd be happy to take another
  look.
 
  If that new code is also used in upgrade mode, then abusing the drawboard
  in localhost is a good way to find deadlocks and corruption. But I don't
  see why these shouldn't be out of the sync block even if it doesn't
 cause a
  deadlock.

 When you say I don't see why these shouldn't be out of the sync block
 which code do you have in mind because it isn't clear to me what you mean.


I quoted it:
 public void completed(Integer nBytes, ByteBuffer
attachment) {
-if (nBytes.intValue()  0) {
-failed(new EOFException(), attachment);
-} else if (attachment.hasRemaining()) {
-getSocket().write(attachment, getTimeout(),
-TimeUnit.MILLISECONDS, attachment,
writeCompletionHandler);
-} else {
-writePending.release();
-if (!Nio2Endpoint.isInline()) {
-
getEndpoint().processSocket(Nio2SocketWrapper.this,
SocketStatus.OPEN_WRITE, false);

I cannot predict any problem, since I see the call to
SocketStatus.OPEN_WRITE was moved out of it using a notify flag, so it
won't deadlock. The error processing uses a dispatch so it won't deadlock
either. Then there's the getSocket().write and I don't know but it could be
fine.

Rémy


Re: How to debug tomcat source in eclipse

2015-01-08 Thread MyList
Dear Mark,

I had posted this question a few days back and for some reason I was not able 
to get  any mails  from the list nor did I get to see my own post. I then 
wrote directly to Jeremy and he said I should post to both the list. I also 
made a second account to subscribe to the dev-list just to ascertain if my 
mails were getting through to the list, hence the test mails were sent today.

In no way am I trying to SPAM or treat the list in an unprofessional manner.
 
As things stand now I haven't got the mails you said were replied to this 
question and hence I posted this.

If it would not be much of a bother could you please guide me as to how can I 
get the replies to my query which were posted by the users of the list.

Thanks,
Harmeet


On Jan 8, 2015, at 10:40 PM, Mark Thomas ma...@apache.org wrote:

 On 08/01/2015 16:33, MyList wrote:
 Hello All,
 
 I am new to web development with tomcat. Have many years experience in  C 
 and C++ on Unix.
 
 I am newbie to tomcat too. Pardon me if my questions seem simple, just guide 
 me to the source or links.
 
 I am interested in debugging the tomcat server source code through Eclipse.I 
 would like to see how/where/what of the tomcat source code and it's 
 internals to get a grip on the way it handles things.
 
 
 I have the following installed -
 1)Eclipse Java For EE - Luna 
 2)Have the RC7_0_57 of the tomcat code.
 3) I have tomcat 6,7,8 installed and tested. Running concurrently on three 
 different port setups etc.
 
 My intention is to write a few Servlet based projects and step into the 
 tomcat source code while debugging from eclipse. I haven't found any good 
 link to achieve the same.I will have to compile the tomcat source code too, 
 don't know how to do that either.
 
 I would be obliged if you could help me or point me to the sources to 
 achieve this goal.
 
 Thanks in Advance,
 Harmeet
 
 1. Please do not cross-post questions to the users list and the
 developers list.
 
 2. Please read the reply you received several days ago when you first
 asked this question on the dev list.
 
 3. Please do not send test messages to the list. It is effectively SPAM
 and will be treated as such.
 
 4. This list moderator has a very low tolerance for spam and will
 unsubcribe your address and block it from future subscriptions should
 the spam continue.
 
 Mark
 
 
 
 -
 To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: dev-h...@tomcat.apache.org
 

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Re: How to debug tomcat source in eclipse

2015-01-08 Thread Mark Thomas
On 08/01/2015 17:41, MyList wrote:
 Dear Mark,
 
 I had posted this question a few days back and for some reason I was
 not able to get  any mails  from the list nor did I get to see my
 own post.

It is likely you were bitten by the 'feature' of Gmail that hides your
own posts.

 I then wrote directly to Jeremy and he said I should post
 to both the list.

Then that was poor advice.

 I also made a second account to subscribe to the
 dev-list just to ascertain if my mails were getting through to the
 list, hence the test mails were sent today.
 
 In no way am I trying to SPAM or treat the list in an unprofessional
 manner.

You might not be trying to spam the list but that is exactly what you
have done.

Learn to use the archives to check if messages made it.

 As things stand now I haven't got the mails you said were replied to
 this question and hence I posted this.

Again, the archives are your friend.

 If it would not be much of a bother could you please guide me as to
 how can I get the replies to my query which were posted by the users
 of the list.

The archives for the dev list are what you want:
http://tomcat.apache.org/lists.html

Personally I prefer MarkMail's search interface but tall the archives
have all the messages.

Finally, top-posting is also frowned upon.

Mark

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1650300 - /tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeServletOutputStream.java

2015-01-08 Thread markt
Author: markt
Date: Thu Jan  8 14:43:56 2015
New Revision: 1650300

URL: http://svn.apache.org/r1650300
Log:
This check only applies to non-blocking IO

Modified:

tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeServletOutputStream.java

Modified: 
tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeServletOutputStream.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeServletOutputStream.java?rev=1650300r1=1650299r2=1650300view=diff
==
--- 
tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeServletOutputStream.java
 (original)
+++ 
tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeServletOutputStream.java
 Thu Jan  8 14:43:56 2015
@@ -131,7 +131,7 @@ public class UpgradeServletOutputStream
 
 
 private void preWriteChecks() {
-if (socketWrapper.hasDataToWrite()) {
+if (listener != null  socketWrapper.hasDataToWrite()) {
 throw new 
IllegalStateException(sm.getString(upgrade.sis.write.ise));
 }
 }



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Re: svn commit: r1650280 - /tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java

2015-01-08 Thread Mark Thomas
On 08/01/2015 14:06, Mark Thomas wrote:
 On 08/01/2015 13:50, Rémy Maucherat wrote:
 2015-01-08 14:11 GMT+01:00 ma...@apache.org:

 Author: markt
 Date: Thu Jan  8 13:10:59 2015
 New Revision: 1650280

 URL: http://svn.apache.org/r1650280
 Log:
 Fix failing unit test
 testMessagesBlocking(org.apache.coyote.http11.upgrade.TestUpgrade)

 Modified:
 tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java

 Modified: tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java
 URL:
 http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java?rev=1650280r1=1650279r2=1650280view=diff

 ==
 --- tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java
 (original)
 +++ tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java Thu
 Jan  8 13:10:59 2015
 @@ -1099,9 +1099,7 @@ public class Nio2Endpoint extends Abstra
  int thisTime = transfer(buf, off, len,
 socketWriteBuffer);
  len = len - thisTime;
  off = off + thisTime;
 -if (socketWriteBuffer.remaining() == 0) {
 -flush(true);
 -}
 +flush(true);
  }

 This doesn't look very good. Removing buffering = worse performance.
 
 Agreed.
 
 This is probably because upgrade wouldn't deal with buffering as the message
 implies, so this could need an extra flag.
 
 On taking another look the problem is further up the call stack - the
 patch above was just working around it. I need to look into why I only
 saw the issue with NIO2.

The reason I only saw the issue with NIO2 is that only NIO2 was
buffering the ServletOutputStream for upgraded connections. The patch
above aligned NIO2 with NIO and APR - neither of which buffer upgraded
connections.

I took a look at the spec and it wasn't completely clear if the
ServletOutputStream in an upgraded connection should be buffered or not.

Against buffering is that all of the control is on the response - which
isn't available for an upgraded connection.

For buffering is the performance benefits and that nowhere does it say
that ServletOutputStream is not buffered for upgrade.

I can see the benefits of buffering here but given the typical use of
upgraded connections I wonder if it isn't better handled at the
application layer as and when required. Maybe something to clarify with
the Servlet EG?

Mark

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1650304 - /tomcat/native/trunk/native/src/jnilib.c

2015-01-08 Thread schultz
Author: schultz
Date: Thu Jan  8 14:57:07 2015
New Revision: 1650304

URL: http://svn.apache.org/r1650304
Log:
Remove zero-boundary-check on String length argument, as this argument is 
unsigned and can therefore never be less than zero.
Removes a compiler warning and simplifies the code a bit.

Modified:
tomcat/native/trunk/native/src/jnilib.c

Modified: tomcat/native/trunk/native/src/jnilib.c
URL: 
http://svn.apache.org/viewvc/tomcat/native/trunk/native/src/jnilib.c?rev=1650304r1=1650303r2=1650304view=diff
==
--- tomcat/native/trunk/native/src/jnilib.c (original)
+++ tomcat/native/trunk/native/src/jnilib.c Thu Jan  8 14:57:07 2015
@@ -139,18 +139,15 @@ jstring tcn_new_stringn(JNIEnv *env, con
 {
 jstring result;
 jbyteArray bytes = 0;
-size_t len = l;
 
 if (!str)
 return NULL;
 if ((*env)-EnsureLocalCapacity(env, 2)  0) {
 return NULL; /* out of memory error */
 }
-if (l  0)
-len = strlen(str);
-bytes = (*env)-NewByteArray(env, (jsize)len);
+bytes = (*env)-NewByteArray(env, l);
 if (bytes != NULL) {
-(*env)-SetByteArrayRegion(env, bytes, 0, (jint)len, (jbyte *)str);
+(*env)-SetByteArrayRegion(env, bytes, 0, l, (jbyte *)str);
 result = (*env)-NewObject(env, jString_class, jString_init, bytes);
 (*env)-DeleteLocalRef(env, bytes);
 return result;



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Re: tcnative trunk versus 1.1 branch

2015-01-08 Thread Christopher Schultz
Rainer,

On 1/8/15 7:33 AM, Rainer Jung wrote:
 Am 07.01.2015 um 18:58 schrieb Christopher Schultz:
 All,

 As far as I can tell, the 1.1 branch has gotten way out of sync with the
 trunk, here. Rainer has been doing a lot of work on the trunk, lately,
 with nothing being back-ported.
 
 I don't get that. What work do you mean? The first possibly not
 backported change I can find from me is dated 2013-06.

Oh, man. I have entirely confused myself by looking at native code in
both the tcnative and mod_jk projects and mixed everything up when
posting this.

Yes, the trunk/branch confusion exists in tcnative but you have been
committing to mod_jk, so the issues are completely separate.

Sorry for the noise.

Thanks,
-chris



signature.asc
Description: OpenPGP digital signature


How to debug tomcat source in eclipse

2015-01-08 Thread MyList
Hello All,

I am new to web development with tomcat. Have many years experience in  C and 
C++ on Unix.

I am newbie to tomcat too. Pardon me if my questions seem simple, just guide me 
to the source or links.

I am interested in debugging the tomcat server source code through Eclipse.I 
would like to see how/where/what of the tomcat source code and it's internals 
to get a grip on the way it handles things.


I have the following installed -
1)Eclipse Java For EE - Luna 
2)Have the RC7_0_57 of the tomcat code.
3) I have tomcat 6,7,8 installed and tested. Running concurrently on three 
different port setups etc.

My intention is to write a few Servlet based projects and step into the tomcat 
source code while debugging from eclipse. I haven't found any good link to 
achieve the same.I will have to compile the tomcat source code too, don't know 
how to do that either.

I would be obliged if you could help me or point me to the sources to achieve 
this goal.

Thanks in Advance,
Harmeet


svn commit: r1650302 - /tomcat/native/trunk/native/src/poll.c

2015-01-08 Thread schultz
Author: schultz
Date: Thu Jan  8 14:53:48 2015
New Revision: 1650302

URL: http://svn.apache.org/r1650302
Log:
Removed unused remove_all function.

Modified:
tomcat/native/trunk/native/src/poll.c

Modified: tomcat/native/trunk/native/src/poll.c
URL: 
http://svn.apache.org/viewvc/tomcat/native/trunk/native/src/poll.c?rev=1650302r1=1650301r2=1650302view=diff
==
--- tomcat/native/trunk/native/src/poll.c (original)
+++ tomcat/native/trunk/native/src/poll.c Thu Jan  8 14:53:48 2015
@@ -310,19 +310,6 @@ static void update_last_active(tcn_polls
 }
 }
 
-
-static void remove_all(tcn_pollset_t *p)
-{
-apr_int32_t i;
-for (i = 0; i  p-nelts; i++) {
-apr_pollset_remove(p-pollset, (p-socket_set[i]));
-#ifdef TCN_DO_STATISTICS
-p-sp_removed++;
-#endif
-}
-p-nelts = 0;
-}
-
 TCN_IMPLEMENT_CALL(jint, Poll, remove)(TCN_STDARGS, jlong pollset,
jlong socket)
 {



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Re: Currently ignored WebSocket tests

2015-01-08 Thread Rémy Maucherat
2015-01-08 16:56 GMT+01:00 Mark Thomas ma...@apache.org:

 There are a couple of WebSocket tests that are currently commented out
 in org.apache.tomcat.websocket.pojo.TestEncodingDecoding

 I've been looking into why the currently fail.

 Failing test 1: testMessagesEndPoints()

 First of all, this test fails with:
 java.lang.IllegalStateException: The remote endpoint was in state
 [TEXT_FULL_WRITING] which is an invalid state for called method

 This is caused by a bug in the server-side endpoint which has this:

 @OnMessage
 public String onMessage(String message, Session session) {
 received.add(message);
 session.getAsyncRemote().sendText(MESSAGE_ONE);
 return message;
 }

 The problem is that because the method is annotated with @OnMessage and
 has a return value, that return value will be sent as a message to the
 client. However, just before the method ends an asynchronous message is
 send with:
 session.getAsyncRemote().sendText(MESSAGE_ONE);

 The first (asynchronous) message has not completed when the second (from
 the return value) message is attempted to be sent.

 The Javadoc for RemoteEndpoint.Basic states:
 If the websocket connection underlying this RemoteEndpoint is busy
 sending a message when a call is made to send another one, for example
 if two threads attempt to call a send method concurrently, or if a
 developer attempts to send a new message while in the middle of sending
 an existing one, the send method called while the connection is already
 busy may throw an IllegalStateException.

 It is arguable (from the Javadoc) that this limitation only applies to
 synchronous messages but I do not believe that that was the intention of
 the WebSocket EG. It was certainly only ever discussed in the context
 sync+async messages.

 If the above issue is fixed (e.g. by changing the return type to void)
 the test then fails at the various calls to testEvent. This is because
 the test does not use the encoders those checks are looking for.


I think I already mentioned that. In the Tomcat implementation, this means
mixing async with blocking (which obviously fails), but sending the
returned value is under the control of the container so it's an
implementation detail. Thus I see where the rationale comes from.

You could discuss it in the EG.


 Failing test 2: testBatchedEndPoints()

 This fails because batching is enabled which means that the messages are
 batched (i.e. buffered) until the buffer is full and the two messages
 written do no fill the buffer. If this were addressed then again the
 test will still fail because of the later calls to testEvent. Again the
 test does not use the encoders these checks are looking for.


Yes, it seems implied the value returned should not be concerned with
batching (it would probably never be sent) and thus the first batched
message would also be sent at that time. This sounds easier to fix than the
first one, but I didn't really try because the behavior should be validated
first.



 Proposed fixes:

 I will removed the testEvent checks since they do not apply to these tests.

 I believe these tests were aiming to reproduce issues Remy had seen in
 other systems. Since I don't have access to the original issues I'll
 leave the remainder of the tests as is to give Remy a chance to review
 these comments and possibly modify the tests.

 Obviously, the end of the tests (that is now removed) was a cut  paste :)

Rémy


Re: How to debug tomcat source in eclipse

2015-01-08 Thread Mark Thomas
On 08/01/2015 16:33, MyList wrote:
 Hello All,
 
 I am new to web development with tomcat. Have many years experience in  C and 
 C++ on Unix.
 
 I am newbie to tomcat too. Pardon me if my questions seem simple, just guide 
 me to the source or links.
 
 I am interested in debugging the tomcat server source code through Eclipse.I 
 would like to see how/where/what of the tomcat source code and it's internals 
 to get a grip on the way it handles things.
 
 
 I have the following installed -
 1)Eclipse Java For EE - Luna 
 2)Have the RC7_0_57 of the tomcat code.
 3) I have tomcat 6,7,8 installed and tested. Running concurrently on three 
 different port setups etc.
 
 My intention is to write a few Servlet based projects and step into the 
 tomcat source code while debugging from eclipse. I haven't found any good 
 link to achieve the same.I will have to compile the tomcat source code too, 
 don't know how to do that either.
 
 I would be obliged if you could help me or point me to the sources to achieve 
 this goal.
 
 Thanks in Advance,
 Harmeet

1. Please do not cross-post questions to the users list and the
developers list.

2. Please read the reply you received several days ago when you first
asked this question on the dev list.

3. Please do not send test messages to the list. It is effectively SPAM
and will be treated as such.

4. This list moderator has a very low tolerance for spam and will
unsubcribe your address and block it from future subscriptions should
the spam continue.

Mark



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Currently ignored WebSocket tests

2015-01-08 Thread Mark Thomas
There are a couple of WebSocket tests that are currently commented out
in org.apache.tomcat.websocket.pojo.TestEncodingDecoding

I've been looking into why the currently fail.

Failing test 1: testMessagesEndPoints()

First of all, this test fails with:
java.lang.IllegalStateException: The remote endpoint was in state
[TEXT_FULL_WRITING] which is an invalid state for called method

This is caused by a bug in the server-side endpoint which has this:

@OnMessage
public String onMessage(String message, Session session) {
received.add(message);
session.getAsyncRemote().sendText(MESSAGE_ONE);
return message;
}

The problem is that because the method is annotated with @OnMessage and
has a return value, that return value will be sent as a message to the
client. However, just before the method ends an asynchronous message is
send with:
session.getAsyncRemote().sendText(MESSAGE_ONE);

The first (asynchronous) message has not completed when the second (from
the return value) message is attempted to be sent.

The Javadoc for RemoteEndpoint.Basic states:
If the websocket connection underlying this RemoteEndpoint is busy
sending a message when a call is made to send another one, for example
if two threads attempt to call a send method concurrently, or if a
developer attempts to send a new message while in the middle of sending
an existing one, the send method called while the connection is already
busy may throw an IllegalStateException.

It is arguable (from the Javadoc) that this limitation only applies to
synchronous messages but I do not believe that that was the intention of
the WebSocket EG. It was certainly only ever discussed in the context
sync+async messages.

If the above issue is fixed (e.g. by changing the return type to void)
the test then fails at the various calls to testEvent. This is because
the test does not use the encoders those checks are looking for.

Failing test 2: testBatchedEndPoints()

This fails because batching is enabled which means that the messages are
batched (i.e. buffered) until the buffer is full and the two messages
written do no fill the buffer. If this were addressed then again the
test will still fail because of the later calls to testEvent. Again the
test does not use the encoders these checks are looking for.


Proposed fixes:

I will removed the testEvent checks since they do not apply to these tests.

I believe these tests were aiming to reproduce issues Remy had seen in
other systems. Since I don't have access to the original issues I'll
leave the remainder of the tests as is to give Remy a chance to review
these comments and possibly modify the tests.

Mark


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[jira] [Commented] (MTOMCAT-83) Support specifying arguments using a real forked JVM

2015-01-08 Thread Srdan Srepfler (JIRA)

[ 
https://issues.apache.org/jira/browse/MTOMCAT-83?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14269476#comment-14269476
 ] 

Srdan Srepfler commented on MTOMCAT-83:
---

I think we are running into this issue as well, does it mean essentially that a 
forked tomcat is not getting the systemProperties passed onto it? 
We are simply trying to run tomcat in the pre-integration-test-phase and 
override a system configuration for the container and as it essentially needs 
to run with a different configuration from the default classpath. However we 
don't get the property injected into tomcat while if we pass it via the command 
line as a mvn argument it works just fine. But we see this behaviour consistent 
with both fork true and false so I'm not sure at this point is the entire 
systemProperties problematic or our configuration.

 Support specifying arguments using a real forked JVM
 

 Key: MTOMCAT-83
 URL: https://issues.apache.org/jira/browse/MTOMCAT-83
 Project: Apache Tomcat Maven Plugin
  Issue Type: New Feature
Affects Versions: 1.1
Reporter: Stevo Slavic
 Fix For: backlog


 [tomcat-maven-plugin's run 
 goal|http://mojo.codehaus.org/tomcat-maven-plugin/run-mojo.html] seems to 
 support forking, but not specifying arguments for forked JVM. Something like 
 that IMO would be useful for specifying memory options different from Maven 
 build and javaagent like jacoco for coverage.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1650317 - /tomcat/trunk/test/org/apache/tomcat/websocket/pojo/TestEncodingDecoding.java

2015-01-08 Thread markt
Author: markt
Date: Thu Jan  8 15:59:30 2015
New Revision: 1650317

URL: http://svn.apache.org/r1650317
Log:
Remove what appear to be copied/pasted checks from other tests that do
not apply to these tests.

Modified:
tomcat/trunk/test/org/apache/tomcat/websocket/pojo/TestEncodingDecoding.java

Modified: 
tomcat/trunk/test/org/apache/tomcat/websocket/pojo/TestEncodingDecoding.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/tomcat/websocket/pojo/TestEncodingDecoding.java?rev=1650317r1=1650316r2=1650317view=diff
==
--- 
tomcat/trunk/test/org/apache/tomcat/websocket/pojo/TestEncodingDecoding.java 
(original)
+++ 
tomcat/trunk/test/org/apache/tomcat/websocket/pojo/TestEncodingDecoding.java 
Thu Jan  8 15:59:30 2015
@@ -264,16 +264,6 @@ public class TestEncodingDecoding extend
 session.close();
 
 Assert.assertNull(server.t);
-
-// Should not take very long but some failures have been seen
-i = testEvent(MsgStringEncoder.class.getName()+:init, 0);
-i = testEvent(MsgStringDecoder.class.getName()+:init, i);
-i = testEvent(MsgByteEncoder.class.getName()+:init, i);
-i = testEvent(MsgByteDecoder.class.getName()+:init, i);
-i = testEvent(MsgStringEncoder.class.getName()+:destroy, i);
-i = testEvent(MsgStringDecoder.class.getName()+:destroy, i);
-i = testEvent(MsgByteEncoder.class.getName()+:destroy, i);
-i = testEvent(MsgByteDecoder.class.getName()+:destroy, i);
 }
 
 
@@ -321,16 +311,6 @@ public class TestEncodingDecoding extend
 session.close();
 
 Assert.assertNull(server.t);
-
-// Should not take very long but some failures have been seen
-i = testEvent(MsgStringEncoder.class.getName()+:init, 0);
-i = testEvent(MsgStringDecoder.class.getName()+:init, i);
-i = testEvent(MsgByteEncoder.class.getName()+:init, i);
-i = testEvent(MsgByteDecoder.class.getName()+:init, i);
-i = testEvent(MsgStringEncoder.class.getName()+:destroy, i);
-i = testEvent(MsgStringDecoder.class.getName()+:destroy, i);
-i = testEvent(MsgByteEncoder.class.getName()+:destroy, i);
-i = testEvent(MsgByteDecoder.class.getName()+:destroy, i);
 }
 
 



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Re: svn commit: r1650280 - /tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java

2015-01-08 Thread Rémy Maucherat
2015-01-08 15:48 GMT+01:00 Mark Thomas ma...@apache.org:

 The reason I only saw the issue with NIO2 is that only NIO2 was
 buffering the ServletOutputStream for upgraded connections. The patch
 above aligned NIO2 with NIO and APR - neither of which buffer upgraded
 connections.

 I took a look at the spec and it wasn't completely clear if the
 ServletOutputStream in an upgraded connection should be buffered or not.

 Against buffering is that all of the control is on the response - which
 isn't available for an upgraded connection.

 For buffering is the performance benefits and that nowhere does it say
 that ServletOutputStream is not buffered for upgrade.

 I can see the benefits of buffering here but given the typical use of
 upgraded connections I wonder if it isn't better handled at the
 application layer as and when required. Maybe something to clarify with
 the Servlet EG?

 Let's assume it's fine then.

Rémy


Hello test mail - please ignore

2015-01-08 Thread Tech2Mgmt
Hi 

Hello test mail - please ignore 

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Hello test mail - please ignore

2015-01-08 Thread MyList
Hi

Hello test mail - please ignore 

Regards

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 57425] ReplicatedContext implementation throws NullPointerException for attributes with null value

2015-01-08 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=57425

--- Comment #2 from Felix Schumacher felix.schumac...@internetallee.de ---
Created attachment 32358
  -- https://issues.apache.org/bugzilla/attachment.cgi?id=32358action=edit
Don't add orderedLibs attribute if it is null

The attached patch is for tomcat 8. But the same logic would apply to tomcat 7.
The file in tomcat 7 is named java/org/apache/catalina/deploy/WebXml.java. It
applies cleanly for trunk.

The idea is to not store the attribute, if it is null, since getAttribute will
give a null value, if the attribute is not present and the replicated context
fails, if the concurrent hashmap gets a null as a value or a key.

If noone objects, I will apply the patch.

-- 
You are receiving this mail because:
You are the assignee for the bug.

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Re: How to debug tomcat source in eclipse

2015-01-08 Thread MyList
Mark,

Thanks a ton, I will seek through the archives.

Harmeet

On Jan 8, 2015, at 11:41 PM, Mark Thomas ma...@apache.org wrote:

 On 08/01/2015 17:41, MyList wrote:
 Dear Mark,
 
 I had posted this question a few days back and for some reason I was
 not able to get  any mails  from the list nor did I get to see my
 own post.
 
 It is likely you were bitten by the 'feature' of Gmail that hides your
 own posts.
 
 I then wrote directly to Jeremy and he said I should post
 to both the list.
 
 Then that was poor advice.
 
 I also made a second account to subscribe to the
 dev-list just to ascertain if my mails were getting through to the
 list, hence the test mails were sent today.
 
 In no way am I trying to SPAM or treat the list in an unprofessional
 manner.
 
 You might not be trying to spam the list but that is exactly what you
 have done.
 
 Learn to use the archives to check if messages made it.
 
 As things stand now I haven't got the mails you said were replied to
 this question and hence I posted this.
 
 Again, the archives are your friend.
 
 If it would not be much of a bother could you please guide me as to
 how can I get the replies to my query which were posted by the users
 of the list.
 
 The archives for the dev list are what you want:
 http://tomcat.apache.org/lists.html
 
 Personally I prefer MarkMail's search interface but tall the archives
 have all the messages.
 
 Finally, top-posting is also frowned upon.
 
 Mark
 
 -
 To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: dev-h...@tomcat.apache.org
 

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[CANCELLED][VOTE] Release Apache Tomcat 8.0.16

2015-01-08 Thread Mark Thomas
On 07/01/2015 15:19, Violeta Georgieva wrote:
 Hi,
 
 2015-01-07 15:02 GMT+02:00 Mark Thomas ma...@apache.org:

 On 07/01/2015 07:42, Violeta Georgieva wrote:
 Hi,

 2015-01-05 15:13 GMT+02:00 Mark Thomas ma...@apache.org
 mailto:ma...@apache.org:

 The proposed Apache Tomcat 8.0.16 release is now available for voting.

snip/


 After revision 1643232
 If there is a ServletRequestListener and the application sends an error
 then ServletRequestListener.requestDestroyed is not invoked anymore.
 I'm attaching a test case.

 Bother.

 The test case didn't come through. Probably best to commit it to trunk
 with @Ignore.
 
 Here it is r1650081
 
 Vily
 
 It looks like 8.0.17 will be required at this point. I'll
 leave the vote open a little longer to see if anyone finds anything else.

I've fixed this issue in trunk. I need to commit, back-port it and run
through the unit tests. I should be able to do that this evening and I
plan to tag 8.0.17 tomorrow morning.

There 8.0.16 vote is therefore cancelled due to this regression.

Mark


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1650360 - /tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml

2015-01-08 Thread markt
Author: markt
Date: Thu Jan  8 19:29:09 2015
New Revision: 1650360

URL: http://svn.apache.org/r1650360
Log:
8.0.16 release cancelled due to a regression.

Modified:
tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml

Modified: tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml?rev=1650360r1=1650359r2=1650360view=diff
==
--- tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml Thu Jan  8 19:29:09 2015
@@ -53,7 +53,7 @@
 /changelog
   /subsection
 /section
-section name=Tomcat 8.0.16 (markt)
+section name=Tomcat 8.0.16 (markt) rtext=not released
   subsection name=Catalina
 changelog
   fix



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[GUMP@vmgump]: Project tomcat-tc8.0.x-test-apr (in module tomcat-8.0.x) failed

2015-01-08 Thread Bill Barker
To whom it may engage...

This is an automated request, but not an unsolicited one. For 
more information please visit http://gump.apache.org/nagged.html, 
and/or contact the folk at gene...@gump.apache.org.

Project tomcat-tc8.0.x-test-apr has an issue affecting its community 
integration.
This issue affects 1 projects.
The current state of this project is 'Failed', with reason 'Build Failed'.
For reference only, the following projects are affected by this:
- tomcat-tc8.0.x-test-apr :  Tomcat 8.x, a web server implementing the Java 
Servlet 3.1,
...


Full details are available at:

http://vmgump.apache.org/gump/public/tomcat-8.0.x/tomcat-tc8.0.x-test-apr/index.html

That said, some information snippets are provided here.

The following annotations (debug/informational/warning/error messages) were 
provided:
 -DEBUG- Dependency on commons-daemon exists, no need to add for property 
commons-daemon.native.src.tgz.
 -DEBUG- Dependency on commons-daemon exists, no need to add for property 
tomcat-native.tar.gz.
 -INFO- Failed with reason build failed
 -INFO- Project Reports in: 
/srv/gump/public/workspace/tomcat-8.0.x/output/logs-APR
 -INFO- Project Reports in: 
/srv/gump/public/workspace/tomcat-8.0.x/output/test-tmp-APR/logs



The following work was performed:
http://vmgump.apache.org/gump/public/tomcat-8.0.x/tomcat-tc8.0.x-test-apr/gump_work/build_tomcat-8.0.x_tomcat-tc8.0.x-test-apr.html
Work Name: build_tomcat-8.0.x_tomcat-tc8.0.x-test-apr (Type: Build)
Work ended in a state of : Failed
Elapsed: 26 mins 31 secs
Command Line: /usr/lib/jvm/java-8-oracle/bin/java -Djava.awt.headless=true 
-Dbuild.sysclasspath=only org.apache.tools.ant.Main 
-Dgump.merge=/srv/gump/public/gump/work/merge.xml 
-Djunit.jar=/srv/gump/public/workspace/junit/target/junit-4.13-SNAPSHOT.jar 
-Dobjenesis.jar=/srv/gump/public/workspace/objenesis/main/target/objenesis-2.2-SNAPSHOT.jar
 -Dtest.reports=output/logs-APR 
-Dtomcat-native.tar.gz=/srv/gump/public/workspace/apache-commons/daemon/dist/bin/commons-daemon-20150108-native-src.tar.gz
 -Dexamples.sources.skip=true 
-Djdt.jar=/srv/gump/packages/eclipse/plugins/R-4.4-201406061215/ecj-4.4.jar 
-Dtest.apr.loc=/srv/gump/public/workspace/tomcat-native/dest-20150108/lib 
-Dcommons-daemon.jar=/srv/gump/public/workspace/apache-commons/daemon/dist/commons-daemon-20150108.jar
 
-Dcommons-daemon.native.src.tgz=/srv/gump/public/workspace/apache-commons/daemon/dist/bin/commons-daemon-20150108-native-src.tar.gz
 -Dtest.temp=output/test-tmp-APR -Dtest.accesslog=true -Dexecute.test.nio=false 
-Dtest
 .openssl.path=/srv/gump/public/workspace/openssl/dest-20150108/bin/openssl 
-Dexecute.test.apr=true -Dexecute.test.bio=false -Dexecute.test.nio2=false 
-Deasymock.jar=/srv/gump/public/workspace/easymock/easymock/target/easymock-3.4-SNAPSHOT.jar
 
-Dhamcrest.jar=/srv/gump/public/workspace/hamcrest/build/hamcrest-all-20150108.jar
 -Dcglib.jar=/srv/gump/packages/cglib/cglib-nodep-2.2.jar test 
[Working Directory: /srv/gump/public/workspace/tomcat-8.0.x]
CLASSPATH: 
/usr/lib/jvm/java-8-oracle/lib/tools.jar:/srv/gump/public/workspace/tomcat-8.0.x/output/build/webapps/examples/WEB-INF/classes:/srv/gump/public/workspace/tomcat-8.0.x/output/testclasses:/srv/gump/public/workspace/ant/dist/lib/ant.jar:/srv/gump/public/workspace/ant/dist/lib/ant-launcher.jar:/srv/gump/public/workspace/ant/dist/lib/ant-jmf.jar:/srv/gump/public/workspace/ant/dist/lib/ant-junit.jar:/srv/gump/public/workspace/ant/dist/lib/ant-junit4.jar:/srv/gump/public/workspace/ant/dist/lib/ant-swing.jar:/srv/gump/public/workspace/ant/dist/lib/ant-apache-resolver.jar:/srv/gump/public/workspace/ant/dist/lib/ant-apache-xalan2.jar:/srv/gump/public/workspace/xml-commons/java/build/resolver.jar:/srv/gump/public/workspace/tomcat-8.0.x/output/build/bin/bootstrap.jar:/srv/gump/public/workspace/tomcat-8.0.x/output/build/bin/tomcat-juli.jar:/srv/gump/public/workspace/tomcat-8.0.x/output/build/lib/annotations-api.jar:/srv/gump/public/workspace/tomcat-8.0.x/output/build/lib/servlet-api.ja
 
r:/srv/gump/public/workspace/tomcat-8.0.x/output/build/lib/jsp-api.jar:/srv/gump/public/workspace/tomcat-8.0.x/output/build/lib/el-api.jar:/srv/gump/public/workspace/tomcat-8.0.x/output/build/lib/websocket-api.jar:/srv/gump/public/workspace/tomcat-8.0.x/output/build/lib/catalina.jar:/srv/gump/public/workspace/tomcat-8.0.x/output/build/lib/catalina-ant.jar:/srv/gump/public/workspace/tomcat-8.0.x/output/build/lib/catalina-storeconfig.jar:/srv/gump/public/workspace/tomcat-8.0.x/output/build/lib/tomcat-coyote.jar:/srv/gump/public/workspace/tomcat-8.0.x/output/build/lib/jasper.jar:/srv/gump/public/workspace/tomcat-8.0.x/output/build/lib/jasper-el.jar:/srv/gump/public/workspace/tomcat-8.0.x/output/build/lib/catalina-tribes.jar:/srv/gump/public/workspace/tomcat-8.0.x/output/build/lib/catalina-ha.jar:/srv/gump/public/workspace/tomcat-8.0.x/output/build/lib/tomcat-api.jar:/srv/gump/public/workspace/tomcat-8.0.x/output/build/lib/tomcat-jni.jar:/srv/gump/public

svn commit: r1650375 - /tomcat/trunk/java/org/apache/coyote/http11/Http11OutputBuffer.java

2015-01-08 Thread markt
Author: markt
Date: Thu Jan  8 20:41:35 2015
New Revision: 1650375

URL: http://svn.apache.org/r1650375
Log:
Review and tidy up comments.

Modified:
tomcat/trunk/java/org/apache/coyote/http11/Http11OutputBuffer.java

Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11OutputBuffer.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11OutputBuffer.java?rev=1650375r1=1650374r2=1650375view=diff
==
--- tomcat/trunk/java/org/apache/coyote/http11/Http11OutputBuffer.java 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/Http11OutputBuffer.java Thu Jan  
8 20:41:35 2015
@@ -288,7 +288,6 @@ public class Http11OutputBufferS imple
  * connection.
  */
 public void recycle() {
-// Sub-classes may wish to do more than this.
 nextRequest();
 socketWrapper = null;
 }
@@ -626,7 +625,7 @@ public class Http11OutputBufferS imple
 // -- SocketOutputBuffer Inner 
Class
 
 /**
- * This class is an output buffer which will write data to an output 
stream.
+ * This class is an output buffer which will write data to a socket.
  */
 protected class SocketOutputBuffer implements OutputBuffer {
 



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 57425] ReplicatedContext implementation throws NullPointerException for attributes with null value

2015-01-08 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=57425

--- Comment #3 from Mark Thomas ma...@apache.org ---
I'd suggest that this is fixing the symptom rather than the root cause.

I think it would be better to replicate the correct handling of
setAttribute(String,null) (which is to remove the attribute) in
ReplicatedContext.ReplApplContext

-- 
You are receiving this mail because:
You are the assignee for the bug.

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1650376 - in /tomcat/trunk: java/org/apache/coyote/http11/ test/org/apache/coyote/http11/filters/

2015-01-08 Thread markt
Author: markt
Date: Thu Jan  8 21:00:43 2015
New Revision: 1650376

URL: http://svn.apache.org/r1650376
Log:
Http11OutputBuffer no longer needs to reference a Socket type

Modified:
tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java
tomcat/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java
tomcat/trunk/java/org/apache/coyote/http11/Http11Nio2Processor.java
tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java
tomcat/trunk/java/org/apache/coyote/http11/Http11OutputBuffer.java
tomcat/trunk/test/org/apache/coyote/http11/filters/TesterOutputBuffer.java

Modified: 
tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java?rev=1650376r1=1650375r2=1650376view=diff
==
--- tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java Thu 
Jan  8 21:00:43 2015
@@ -78,7 +78,7 @@ public abstract class AbstractHttp11Proc
 /**
  * Output.
  */
-protected Http11OutputBufferS outputBuffer;
+protected Http11OutputBuffer outputBuffer;
 
 
 /**
@@ -624,7 +624,7 @@ public abstract class AbstractHttp11Proc
  * Exposes output buffer to super class to allow better code re-use.
  * @return  The output buffer used by the processor.
  */
-protected Http11OutputBufferS getOutputBuffer() {
+protected Http11OutputBuffer getOutputBuffer() {
 return outputBuffer;
 }
 

Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java?rev=1650376r1=1650375r2=1650376view=diff
==
--- tomcat/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java Thu Jan  
8 21:00:43 2015
@@ -60,7 +60,7 @@ public class Http11AprProcessor extends
 inputBuffer = new InternalAprInputBuffer(request, headerBufferSize);
 request.setInputBuffer(getInputBuffer());
 
-outputBuffer = new Http11OutputBuffer(response, headerBufferSize);
+outputBuffer = new Http11OutputBuffer(response, headerBufferSize);
 response.setOutputBuffer(getOutputBuffer());
 
 initializeFilters(maxTrailerSize, maxExtensionSize, maxSwallowSize);

Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11Nio2Processor.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11Nio2Processor.java?rev=1650376r1=1650375r2=1650376view=diff
==
--- tomcat/trunk/java/org/apache/coyote/http11/Http11Nio2Processor.java 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/Http11Nio2Processor.java Thu Jan 
 8 21:00:43 2015
@@ -64,7 +64,7 @@ public class Http11Nio2Processor extends
 inputBuffer = new InternalNio2InputBuffer(request, maxHttpHeaderSize);
 request.setInputBuffer(getInputBuffer());
 
-outputBuffer = new Http11OutputBuffer(response, maxHttpHeaderSize);
+outputBuffer = new Http11OutputBuffer(response, maxHttpHeaderSize);
 response.setOutputBuffer(getOutputBuffer());
 
 initializeFilters(maxTrailerSize, maxExtensionSize, maxSwallowSize);

Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java?rev=1650376r1=1650375r2=1650376view=diff
==
--- tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java Thu Jan  
8 21:00:43 2015
@@ -65,7 +65,7 @@ public class Http11NioProcessor extends
 inputBuffer = new InternalNioInputBuffer(request, maxHttpHeaderSize);
 request.setInputBuffer(getInputBuffer());
 
-outputBuffer = new Http11OutputBuffer(response, maxHttpHeaderSize);
+outputBuffer = new Http11OutputBuffer(response, maxHttpHeaderSize);
 response.setOutputBuffer(getOutputBuffer());
 
 initializeFilters(maxTrailerSize, maxExtensionSize, maxSwallowSize);

Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11OutputBuffer.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11OutputBuffer.java?rev=1650376r1=1650375r2=1650376view=diff
==
--- tomcat/trunk/java/org/apache/coyote/http11/Http11OutputBuffer.java 
(original)
+++ 

svn commit: r1650358 - in /tomcat/tc8.0.x/trunk: build.properties.default res/maven/mvn.properties.default

2015-01-08 Thread markt
Author: markt
Date: Thu Jan  8 19:27:04 2015
New Revision: 1650358

URL: http://svn.apache.org/r1650358
Log:
Version bumps for next release

Modified:
tomcat/tc8.0.x/trunk/build.properties.default
tomcat/tc8.0.x/trunk/res/maven/mvn.properties.default

Modified: tomcat/tc8.0.x/trunk/build.properties.default
URL: 
http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/build.properties.default?rev=1650358r1=1650357r2=1650358view=diff
==
--- tomcat/tc8.0.x/trunk/build.properties.default (original)
+++ tomcat/tc8.0.x/trunk/build.properties.default Thu Jan  8 19:27:04 2015
@@ -25,7 +25,7 @@
 # - Version Control Flags -
 version.major=8
 version.minor=0
-version.build=16
+version.build=17
 version.patch=0
 version.suffix=-dev
 

Modified: tomcat/tc8.0.x/trunk/res/maven/mvn.properties.default
URL: 
http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/res/maven/mvn.properties.default?rev=1650358r1=1650357r2=1650358view=diff
==
--- tomcat/tc8.0.x/trunk/res/maven/mvn.properties.default (original)
+++ tomcat/tc8.0.x/trunk/res/maven/mvn.properties.default Thu Jan  8 19:27:04 
2015
@@ -35,7 +35,7 @@ maven.asf.release.repo.url=https://repos
 maven.asf.release.repo.repositoryId=apache.releases
 
 # Release version info
-maven.asf.release.deploy.version=8.0.16
+maven.asf.release.deploy.version=8.0.17
 
 #Where do we load the libraries from
 tomcat.lib.path=../../output/build/lib



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1650366 - in /tomcat/trunk: java/org/apache/coyote/http11/Http11Nio2Processor.java java/org/apache/coyote/http11/Http11OutputBuffer.java test/org/apache/coyote/http11/filters/TesterOutput

2015-01-08 Thread markt
Author: markt
Date: Thu Jan  8 19:47:57 2015
New Revision: 1650366

URL: http://svn.apache.org/r1650366
Log:
Simplify

Modified:
tomcat/trunk/java/org/apache/coyote/http11/Http11Nio2Processor.java
tomcat/trunk/java/org/apache/coyote/http11/Http11OutputBuffer.java
tomcat/trunk/test/org/apache/coyote/http11/filters/TesterOutputBuffer.java

Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11Nio2Processor.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11Nio2Processor.java?rev=1650366r1=1650365r2=1650366view=diff
==
--- tomcat/trunk/java/org/apache/coyote/http11/Http11Nio2Processor.java 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/Http11Nio2Processor.java Thu Jan 
 8 19:47:57 2015
@@ -99,7 +99,7 @@ public class Http11Nio2Processor extends
 ((InternalNio2InputBuffer) 
getInputBuffer()).registerReadInterest();
 }
 if (write) {
-((Http11OutputBuffer?) 
getOutputBuffer()).registerWriteInterest();
+socketWrapper.registerWriteInterest();
 }
 }
 

Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11OutputBuffer.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11OutputBuffer.java?rev=1650366r1=1650365r2=1650366view=diff
==
--- tomcat/trunk/java/org/apache/coyote/http11/Http11OutputBuffer.java 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/Http11OutputBuffer.java Thu Jan  
8 19:47:57 2015
@@ -589,11 +589,6 @@ public class Http11OutputBufferS imple
 
 //-- Non-blocking 
writes
 
-protected void registerWriteInterest() {
-socketWrapper.registerWriteInterest();
-}
-
-
 /**
  * Writes any remaining buffered data.
  *
@@ -618,7 +613,7 @@ public class Http11OutputBufferS imple
 protected final boolean isReady() {
 boolean result = !hasDataToWrite();
 if (!result) {
-registerWriteInterest();
+socketWrapper.registerWriteInterest();
 }
 return result;
 }

Modified: 
tomcat/trunk/test/org/apache/coyote/http11/filters/TesterOutputBuffer.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/coyote/http11/filters/TesterOutputBuffer.java?rev=1650366r1=1650365r2=1650366view=diff
==
--- tomcat/trunk/test/org/apache/coyote/http11/filters/TesterOutputBuffer.java 
(original)
+++ tomcat/trunk/test/org/apache/coyote/http11/filters/TesterOutputBuffer.java 
Thu Jan  8 19:47:57 2015
@@ -80,12 +80,6 @@ public class TesterOutputBuffer extends
 
 
 @Override
-protected void registerWriteInterest() {
-// NO-OP: Unused
-}
-
-
-@Override
 protected boolean flushBuffer(boolean block) throws IOException {
 // Blocking IO so ignore block parameter as this will always use
 // blocking IO.



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1650365 - in /tomcat/trunk: java/org/apache/catalina/core/StandardHostValve.java test/org/apache/catalina/core/TestStandardHostValve.java

2015-01-08 Thread markt
Author: markt
Date: Thu Jan  8 19:47:51 2015
New Revision: 1650365

URL: http://svn.apache.org/r1650365
Log:
Fix issue reported during 8.0.16 release testing that requestDestroyed
was not called for a non-async page when the ErrorReportingValve would
be handling the error reporting.

Modified:
tomcat/trunk/java/org/apache/catalina/core/StandardHostValve.java
tomcat/trunk/test/org/apache/catalina/core/TestStandardHostValve.java

Modified: tomcat/trunk/java/org/apache/catalina/core/StandardHostValve.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/StandardHostValve.java?rev=1650365r1=1650364r2=1650365view=diff
==
--- tomcat/trunk/java/org/apache/catalina/core/StandardHostValve.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/StandardHostValve.java Thu Jan  
8 19:47:51 2015
@@ -180,7 +180,7 @@ final class StandardHostValve extends Va
 }
 }
 
-if (!request.isAsync()  !response.isErrorReportRequired()) {
+if (!request.isAsync()  (!asyncAtStart || 
!response.isErrorReportRequired())) {
 context.fireRequestDestroyEvent(request);
 }
 } finally {

Modified: tomcat/trunk/test/org/apache/catalina/core/TestStandardHostValve.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/core/TestStandardHostValve.java?rev=1650365r1=1650364r2=1650365view=diff
==
--- tomcat/trunk/test/org/apache/catalina/core/TestStandardHostValve.java 
(original)
+++ tomcat/trunk/test/org/apache/catalina/core/TestStandardHostValve.java Thu 
Jan  8 19:47:51 2015
@@ -28,7 +28,6 @@ import javax.servlet.http.HttpServletReq
 import javax.servlet.http.HttpServletResponse;
 
 import org.junit.Assert;
-import org.junit.Ignore;
 import org.junit.Test;
 
 import org.apache.catalina.Context;
@@ -73,8 +72,8 @@ public class TestStandardHostValve exten
 doTestErrorPageHandling(501, /default);
 }
 
+
 @Test
-@Ignore
 public void testSRLAfterError() throws Exception {
 // Set up a container
 Tomcat tomcat = getTomcatInstance();



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1650370 - /tomcat/trunk/java/org/apache/coyote/http11/Http11OutputBuffer.java

2015-01-08 Thread markt
Author: markt
Date: Thu Jan  8 19:58:37 2015
New Revision: 1650370

URL: http://svn.apache.org/r1650370
Log:
Remove unused code.

Modified:
tomcat/trunk/java/org/apache/coyote/http11/Http11OutputBuffer.java

Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11OutputBuffer.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11OutputBuffer.java?rev=1650370r1=1650369r2=1650370view=diff
==
--- tomcat/trunk/java/org/apache/coyote/http11/Http11OutputBuffer.java 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/Http11OutputBuffer.java Thu Jan  
8 19:58:37 2015
@@ -17,7 +17,6 @@
 package org.apache.coyote.http11;
 
 import java.io.IOException;
-import java.nio.ByteBuffer;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 
@@ -624,25 +623,6 @@ public class Http11OutputBufferS imple
 }
 
 
-// - Utility 
methods
-
-protected static int transfer(byte[] from, int offset, int length, 
ByteBuffer to) {
-int max = Math.min(length, to.remaining());
-to.put(from, offset, max);
-return max;
-}
-
-
-protected static void transfer(ByteBuffer from, ByteBuffer to) {
-int max = Math.min(from.remaining(), to.remaining());
-int fromLimit = from.limit();
-from.limit(from.position() + max);
-to.put(from);
-from.limit(fromLimit);
-}
-
-
-
 // -- SocketOutputBuffer Inner 
Class
 
 /**



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org