- 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"); log.trace("TCP consumer thread starting");
try { try {
while (!isStopped()) { while (!isStopped()) {
try { doRun();
Object command = readCommand();
doConsume(command);
}
catch (SocketTimeoutException e) {
}
catch (InterruptedIOException e) {
}
} }
} catch (IOException e) { } catch (IOException e) {
stoppedLatch.get().countDown(); 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 { protected Object readCommand() throws IOException {
return wireFormat.unmarshal(dataIn); return wireFormat.unmarshal(dataIn);
} }

View File

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