public interface ChannelNameResolver
Resolves channel names to network locations. These network locations can then be used to establish connections with the respective channels.
An implementation of this interface should ensure that the methods defined by this interface are thread safe and thus can be called by any thread.
Modifier and Type | Interface and Description |
---|---|
static interface |
ChannelNameResolver.ChannelNameSearchResultProcessor
Processes the result of a channel name lookup.
|
Modifier and Type | Method and Description |
---|---|
void |
cancelChannelName(int cid)
Cancels the search for a channel.
|
void |
resolveChannelName(java.lang.String channelName,
int cid,
ChannelNameResolver.ChannelNameSearchResultProcessor resultProcessor)
Tries to resolve a channel name.
|
void |
resolveChannelName(java.lang.String channelName,
int cid,
ChannelNameResolver.ChannelNameSearchResultProcessor resultProcessor,
long initialDelay)
Tries to resolve a channel name.
|
void resolveChannelName(java.lang.String channelName, int cid, ChannelNameResolver.ChannelNameSearchResultProcessor resultProcessor)
resultProcessor
is called. When the search for the
channel fails with an exception, the exceptionProcessor
is
called. If the channel can simply not be resolved, no call-back is called
and the resolver simply continues with trying to resolve the channel
name.channelName
- name of the channel that shall be resolved (never
null
).cid
- client-assigned numeric identifier for the channel. This
identifier is used as a key in various places and thus must be
unique. Using the same identifier for multiple search requests
is an error and will result in unpredictable behavior. If the
search for a channel has succeeded of failed finally (one of
the two call-backs has been called), the CID can be reused.
However, it is recommended not to reuse the CID for a certain
amount of time because otherwise late replies for the
preceding search requests might be misinterpreted as replies
to the new search requests.resultProcessor
- processor that is called when the search for the channel
succeeds (never null
).java.lang.IllegalStateException
- if the channel name resolver has been destroyed.SerializedChannelNameTooLargeException
- if the channel name is too large to be serialized. This can
happen because the serialized form of the channel name
exceeds the general limit defined by
ChannelAccessConstants.MAX_CHANNEL_NAME_BYTES_LENGTH
or because it is too long too fit into a single UDP packet.void resolveChannelName(java.lang.String channelName, int cid, ChannelNameResolver.ChannelNameSearchResultProcessor resultProcessor, long initialDelay)
resultProcessor
is called. When the search for the
channel fails with an exception, the exceptionProcessor
is
called. If the channel can simply not be resolved, no call-back is called
and the resolver simply continues with trying to resolve the channel
name.channelName
- name of the channel that shall be resolved (never
null
).cid
- client-assigned numeric identifier for the channel. This
identifier is used as a key in various places and thus must be
unique. Using the same identifier for multiple search requests
is an error and will result in unpredictable behavior. If the
search for a channel has succeeded of failed finally (one of
the two call-backs has been called), the CID can be reused.
However, it is recommended not to reuse the CID for a certain
amount of time because otherwise late replies for the
preceding search requests might be misinterpreted as replies
to the new search requests.resultProcessor
- processor that is called when the search for the channel
succeeds (never null
).initialDelay
- if greater than zero, the start of the search is delayed by
the specified number of milliseconds. Otherwise, the search is
started as soon as possible.java.lang.IllegalStateException
- if the channel name resolver has been destroyed.SerializedChannelNameTooLargeException
- if the channel name is too large to be serialized. This can
happen because the serialized form of the channel name
exceeds the general limit defined by
ChannelAccessConstants.MAX_CHANNEL_NAME_BYTES_LENGTH
or because it is too long too fit into a single UDP packet.void cancelChannelName(int cid)
ChannelNameResolver.ChannelNameSearchResultProcessor
that has been registered for the
specified channel might still be called after calling this method. If no
search request has been queued for the specified channel, the search has
already succeeded, or the search request has already been cancelled,
calling this method has no effect.cid
- client-assigned numeric identified for the channel that was
specified when queuing the search request (never
null
).Copyright © 2014–2019 aquenos GmbH. All rights reserved.