JBossWeb SVN: r2315 - branches/7.3.x/src/main/java/org/apache/tomcat/util/net.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2013-11-29 11:40:39 -0500 (Fri, 29 Nov 2013)
New Revision: 2315
Modified:
branches/7.3.x/src/main/java/org/apache/tomcat/util/net/AprEndpoint.java
branches/7.3.x/src/main/java/org/apache/tomcat/util/net/JIoEndpoint.java
branches/7.3.x/src/main/java/org/apache/tomcat/util/net/NioEndpoint.java
Log:
Port BZ 1035787: Submitted by Ladislav Thon, once paused (and not resumed) the connector would leak some threads. Visible during testing management mostly.
Modified: branches/7.3.x/src/main/java/org/apache/tomcat/util/net/AprEndpoint.java
===================================================================
--- branches/7.3.x/src/main/java/org/apache/tomcat/util/net/AprEndpoint.java 2013-11-29 16:39:53 UTC (rev 2314)
+++ branches/7.3.x/src/main/java/org/apache/tomcat/util/net/AprEndpoint.java 2013-11-29 16:40:39 UTC (rev 2315)
@@ -1068,13 +1068,16 @@
while (running) {
// Loop if endpoint is paused
- while (paused) {
+ while (running && paused) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// Ignore
}
}
+ if (!running) {
+ break;
+ }
if (reverseConnection) {
if (poller.getConnectionCount() < (maxThreads / 5)) {
@@ -1677,7 +1680,7 @@
while (running) {
// Loop if endpoint is paused
- while (paused) {
+ while (running && paused) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
@@ -1685,7 +1688,7 @@
}
}
// Check timeouts for suspended connections if the poller is empty
- while (connectionCount < 1 && addList.size() < 1) {
+ while (running && connectionCount < 1 && addList.size() < 1) {
// Reset maintain time.
try {
if (soTimeout > 0 && running) {
@@ -1700,6 +1703,9 @@
CoyoteLogger.UTIL_LOGGER.errorProcessingSocketTimeout(t);
}
}
+ if (!running) {
+ break;
+ }
try {
// Add sockets which are waiting to the poller
@@ -2259,7 +2265,7 @@
while (running) {
// Loop if endpoint is paused
- while (paused) {
+ while (running && paused) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
@@ -2267,7 +2273,7 @@
}
}
// Loop if poller is empty
- while (sendfileCount < 1 && addS.size() < 1) {
+ while (running && sendfileCount < 1 && addS.size() < 1) {
// Reset maintain time.
maintainTime = 0;
try {
@@ -2278,6 +2284,9 @@
// Ignore
}
}
+ if (!running) {
+ break;
+ }
try {
// Add socket to the poller
Modified: branches/7.3.x/src/main/java/org/apache/tomcat/util/net/JIoEndpoint.java
===================================================================
--- branches/7.3.x/src/main/java/org/apache/tomcat/util/net/JIoEndpoint.java 2013-11-29 16:39:53 UTC (rev 2314)
+++ branches/7.3.x/src/main/java/org/apache/tomcat/util/net/JIoEndpoint.java 2013-11-29 16:40:39 UTC (rev 2315)
@@ -296,13 +296,16 @@
while (running) {
// Loop if endpoint is paused
- while (paused) {
+ while (running && paused) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// Ignore
}
}
+ if (!running) {
+ break;
+ }
// Accept the next incoming connection from the server socket
try {
@@ -714,7 +717,7 @@
while (running) {
// Loop if endpoint is paused
- while (paused) {
+ while (running && paused) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
@@ -722,7 +725,7 @@
}
}
// Check timeouts for suspended connections if the poller is empty
- while (connectionCount < 1 && addList.size() < 1) {
+ while (running && connectionCount < 1 && addList.size() < 1) {
// Reset maintain time.
try {
if (soTimeout > 0 && running) {
@@ -737,6 +740,9 @@
CoyoteLogger.UTIL_LOGGER.errorProcessingSocketTimeout(t);
}
}
+ if (!running) {
+ break;
+ }
try {
Modified: branches/7.3.x/src/main/java/org/apache/tomcat/util/net/NioEndpoint.java
===================================================================
--- branches/7.3.x/src/main/java/org/apache/tomcat/util/net/NioEndpoint.java 2013-11-29 16:39:53 UTC (rev 2314)
+++ branches/7.3.x/src/main/java/org/apache/tomcat/util/net/NioEndpoint.java 2013-11-29 16:40:39 UTC (rev 2315)
@@ -627,13 +627,16 @@
// Loop until we receive a shutdown command
while (running) {
// Loop if end point is paused
- while (paused) {
+ while (running && paused) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// Ignore
}
}
+ if (!running) {
+ break;
+ }
try {
// Accept the next incoming connection from the server
@@ -1115,7 +1118,7 @@
public void run() {
while (running) {
// Loop if endpoint is paused
- while (paused) {
+ while (running && paused) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
@@ -1604,7 +1607,7 @@
while (running) {
// Loop if endpoint is paused
- while (paused) {
+ while (running && paused) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
11 years, 1 month
JBossWeb SVN: r2314 - branches/7.4.x/src/main/java/org/apache/tomcat/util/net.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2013-11-29 11:39:53 -0500 (Fri, 29 Nov 2013)
New Revision: 2314
Modified:
branches/7.4.x/src/main/java/org/apache/tomcat/util/net/NioEndpoint.java
Log:
Remove duplicate check.
Modified: branches/7.4.x/src/main/java/org/apache/tomcat/util/net/NioEndpoint.java
===================================================================
--- branches/7.4.x/src/main/java/org/apache/tomcat/util/net/NioEndpoint.java 2013-11-29 15:13:32 UTC (rev 2313)
+++ branches/7.4.x/src/main/java/org/apache/tomcat/util/net/NioEndpoint.java 2013-11-29 16:39:53 UTC (rev 2314)
@@ -974,7 +974,7 @@
}
}
- while (running && this.channelList.size() < 1 && running) {
+ while (this.channelList.size() < 1 && running) {
synchronized (this.mutex) {
try {
this.mutex.wait(10000);
@@ -984,7 +984,7 @@
}
}
- while (running && this.channelList.size() > 0 && running) {
+ while (this.channelList.size() > 0 && running) {
maintain();
try {
Thread.sleep(5000);
11 years, 1 month
JBossWeb SVN: r2313 - branches/7.4.x/src/main/java/org/apache/tomcat/util/net.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2013-11-29 10:13:32 -0500 (Fri, 29 Nov 2013)
New Revision: 2313
Modified:
branches/7.4.x/src/main/java/org/apache/tomcat/util/net/AprEndpoint.java
branches/7.4.x/src/main/java/org/apache/tomcat/util/net/JIoEndpoint.java
branches/7.4.x/src/main/java/org/apache/tomcat/util/net/NioEndpoint.java
Log:
BZ 1035787: Submitted by Ladislav Thon, once paused (and not resumed) the connector would leak some threads. Visible during testing management mostly.
Modified: branches/7.4.x/src/main/java/org/apache/tomcat/util/net/AprEndpoint.java
===================================================================
--- branches/7.4.x/src/main/java/org/apache/tomcat/util/net/AprEndpoint.java 2013-11-28 15:02:26 UTC (rev 2312)
+++ branches/7.4.x/src/main/java/org/apache/tomcat/util/net/AprEndpoint.java 2013-11-29 15:13:32 UTC (rev 2313)
@@ -1068,13 +1068,16 @@
while (running) {
// Loop if endpoint is paused
- while (paused) {
+ while (running && paused) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// Ignore
}
}
+ if (!running) {
+ break;
+ }
if (reverseConnection) {
if (poller.getConnectionCount() < (maxThreads / 5)) {
@@ -1677,7 +1680,7 @@
while (running) {
// Loop if endpoint is paused
- while (paused) {
+ while (running && paused) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
@@ -1685,7 +1688,7 @@
}
}
// Check timeouts for suspended connections if the poller is empty
- while (connectionCount < 1 && addList.size() < 1) {
+ while (running && connectionCount < 1 && addList.size() < 1) {
// Reset maintain time.
try {
if (soTimeout > 0 && running) {
@@ -1700,6 +1703,9 @@
CoyoteLogger.UTIL_LOGGER.errorProcessingSocketTimeout(t);
}
}
+ if (!running) {
+ break;
+ }
try {
// Add sockets which are waiting to the poller
@@ -2259,7 +2265,7 @@
while (running) {
// Loop if endpoint is paused
- while (paused) {
+ while (running && paused) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
@@ -2267,7 +2273,7 @@
}
}
// Loop if poller is empty
- while (sendfileCount < 1 && addS.size() < 1) {
+ while (running && sendfileCount < 1 && addS.size() < 1) {
// Reset maintain time.
maintainTime = 0;
try {
@@ -2278,6 +2284,9 @@
// Ignore
}
}
+ if (!running) {
+ break;
+ }
try {
// Add socket to the poller
Modified: branches/7.4.x/src/main/java/org/apache/tomcat/util/net/JIoEndpoint.java
===================================================================
--- branches/7.4.x/src/main/java/org/apache/tomcat/util/net/JIoEndpoint.java 2013-11-28 15:02:26 UTC (rev 2312)
+++ branches/7.4.x/src/main/java/org/apache/tomcat/util/net/JIoEndpoint.java 2013-11-29 15:13:32 UTC (rev 2313)
@@ -296,13 +296,16 @@
while (running) {
// Loop if endpoint is paused
- while (paused) {
+ while (running && paused) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// Ignore
}
}
+ if (!running) {
+ break;
+ }
// Accept the next incoming connection from the server socket
try {
@@ -714,7 +717,7 @@
while (running) {
// Loop if endpoint is paused
- while (paused) {
+ while (running && paused) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
@@ -722,7 +725,7 @@
}
}
// Check timeouts for suspended connections if the poller is empty
- while (connectionCount < 1 && addList.size() < 1) {
+ while (running && connectionCount < 1 && addList.size() < 1) {
// Reset maintain time.
try {
if (soTimeout > 0 && running) {
@@ -737,6 +740,9 @@
CoyoteLogger.UTIL_LOGGER.errorProcessingSocketTimeout(t);
}
}
+ if (!running) {
+ break;
+ }
try {
Modified: branches/7.4.x/src/main/java/org/apache/tomcat/util/net/NioEndpoint.java
===================================================================
--- branches/7.4.x/src/main/java/org/apache/tomcat/util/net/NioEndpoint.java 2013-11-28 15:02:26 UTC (rev 2312)
+++ branches/7.4.x/src/main/java/org/apache/tomcat/util/net/NioEndpoint.java 2013-11-29 15:13:32 UTC (rev 2313)
@@ -542,13 +542,16 @@
// Loop until we receive a shutdown command
while (running) {
// Loop if end point is paused
- while (paused) {
+ while (running && paused) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// Ignore
}
}
+ if (!running) {
+ break;
+ }
try {
// Accept the next incoming connection from the server
@@ -963,7 +966,7 @@
public void run() {
while (running) {
// Loop if endpoint is paused
- while (paused) {
+ while (running && paused) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
@@ -971,7 +974,7 @@
}
}
- while (this.channelList.size() < 1 && running) {
+ while (running && this.channelList.size() < 1 && running) {
synchronized (this.mutex) {
try {
this.mutex.wait(10000);
@@ -981,7 +984,7 @@
}
}
- while (this.channelList.size() > 0 && running) {
+ while (running && this.channelList.size() > 0 && running) {
maintain();
try {
Thread.sleep(5000);
@@ -1385,7 +1388,7 @@
while (running) {
// Loop if endpoint is paused
- while (paused) {
+ while (running && paused) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
11 years, 1 month
JBossWeb SVN: r2312 - branches/7.4.x/src/main/java/org/apache/tomcat/websocket.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2013-11-28 10:02:26 -0500 (Thu, 28 Nov 2013)
New Revision: 2312
Modified:
branches/7.4.x/src/main/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java
Log:
Port additional fix for streaming.
Modified: branches/7.4.x/src/main/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java
===================================================================
--- branches/7.4.x/src/main/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java 2013-11-28 14:58:18 UTC (rev 2311)
+++ branches/7.4.x/src/main/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java 2013-11-28 15:02:26 UTC (rev 2312)
@@ -782,7 +782,7 @@
}
}
- private static class WsOutputStream extends OutputStream {
+ private class WsOutputStream extends OutputStream {
private final WsRemoteEndpointImplBase endpoint;
private final ByteBuffer buffer = ByteBuffer.allocate(8192);
@@ -857,6 +857,7 @@
private void doWrite(boolean last) throws IOException {
buffer.flip();
endpoint.startMessageBlock(Constants.OPCODE_BINARY, buffer, last);
+ stateMachine.complete(last);
buffer.clear();
}
}
11 years, 1 month
JBossWeb SVN: r2311 - branches/7.4.x/src/main/java/org/apache/tomcat/websocket/server.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2013-11-28 09:58:18 -0500 (Thu, 28 Nov 2013)
New Revision: 2311
Modified:
branches/7.4.x/src/main/java/org/apache/tomcat/websocket/server/WsServerContainer.java
Log:
Port patch to avoid NPE after HTTP session expiration.
Modified: branches/7.4.x/src/main/java/org/apache/tomcat/websocket/server/WsServerContainer.java
===================================================================
--- branches/7.4.x/src/main/java/org/apache/tomcat/websocket/server/WsServerContainer.java 2013-11-26 11:44:43 UTC (rev 2310)
+++ branches/7.4.x/src/main/java/org/apache/tomcat/websocket/server/WsServerContainer.java 2013-11-28 14:58:18 UTC (rev 2311)
@@ -393,7 +393,10 @@
private void unregisterAuthenticatedSession(WsSession wsSession,
String httpSessionId) {
Set<WsSession> wsSessions = authenticatedSessions.get(httpSessionId);
- wsSessions.remove(wsSession);
+ // wsSessions will be null if the HTTP session has ended
+ if (wsSessions != null) {
+ wsSessions.remove(wsSession);
+ }
}
11 years, 1 month
JBossWeb SVN: r2310 - branches/7.4.x/src/main/java/org/apache/tomcat/websocket.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2013-11-26 06:44:43 -0500 (Tue, 26 Nov 2013)
New Revision: 2310
Modified:
branches/7.4.x/src/main/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java
Log:
Port websocket patch fixing streaming with the big state patch.
Modified: branches/7.4.x/src/main/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java
===================================================================
--- branches/7.4.x/src/main/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java 2013-11-21 16:09:03 UTC (rev 2309)
+++ branches/7.4.x/src/main/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java 2013-11-26 11:44:43 UTC (rev 2310)
@@ -856,7 +856,7 @@
private void doWrite(boolean last) throws IOException {
buffer.flip();
- endpoint.sendPartialBytes(buffer, last);
+ endpoint.startMessageBlock(Constants.OPCODE_BINARY, buffer, last);
buffer.clear();
}
}
11 years, 1 month
JBossWeb SVN: r2309 - in branches/7.4.x/src/main/java/org: jboss/web and 1 other directory.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2013-11-21 11:09:03 -0500 (Thu, 21 Nov 2013)
New Revision: 2309
Modified:
branches/7.4.x/src/main/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java
branches/7.4.x/src/main/java/org/jboss/web/WebsocketsMessages.java
Log:
Port big patch redoing concurrency control of sending text messages in websockets.
Modified: branches/7.4.x/src/main/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java
===================================================================
--- branches/7.4.x/src/main/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java 2013-11-18 15:39:46 UTC (rev 2308)
+++ branches/7.4.x/src/main/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java 2013-11-21 16:09:03 UTC (rev 2309)
@@ -54,13 +54,14 @@
public static final String BLOCKING_SEND_TIMEOUT_PROPERTY =
"org.apache.tomcat.websocket.BLOCKING_SEND_TIMEOUT";
+ private final StateMachine stateMachine = new StateMachine();
+
private boolean messagePartInProgress = false;
private final Queue<MessagePart> messagePartQueue = new ArrayDeque<MessagePart>();
private final Object messagePartLock = new Object();
- private boolean dataMessageInProgress = false;
// State
- private boolean closed = false;
+ private volatile boolean closed = false;
private boolean fragmented = false;
private boolean nextFragmented = false;
private boolean text = false;
@@ -109,7 +110,9 @@
public void sendBytes(ByteBuffer data) throws IOException {
+ stateMachine.binaryStart();
startMessageBlock(Constants.OPCODE_BINARY, data, true);
+ stateMachine.complete(true);
}
@@ -121,13 +124,17 @@
public void sendBytesByCompletion(ByteBuffer data, SendHandler handler) {
- startMessage(Constants.OPCODE_BINARY, data, true, handler);
+ StateUpdateSendHandler sush = new StateUpdateSendHandler(handler);
+ stateMachine.binaryStart();
+ startMessage(Constants.OPCODE_BINARY, data, true, sush);
}
public void sendPartialBytes(ByteBuffer partialByte, boolean last)
throws IOException {
+ stateMachine.binaryPartialStart();
startMessageBlock(Constants.OPCODE_BINARY, partialByte, last);
+ stateMachine.complete(last);
}
@@ -146,6 +153,7 @@
public void sendString(String text) throws IOException {
+ stateMachine.textStart();
sendPartialString(CharBuffer.wrap(text), true);
}
@@ -158,24 +166,29 @@
public void sendStringByCompletion(String text, SendHandler handler) {
+ stateMachine.textStart();
TextMessageSendHandler tmsh = new TextMessageSendHandler(handler,
CharBuffer.wrap(text), true, encoder, encoderBuffer, this);
tmsh.write();
+ // TextMessageSendHandler will update stateMachine when it completes
}
public void sendPartialString(String fragment, boolean isLast)
throws IOException {
+ stateMachine.textPartialStart();
sendPartialString(CharBuffer.wrap(fragment), isLast);
}
public OutputStream getSendStream() {
+ stateMachine.streamStart();
return new WsOutputStream(this);
}
public Writer getSendWriter() {
+ stateMachine.writeStart();
return new WsWriter(this);
}
@@ -245,13 +258,15 @@
}
}
if (messagePartInProgress) {
- if (!Util.isControl(opCode)) {
- if (dataMessageInProgress) {
- throw MESSAGES.messageInProgress();
- } else {
- dataMessageInProgress = true;
- }
- }
+ // When a control message is sent while another message is being
+ // the control message is queued. Chances are the subsequent
+ // data message part will end up queued while the control
+ // message is sent. The logic in this class (state machine,
+ // EndMessageHanlder, TextMessageSendHandler) ensures that there
+ // will only ever be one data message part in the queue. There
+ // could be multiple control messages in the queue.
+
+ // Add it to the queue
messagePartQueue.add(mp);
} else {
messagePartInProgress = true;
@@ -261,16 +276,12 @@
}
- void endMessage(SendHandler handler, SendResult result,
- boolean dataMessage) {
+ void endMessage(SendHandler handler, SendResult result) {
synchronized (messagePartLock) {
fragmented = nextFragmented;
text = nextText;
- if (dataMessage) {
- dataMessageInProgress = false;
- }
MessagePart mpNext = messagePartQueue.poll();
if (mpNext == null) {
messagePartInProgress = false;
@@ -388,8 +399,7 @@
this.opCode = opCode;
this.payload = payload;
this.last = last;
- this.handler = new EndMessageHandler(
- endpoint, handler, !Util.isControl(opCode));
+ this.handler = new EndMessageHandler(endpoint, handler);
}
@@ -422,19 +432,17 @@
private final WsRemoteEndpointImplBase endpoint;
private final SendHandler handler;
- private final boolean dataMessage;
public EndMessageHandler(WsRemoteEndpointImplBase endpoint,
- SendHandler handler, boolean dataMessage) {
+ SendHandler handler) {
this.endpoint = endpoint;
this.handler = handler;
- this.dataMessage = dataMessage;
}
@Override
public void onResult(SendResult result) {
- endpoint.endMessage(handler, result, dataMessage);
+ endpoint.endMessage(handler, result);
}
}
@@ -622,7 +630,7 @@
}
- private static class TextMessageSendHandler implements SendHandler {
+ private class TextMessageSendHandler implements SendHandler {
private final SendHandler handler;
private final CharBuffer message;
@@ -657,8 +665,14 @@
@Override
public void onResult(SendResult result) {
- if (isDone || !result.isOK()) {
+ if (isDone) {
+ endpoint.stateMachine.complete(isLast);
handler.onResult(result);
+ } else if(!result.isOK()) {
+ handler.onResult(result);
+ } else if (closed){
+ SendResult sr = new SendResult(new IOException(MESSAGES.messageRemainderSessionClosed()));
+ handler.onResult(sr);
} else {
write();
}
@@ -934,4 +948,106 @@
return encoder;
}
}
+
+
+ private static enum State {
+ OPEN,
+ STREAM_WRITING,
+ WRITER_WRITING,
+ BINARY_PARTIAL_WRITING,
+ BINARY_PARTIAL_READY,
+ BINARY_FULL_WRITING,
+ TEXT_PARTIAL_WRITING,
+ TEXT_PARTIAL_READY,
+ TEXT_FULL_WRITING
+ }
+
+
+ private static class StateMachine {
+ private State state = State.OPEN;
+
+ public synchronized void streamStart() {
+ checkState(State.OPEN);
+ state = State.STREAM_WRITING;
+ }
+
+ public synchronized void writeStart() {
+ checkState(State.OPEN);
+ state = State.WRITER_WRITING;
+ }
+
+ public synchronized void binaryPartialStart() {
+ checkState(State.OPEN, State.BINARY_PARTIAL_READY);
+ state = State.BINARY_PARTIAL_WRITING;
+ }
+
+ public synchronized void binaryStart() {
+ checkState(State.OPEN);
+ state = State.BINARY_FULL_WRITING;
+ }
+
+ public synchronized void textPartialStart() {
+ checkState(State.OPEN, State.TEXT_PARTIAL_READY);
+ state = State.TEXT_PARTIAL_WRITING;
+ }
+
+ public synchronized void textStart() {
+ checkState(State.OPEN);
+ state = State.TEXT_FULL_WRITING;
+ }
+
+ public synchronized void complete(boolean last) {
+ if (last) {
+ checkState(State.TEXT_PARTIAL_WRITING, State.TEXT_FULL_WRITING,
+ State.BINARY_PARTIAL_WRITING, State.BINARY_FULL_WRITING,
+ State.STREAM_WRITING, State.WRITER_WRITING);
+ state = State.OPEN;
+ } else {
+ checkState(State.TEXT_PARTIAL_WRITING, State.BINARY_PARTIAL_WRITING,
+ State.STREAM_WRITING, State.WRITER_WRITING);
+ if (state == State.TEXT_PARTIAL_WRITING) {
+ state = State.TEXT_PARTIAL_READY;
+ } else if (state == State.BINARY_PARTIAL_WRITING){
+ state = State.BINARY_PARTIAL_READY;
+ } else if (state == State.WRITER_WRITING) {
+ // NO-OP. Leave state as is.
+ } else if (state == State.STREAM_WRITING) {
+ // NO-OP. Leave state as is.
+ } else {
+ // Should never happen
+ // The if ... else ... blocks above should cover all states
+ // permitted by the preceding checkState() call
+ throw new IllegalStateException(
+ "BUG: This code should never be called");
+ }
+ }
+ }
+
+ private void checkState(State... required) {
+ for (State state : required) {
+ if (this.state == state) {
+ return;
+ }
+ }
+ throw MESSAGES.wrongState(state.toString());
+ }
+ }
+
+
+ private class StateUpdateSendHandler implements SendHandler {
+
+ private final SendHandler handler;
+
+ public StateUpdateSendHandler(SendHandler handler) {
+ this.handler = handler;
+ }
+
+ @Override
+ public void onResult(SendResult result) {
+ if (result.isOK()) {
+ stateMachine.complete(true);
+ }
+ handler.onResult(result);
+ }
+ }
}
Modified: branches/7.4.x/src/main/java/org/jboss/web/WebsocketsMessages.java
===================================================================
--- branches/7.4.x/src/main/java/org/jboss/web/WebsocketsMessages.java 2013-11-18 15:39:46 UTC (rev 2308)
+++ branches/7.4.x/src/main/java/org/jboss/web/WebsocketsMessages.java 2013-11-21 16:09:03 UTC (rev 2309)
@@ -122,8 +122,8 @@
@Message(id = 8528, value = "Too many bytes ([%s]) were provided to be converted into a long")
String invalidLong(long length);
- @Message(id = 8529, value = "Message will not be sent because the WebSocket session is currently sending another message")
- IllegalStateException messageInProgress();
+ @Message(id = 8529, value = "The remote endpoint was in state [%s] which is an invalid state for called method")
+ IllegalStateException wrongState(String state);
@Message(id = 8530, value = "Message will not be sent because the WebSocket session has been closed")
IllegalStateException messageSessionClosed();
@@ -299,4 +299,7 @@
@Message(id = 8587, value = "This connection was established under an authenticated HTTP session that has ended")
String expiredHttpSession();
+ @Message(id = 8588, value = "The remainder of the message will not be sent because the WebSocket session has been closed")
+ String messageRemainderSessionClosed();
+
}
11 years, 1 month
JBossWeb SVN: r2308 - tags.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2013-11-18 10:39:46 -0500 (Mon, 18 Nov 2013)
New Revision: 2308
Added:
tags/JBOSSWEB_7_4_0_BETA1/
Log:
7.4.0 beta tag, includes Websocket JSR (Java 7 required for this feature). For EAP 6.3.
11 years, 1 month
JBossWeb SVN: r2307 - branches/7.4.x.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2013-11-18 10:37:23 -0500 (Mon, 18 Nov 2013)
New Revision: 2307
Modified:
branches/7.4.x/pom.xml
Log:
Version number.
Modified: branches/7.4.x/pom.xml
===================================================================
--- branches/7.4.x/pom.xml 2013-11-18 15:36:02 UTC (rev 2306)
+++ branches/7.4.x/pom.xml 2013-11-18 15:37:23 UTC (rev 2307)
@@ -33,7 +33,7 @@
<groupId>org.jboss.web</groupId>
<artifactId>jbossweb</artifactId>
- <version>7.4.0.Final</version>
+ <version>7.4.0.Beta1</version>
<name>JBoss Web</name>
<description>Servlet 3.0 container</description>
11 years, 1 month
JBossWeb SVN: r2306 - tags.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2013-11-18 10:36:02 -0500 (Mon, 18 Nov 2013)
New Revision: 2306
Added:
tags/JBOSSWEB_7_3_0_FINAL/
Log:
7.3.0 tag, effectively identical to the 7.2 branch. For EAP 6.2 maintenance.
11 years, 1 month