mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-22 12:02:05 +01:00
Remove null checks for writer/reader fields in XMPPTCPConnection
as those are never null since
60f324eb1b
(the previous commit).
This commit is contained in:
parent
60f324eb1b
commit
78dcaec75b
2 changed files with 21 additions and 15 deletions
|
@ -234,6 +234,16 @@ public class SynchronizationPoint<E extends Exception> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isNotInInitialState() {
|
||||||
|
connectionLock.lock();
|
||||||
|
try {
|
||||||
|
return state != State.Initial;
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
connectionLock.unlock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if this synchronization point has its request already sent.
|
* Check if this synchronization point has its request already sent.
|
||||||
*
|
*
|
||||||
|
|
|
@ -492,10 +492,8 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
|
||||||
|
|
||||||
// First shutdown the writer, this will result in a closing stream element getting send to
|
// First shutdown the writer, this will result in a closing stream element getting send to
|
||||||
// the server
|
// the server
|
||||||
if (packetWriter != null) {
|
|
||||||
LOGGER.finer("PacketWriter shutdown()");
|
LOGGER.finer("PacketWriter shutdown()");
|
||||||
packetWriter.shutdown(instant);
|
packetWriter.shutdown(instant);
|
||||||
}
|
|
||||||
LOGGER.finer("PacketWriter has been shut down");
|
LOGGER.finer("PacketWriter has been shut down");
|
||||||
|
|
||||||
if (!instant) {
|
if (!instant) {
|
||||||
|
@ -510,10 +508,8 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (packetReader != null) {
|
|
||||||
LOGGER.finer("PacketReader shutdown()");
|
LOGGER.finer("PacketReader shutdown()");
|
||||||
packetReader.shutdown();
|
packetReader.shutdown();
|
||||||
}
|
|
||||||
LOGGER.finer("PacketReader has been shut down");
|
LOGGER.finer("PacketReader has been shut down");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -929,8 +925,7 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
|
||||||
*/
|
*/
|
||||||
private synchronized void notifyConnectionError(Exception e) {
|
private synchronized void notifyConnectionError(Exception e) {
|
||||||
// Listeners were already notified of the exception, return right here.
|
// Listeners were already notified of the exception, return right here.
|
||||||
if ((packetReader == null || packetReader.done) &&
|
if (packetReader.done && packetWriter.done()) return;
|
||||||
(packetWriter == null || packetWriter.done())) return;
|
|
||||||
|
|
||||||
SmackWrappedException smackWrappedException = new SmackWrappedException(e);
|
SmackWrappedException smackWrappedException = new SmackWrappedException(e);
|
||||||
tlsHandled.reportGenericFailure(smackWrappedException);
|
tlsHandled.reportGenericFailure(smackWrappedException);
|
||||||
|
@ -1386,13 +1381,14 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
|
||||||
instantShutdown = instant;
|
instantShutdown = instant;
|
||||||
queue.shutdown();
|
queue.shutdown();
|
||||||
shutdownTimestamp = System.currentTimeMillis();
|
shutdownTimestamp = System.currentTimeMillis();
|
||||||
|
if (shutdownDone.isNotInInitialState()) {
|
||||||
try {
|
try {
|
||||||
shutdownDone.checkIfSuccessOrWait();
|
shutdownDone.checkIfSuccessOrWait();
|
||||||
}
|
} catch (NoResponseException | InterruptedException e) {
|
||||||
catch (NoResponseException | InterruptedException e) {
|
|
||||||
LOGGER.log(Level.WARNING, "shutdownDone was not marked as successful by the writer thread", e);
|
LOGGER.log(Level.WARNING, "shutdownDone was not marked as successful by the writer thread", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Maybe return the next available element from the queue for writing. If the queue is shut down <b>or</b> a
|
* Maybe return the next available element from the queue for writing. If the queue is shut down <b>or</b> a
|
||||||
|
|
Loading…
Reference in a new issue