1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-12-23 13:07:59 +01:00

Cleanup SASLAuthentication

- Synchronized as method keyword
- Removed star import
This commit is contained in:
Florian Schmaus 2014-03-24 19:30:34 +01:00
parent c4f86762cb
commit 53ca314b50

View file

@ -32,7 +32,11 @@ import javax.security.sasl.SaslException;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
import java.util.*; import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* <p>This class is responsible authenticating the user using SASL, binding the resource * <p>This class is responsible authenticating the user using SASL, binding the resource
@ -482,13 +486,11 @@ public class SASLAuthentication {
* Notification message saying that SASL authentication was successful. The next step * Notification message saying that SASL authentication was successful. The next step
* would be to bind the resource. * would be to bind the resource.
*/ */
void authenticated() { synchronized void authenticated() {
synchronized (this) {
saslNegotiated = true; saslNegotiated = true;
// Wake up the thread that is waiting in the #authenticate method // Wake up the thread that is waiting in the #authenticate method
notify(); notify();
} }
}
/** /**
* Notification message saying that SASL authentication has failed. The server may have * Notification message saying that SASL authentication has failed. The server may have
@ -497,25 +499,21 @@ public class SASLAuthentication {
* @param saslFailure the SASL failure as reported by the server * @param saslFailure the SASL failure as reported by the server
* @see <a href="https://tools.ietf.org/html/rfc6120#section-6.5">RFC6120 6.5</a> * @see <a href="https://tools.ietf.org/html/rfc6120#section-6.5">RFC6120 6.5</a>
*/ */
void authenticationFailed(SASLFailure saslFailure) { synchronized void authenticationFailed(SASLFailure saslFailure) {
synchronized (this) {
this.saslFailure = saslFailure; this.saslFailure = saslFailure;
// Wake up the thread that is waiting in the #authenticate method // Wake up the thread that is waiting in the #authenticate method
notify(); notify();
} }
}
/** /**
* Notification message saying that the server requires the client to bind a * Notification message saying that the server requires the client to bind a
* resource to the stream. * resource to the stream.
*/ */
void bindingRequired() { synchronized void bindingRequired() {
synchronized (this) {
resourceBinded = true; resourceBinded = true;
// Wake up the thread that is waiting in the #authenticate method // Wake up the thread that is waiting in the #authenticate method
notify(); notify();
} }
}
public void send(Packet stanza) throws NotConnectedException { public void send(Packet stanza) throws NotConnectedException {
connection.sendPacket(stanza); connection.sendPacket(stanza);