public abstract class ClientConnectionEndedEvent extends ClientEventBase implements ConnectionEvent
Client
has had a connection end.Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_RECONNECTION_DELAY_MILLIS
Default reconnection delay, in milliseconds.
|
Modifier | Constructor and Description |
---|---|
protected |
ClientConnectionEndedEvent(@NonNull Client client,
boolean canReconnect,
@Nullable Throwable cause)
Constructs the event.
|
Modifier and Type | Method and Description |
---|---|
boolean |
canAttemptReconnect()
Gets if the client will be able to reconnect.
|
@NonNull Optional<Throwable> |
getCause()
Gets the exception that caused this disconnect, if there was one.
|
int |
getReconnectionDelay()
Gets the delay until reconnection.
|
void |
setAttemptReconnect(boolean reconnecting)
Sets if the client will attempt to connect again.
|
void |
setReconnectionDelay(int millis)
Sets the delay until a reconnection attempt, in milliseconds.
|
protected @NonNull ToStringer |
toStringer()
Generates a partial
ToStringer for the command. |
boolean |
willAttemptReconnect()
Gets if the client plans to reconnect to the server.
|
getClient, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getClient
public static final int DEFAULT_RECONNECTION_DELAY_MILLIS
protected ClientConnectionEndedEvent(@NonNull Client client, boolean canReconnect, @Nullable Throwable cause)
client
- client for which this is occurringcanReconnect
- true if the client plans to reconnectcause
- cause, if there was one, closing itpublic @NonNull Optional<Throwable> getCause()
public int getReconnectionDelay()
canAttemptReconnect()
,
willAttemptReconnect()
,
setAttemptReconnect(boolean)
public boolean canAttemptReconnect()
public boolean willAttemptReconnect()
public void setAttemptReconnect(boolean reconnecting)
canAttemptReconnect()
is true as the client cannot
try to reconnect if it has been shutdown. Setting to true will still
result in a false willAttemptReconnect()
if it is not able
to reconnect.reconnecting
- true to reconnect, false to not reconnectpublic void setReconnectionDelay(int millis)
millis
- reconnection delayIllegalArgumentException
- if negativecanAttemptReconnect()
,
willAttemptReconnect()
,
setAttemptReconnect(boolean)
protected @NonNull ToStringer toStringer()
ClientEventBase
ToStringer
for the command.toStringer
in class ClientEventBase
Copyright © 2013–2021 Kitteh. All rights reserved.