- 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,6 +137,18 @@ public class TcpTransport extends TransportThreadSupport implements Transport, S
log.trace("TCP consumer thread starting");
try {
while (!isStopped()) {
doRun();
}
} catch (IOException e) {
stoppedLatch.get().countDown();
onException(e);
} finally {
stoppedLatch.get().countDown();
}
}
protected void doRun() throws IOException {
try {
Object command = readCommand();
doConsume(command);
@ -146,13 +158,6 @@ public class TcpTransport extends TransportThreadSupport implements Transport, S
catch (InterruptedIOException e) {
}
}
} catch (IOException e) {
stoppedLatch.get().countDown();
onException(e);
} finally {
stoppedLatch.get().countDown();
}
}
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);
}
}