- Fix for the xmpp transport needed du to recently added stop() synchronization.

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@560979 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Hiram R. Chirino 2007-07-30 13:41:59 +00:00
parent ea74731701
commit 2d27d56e59
2 changed files with 15 additions and 20 deletions

View File

@ -137,14 +137,7 @@ public class TcpTransport extends TransportThreadSupport implements Transport, S
log.trace("TCP consumer thread starting");
try {
while (!isStopped()) {
try {
Object command = readCommand();
doConsume(command);
}
catch (SocketTimeoutException e) {
}
catch (InterruptedIOException e) {
}
doRun();
}
} catch (IOException e) {
stoppedLatch.get().countDown();
@ -154,6 +147,18 @@ public class TcpTransport extends TransportThreadSupport implements Transport, S
}
}
protected void doRun() throws IOException {
try {
Object command = readCommand();
doConsume(command);
}
catch (SocketTimeoutException e) {
}
catch (InterruptedIOException e) {
}
}
protected Object readCommand() throws IOException {
return wireFormat.unmarshal(dataIn);
}

View File

@ -144,9 +144,8 @@ public class XmppTransport extends TcpTransport {
}
@Override
public void run() {
public void doRun() throws IOException {
log.debug("XMPP consumer thread starting");
try {
XMLInputFactory xif = XMLInputFactory.newInstance();
xif.setXMLReporter(new XMLReporter() {
@ -196,17 +195,8 @@ public class XmppTransport extends TcpTransport {
}
}
}
catch (XMLStreamException e) {
log.error("XMPP Reader thread caught: " + e, e);
}
catch (Exception e) {
log.error("XMPP Reader thread caught: " + e, e);
}
try {
stop();
}
catch (Exception e) {
log.error("Failed to stop XMPP transport: " + e, e);
throw IOExceptionSupport.create(e);
}
}