AsyncChannel
, AsyncInvokerSupport
, Channel
, ChannelListenerSupport
, ConfigurationSupport
, ConnectionInvokerSupport
, EndpointSupport
, OutputChannel
, ProtocolDescriptionSupport
, Receiver
, ReceiverManagement
, RequestReceiver
, RequestReceiverManagement
, ResponseChannel
CallbackProtocolListener
, ChatProtocolsListener
, ConfServerProtocolListener
, EmailProtocolListener
, EspEmailProtocolListener
, ExternalServiceProtocolListener
, InteractionServerProtocolListener
, UniversalContactServerProtocolListener
, UrsCustomProtocolListener
public class ServerChannel extends AbstractChannel implements OutputChannel, ResponseChannel, RequestReceiver, EndpointSupport, ConfigurationSupport, ProtocolDescriptionSupport, RequestReceiverManagement
Endpoint
.AbstractChannel.addChannelListener(ChannelListener)
accepts ServerChannelListener
,
which provides notifications on incoming clients.
When a new client connection is established
onClientChannelOpened()
method is notified.ADDP
support
for incoming connections.
The AddpInterceptor.ACTIVE_KEY
option is always set to false
,
because ADDP
is to be initialized by client side.
Specific protocols may extend this class adding own customization and specifications.AbstractChannel.AsyncErrorNotifier
DEFAULT_TIMEOUT, INFINITE_TIMEOUT
DEF_INPUT_SIZE
Constructor | Description |
---|---|
ServerChannel(Endpoint endpoint,
long timeout,
ProtocolFactory protocolFactory) |
The old style constructor for
ServerChannel instance creation. |
ServerChannel(Endpoint endpoint,
ClientChannelHandlerFactory clientChannelHandlerFactory) |
Creates
ServerChannel instance to accept and handle incoming clients connections
on the given Endpoint . |
ServerChannel(Endpoint endpoint,
ProtocolFactory protocolFactory) |
The old style constructor for
ServerChannel instance creation. |
ServerChannel(Endpoint endpoint,
java.lang.Class<T> clientChannelClass) |
Deprecated.
|
Modifier and Type | Method | Description |
---|---|---|
void |
addListener(OutputChannelListener listener) |
Attaches listener to OutputChannel implementer instance.
|
protected void |
applyConfiguration() |
|
void |
beginClose() |
Method is asynchronous.
|
void |
beginOpen() |
Method is asynchronous.
|
void |
clearInput() |
Clears input of the receiver.
|
void |
close() |
Closes listening socket and all its active clients connections.
|
void |
close(long timeout) |
Closes listening socket and all its active clients connections.
|
void |
closeClientChannels() |
Closes all connected client's channels, but the server socket remains in listening mode.
|
void |
closeListener() |
Closes listening socket only, sets channel state to Closed.
|
java.util.Collection<? extends Channel> |
getChannels() |
|
int |
getInputSize() |
Returns the amount of messages this Receiver can hold before
start to "forget stale messages".
|
java.net.InetSocketAddress |
getLocalEndPoint() |
Gets local address of the listening socket.
|
ProtocolDescription |
getProtocolDescription() |
|
protected ProtocolFactory |
getProtocolFactory() |
|
protected void |
modifyNewChannel(DuplexChannel channel) |
This method modifies the new channel to support server mode
of operation suggested by ServerChannel.
|
void |
open() |
Opens channel synchronously.
|
void |
open(long timeout) |
Opens channel synchronously.
|
Message |
receive() |
|
Message |
receive(long timeout) |
|
RequestContext |
receiveRequest() |
Receives request from the client.
|
RequestContext |
receiveRequest(long timeout) |
Receives request from the client.
|
void |
releaseReceivers() |
Notifies receivers (threads waiting on receive() methods) they should
stop waiting and return null.
|
void |
removeListener(OutputChannelListener listener) |
Detaches listener from OutputChannel implementer instance.
|
void |
resetReceiver() |
Resets the clients requests receiver.
|
void |
send(Message message) |
Sends the given protocol message to all connected clients channels of this
ServerChannel . |
void |
sendToChannelsExcept(Message message,
OutputChannel except) |
Sends message to all channels except the one.
|
protected void |
sendToChannelsExcept(java.util.Collection<OutputChannel> channels,
Message message,
OutputChannel except) |
Sends message to all channels in the collection except the one.
|
void |
setClientRequestHandler(ClientRequestHandler handler) |
ServerChannel calls the handler on each new incoming message.While the handler is assigned the receiver (external or internal) is ignored. |
void |
setInputSize(int inputSize) |
Sets the amount of messages this Receiver can hold before
start to "forget stale messages".
|
void |
setReceiver(RequestReceiverSupport receiver) |
Deprecated.
|
addChannelListener, configure, connectionContext, copyTLSSettings, createChannelClosedEvent, fireClosed, fireErrorEvent, fireErrorEvent, generateChannelId, getChannelId, getConfiguration, getDefaultInvoker, getEndpoint, getEnpointPrefixInfo, getInvoker, getListenerHelper, getLocalEndpointInfo, getServerContext, getState, getStateMods, getTimeout, getTimer, internal, onFireClosed, onFireErrorEvent, onFireOpened, onSetEndpoint, releaseDefaultInvoker, removeChannelListener, setConfiguration, setConnectionInvoker, setEndpoint, setInvoker, setServerContext, setState, setState, setTimeout, throwNotClosed, throwNotOpened, throwNotOpenedOnClose, throwNotOpenedOnSend, throwNull, throwNullEndpoint
getState
getTimeout, setTimeout
addChannelListener, removeChannelListener
configure, getConfiguration
getEndpoint, setEndpoint
public ServerChannel(Endpoint endpoint, ProtocolFactory protocolFactory)
ServerChannel
instance creation.endpoint
- the local Endpoint to accept connections on.protocolFactory
- the specific protocol factory.ServerChannel(Endpoint, ClientChannelHandlerFactory)
public ServerChannel(Endpoint endpoint, ClientChannelHandlerFactory clientChannelHandlerFactory)
ServerChannel
instance to accept and handle incoming clients connections
on the given Endpoint
.endpoint
- the local Endpoint to accept connections on.clientChannelHandlerFactory
- the factory of handlers for clients connections.@Deprecated public ServerChannel(Endpoint endpoint, java.lang.Class<T> clientChannelClass)
public ServerChannel(Endpoint endpoint, long timeout, ProtocolFactory protocolFactory)
ServerChannel
instance creation.endpoint
- the local Endpoint to accept connections on.timeout
- the protocol timeout value for the server channel.protocolFactory
- the specific protocol factory.ServerChannel(Endpoint, ClientChannelHandlerFactory)
public java.net.InetSocketAddress getLocalEndPoint()
public void open() throws ProtocolException, java.lang.InterruptedException, ChannelNotClosedException
open
in interface Channel
ChannelNotClosedException
- when channel isn't closedRegistrationException
- if there is an error related to registration procedure
like server error about wrong client name, user password, etcProtocolException
- if there is any problem related to the connection openjava.lang.InterruptedException
Channel.setTimeout(long)
,
Channel.open(long)
public void open(long timeout) throws ProtocolException, java.lang.InterruptedException, ChannelNotClosedException
open
in interface Channel
timeout
- timeout in millisecondsChannelNotClosedException
- when channel isn't closedRegistrationException
- if there is an error related to registration procedure
like server error about wrong client name, user password, etcProtocolException
- if there is any problem related to the connection openjava.lang.InterruptedException
Channel.open()
public void close() throws ProtocolException, java.lang.InterruptedException, java.lang.IllegalStateException
close
in interface Channel
ProtocolException
- exception will not be thrown in current implementation.java.lang.InterruptedException
- in case the close operation was interrupted.java.lang.IllegalStateException
- exception will not be thrown in current implementation.public void close(long timeout) throws ProtocolException, java.lang.InterruptedException, java.lang.IllegalStateException
close
in interface Channel
timeout
- currently not used.ProtocolException
- exception will not be thrown in current implementation.java.lang.InterruptedException
- in case the close operation was interrupted.java.lang.IllegalStateException
- exception will not be thrown in current implementation.public void closeListener() throws ProtocolException, java.lang.InterruptedException, java.lang.IllegalStateException
close()
to close it all,
or closeClientChannels()
to close clients connections separately.ProtocolException
- exception will not be thrown in current implementation.java.lang.InterruptedException
- in case the close operation was interrupted.java.lang.IllegalStateException
- exception will not be thrown in current implementation.public void closeClientChannels() throws java.lang.InterruptedException
java.lang.InterruptedException
- in case the close operation was interrupted.public void send(Message message) throws ProtocolException
ServerChannel
.send
in interface OutputChannel
message
- Message to sendProtocolException
- if there is some problems with message structurepublic void addListener(OutputChannelListener listener)
OutputChannel
addListener
in interface OutputChannel
listener
- listener to be attached.public void removeListener(OutputChannelListener listener)
OutputChannel
removeListener
in interface OutputChannel
listener
- listener to be detached.public void sendToChannelsExcept(Message message, OutputChannel except) throws ProtocolException
message
- Message to sendexcept
- channel to miss from sendingProtocolException
- In the case of an unrecoverable protocol error. Client applications should not
try to deal with these exceptions, except for logging or displaying to users or technical administrators.
Check the exception cause for more details.public void beginOpen() throws ProtocolException
AsyncChannel
beginOpen
in interface AsyncChannel
ProtocolException
- in case of problems establishing connectionpublic void beginClose()
AsyncChannel
beginClose
in interface AsyncChannel
public RequestContext receiveRequest() throws java.lang.InterruptedException
RequestReceiver
receiveRequest
in interface RequestReceiver
receiveRequest
in interface ResponseChannel
java.lang.InterruptedException
- if thread is interrupted during this method
executionpublic RequestContext receiveRequest(long timeout) throws java.lang.InterruptedException
Channel
description for timeout values meaning.receiveRequest
in interface RequestReceiver
receiveRequest
in interface ResponseChannel
timeout
- timeout to waitResponse for messagejava.lang.InterruptedException
- if thread is interrupted during this method
executionChannelNotOpenedException
- if channel is not in appropriate state
to call the methodChannelReceiverInitializationException
- if external receiver or client request handler is set.public java.util.Collection<? extends Channel> getChannels()
protected ProtocolFactory getProtocolFactory()
protected void modifyNewChannel(DuplexChannel channel)
channel
- incoming (accepted) channelprotected void sendToChannelsExcept(java.util.Collection<OutputChannel> channels, Message message, OutputChannel except) throws ProtocolException
channels
- list of channels to sendmessage
- Message to sendexcept
- channel to miss from sending or null if no channel
should be missedProtocolException
- In the case of an unrecoverable protocol error. Client applications should not
try to deal with these exceptions, except for logging or displaying to users or technical administrators.
Check the exception cause for more details.public ProtocolDescription getProtocolDescription()
getProtocolDescription
in interface ProtocolDescriptionSupport
public Message receive() throws java.lang.InterruptedException, java.lang.IllegalStateException
java.lang.InterruptedException
java.lang.IllegalStateException
public Message receive(long timeout) throws java.lang.InterruptedException, java.lang.IllegalStateException
java.lang.InterruptedException
java.lang.IllegalStateException
public void clearInput()
Receiver
clearInput
in interface Receiver
public int getInputSize()
Receiver
getInputSize
in interface Receiver
public void setInputSize(int inputSize)
setClientRequestHandler(ClientRequestHandler)
) or external receiver
(setReceiver(RequestReceiverSupport)
) is in use.setInputSize
in interface Receiver
inputSize
- maximum count of messages stored in receiverpublic void releaseReceivers()
setClientRequestHandler(ClientRequestHandler)
) or external receiver
(setReceiver(RequestReceiverSupport)
) is in use.releaseReceivers
in interface Receiver
protected void applyConfiguration()
applyConfiguration
in class AbstractChannel
public void setClientRequestHandler(ClientRequestHandler handler)
ServerChannel
calls the handler on each new incoming message.handler
- the handler for client requests procession.@Deprecated public void setReceiver(RequestReceiverSupport receiver)
setReceiver
in interface RequestReceiverManagement
receiver
- the receiver of client request messages.ChannelNotClosedException
- if the channel isn't closed.setClientRequestHandler(ClientRequestHandler)
public void resetReceiver()
resetReceiver
in interface ReceiverManagement
ChannelNotClosedException
- when channel isn't closedSend comments on this topicTechpubs.webadmin@genesys.com.
Document version: 9.0.006.00
Copyright © 2006–2019 Genesys Telecommunications Laboratories, Inc. All rights reserved.