@NotThreadSafe public class JnlpConnectionState extends Object
JnlpConnectionStateListener| Modifier and Type | Class and Description |
|---|---|
static interface |
JnlpConnectionState.ListenerState
Marker base class for all stashed state data.
|
| Modifier and Type | Field and Description |
|---|---|
static String |
CLIENT_NAME_KEY
The property name for the client name key.
|
static String |
COOKIE_KEY
The proprty name for the cookie name key.
|
static String |
SECRET_KEY
The property name for the secret key.
|
| Modifier | Constructor and Description |
|---|---|
protected |
JnlpConnectionState(Socket socket,
List<? extends JnlpConnectionStateListener> listeners)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
approve()
Signals that the current
JnlpConnectionStateListener is declaring ownership of this event, approving
the connection and all other JnlpConnectionStateListener instances will now be ignored. |
Channel |
getChannel()
Gets the connection's
Channel. |
ChannelBuilder |
getChannelBuilder()
Gets the
ChannelBuilder that will be used to create the connection's Channel. |
IOException |
getCloseCause()
Gets the reason for the channel being closed if available.
|
Map<String,String> |
getProperties()
Gets the connection properties.
|
String |
getProperty(String name)
Gets the named connection property.
|
Socket |
getSocket()
Gets the socket that the connection is on.
|
<S extends JnlpConnectionState.ListenerState> |
getStash(Class<S> clazz)
Retrieves the previously stashed state.
|
void |
ignore()
Signals that the current
JnlpConnectionStateListener is not interested in this event any more. |
void |
reject(ConnectionRefusalException reason)
Signals that the current
JnlpConnectionStateListener is declaring ownership of this event, rejecting
the connection and all other JnlpConnectionStateListener instances will now be ignored. |
<S extends JnlpConnectionState.ListenerState> |
setStash(S stash)
Stores some listener specific state for later retrieval.
|
public static final String SECRET_KEY
public static final String CLIENT_NAME_KEY
public static final String COOKIE_KEY
protected JnlpConnectionState(@Nonnull Socket socket, List<? extends JnlpConnectionStateListener> listeners)
socket - the Socket.listeners - the JnlpConnectionStateListener instances.@Nonnull public Socket getSocket()
public Map<String,String> getProperties()
IllegalStateException - if invoked before
JnlpConnectionStateListener.afterProperties(JnlpConnectionState)public String getProperty(String name)
name - the property name.IllegalStateException - if invoked before
JnlpConnectionStateListener.afterProperties(JnlpConnectionState)public ChannelBuilder getChannelBuilder()
ChannelBuilder that will be used to create the connection's Channel.ChannelBuilderIllegalStateException - if invoked outside of
JnlpConnectionStateListener.beforeChannel(JnlpConnectionState)public Channel getChannel()
Channel.Channel (may be closed already), may be null in
JnlpConnectionStateListener.afterDisconnect(JnlpConnectionState) if the socket was closed by
the client.IllegalStateException - if invoked before
JnlpConnectionStateListener.afterChannel(JnlpConnectionState)@CheckForNull public IOException getCloseCause()
null if termination was normal.IllegalStateException - if invoked before
JnlpConnectionStateListener.channelClosed(JnlpConnectionState)public void ignore()
JnlpConnectionStateListener is not interested in this event any more. If all
JnlpConnectionStateListener implementations ignore() the event then the connection will be
rejected.IllegalStateException - if invoked outside of
JnlpConnectionStateListener.beforeProperties(JnlpConnectionState) or
JnlpConnectionStateListener.afterProperties(JnlpConnectionState).public void approve()
JnlpConnectionStateListener is declaring ownership of this event, approving
the connection and all other JnlpConnectionStateListener instances will now be ignored.
This method must be called by at least one JnlpConnectionStateListener or the connection will be
rejected.IllegalStateException - if invoked outside of
JnlpConnectionStateListener.beforeProperties(JnlpConnectionState) or
JnlpConnectionStateListener.afterProperties(JnlpConnectionState).public void reject(ConnectionRefusalException reason)
JnlpConnectionStateListener is declaring ownership of this event, rejecting
the connection and all other JnlpConnectionStateListener instances will now be ignored.IllegalStateException - if invoked outside of
JnlpConnectionStateListener.beforeProperties(JnlpConnectionState) or
JnlpConnectionStateListener.afterProperties(JnlpConnectionState).@CheckForNull public <S extends JnlpConnectionState.ListenerState> S getStash(Class<S> clazz)
S - the expected class of the stashed state.clazz - the expected class of the stashed state.IllegalStateException - if invoked before approve()setStash(ListenerState)public <S extends JnlpConnectionState.ListenerState> void setStash(@CheckForNull S stash)
S - the expected class of the stashed state.stash - the state to stash.IllegalStateException - if invoked before approve()getStash(Class)Copyright © 2004–2018. All rights reserved.