Replaced TimeLimitExceededException by TimeoutException
This allows the removal of the java.naming module dependency.
This commit is contained in:
@@ -6,10 +6,9 @@ import java.net.Socket;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.naming.TimeLimitExceededException;
|
||||
|
||||
import envoy.client.data.Cache;
|
||||
import envoy.client.data.ClientConfig;
|
||||
import envoy.client.data.LocalDB;
|
||||
@@ -61,14 +60,14 @@ public class Client implements Closeable {
|
||||
* @param receivedMessageCache a message cache containing all unread messages
|
||||
* from the server that can be relayed after
|
||||
* initialization
|
||||
* @throws TimeLimitExceededException if the server could not be reached
|
||||
* @throws IOException if the login credentials could not be
|
||||
* written
|
||||
* @throws InterruptedException if the current thread is interrupted while
|
||||
* waiting for the handshake response
|
||||
* @throws TimeoutException if the server could not be reached
|
||||
* @throws IOException if the login credentials could not be
|
||||
* written
|
||||
* @throws InterruptedException if the current thread is interrupted while
|
||||
* waiting for the handshake response
|
||||
*/
|
||||
public void performHandshake(LoginCredentials credentials, Cache<Message> receivedMessageCache)
|
||||
throws TimeLimitExceededException, IOException, InterruptedException {
|
||||
throws TimeoutException, IOException, InterruptedException {
|
||||
if (online) throw new IllegalStateException("Handshake has already been performed successfully");
|
||||
// Establish TCP connection
|
||||
logger.finer(String.format("Attempting connection to server %s:%d...", config.getServer(), config.getPort()));
|
||||
@@ -103,7 +102,7 @@ public class Client implements Closeable {
|
||||
return;
|
||||
}
|
||||
|
||||
if (System.currentTimeMillis() - start > 5000) throw new TimeLimitExceededException("Did not log in after 5 seconds");
|
||||
if (System.currentTimeMillis() - start > 5000) throw new TimeoutException("Did not log in after 5 seconds");
|
||||
Thread.sleep(500);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user