Platform SDK Java 8.5 API Reference

com.genesyslab.platform.clusterprotocol
Class AbstractClusterChannel<P extends ClientChannel>

java.lang.Object
  extended by com.genesyslab.platform.clusterprotocol.AbstractClusterChannel<P>
Type Parameters:
P - the base client protocol type.
All Implemented Interfaces:
AsyncChannel, Channel, ChannelListenerSupport, InputChannel, MessageReceiver, MessageReceiverManagement, OutputChannel, Receiver, ReceiverManagement, RequestChannel
Direct Known Subclasses:
ClusterProtocolImpl

public abstract class AbstractClusterChannel<P extends ClientChannel>
extends java.lang.Object
implements InputChannel, OutputChannel, RequestChannel, MessageReceiverManagement

Abstract Cluster Protocol channel methods.
It's a common functionality for all Cluster Protocols.


Nested Class Summary
protected  class AbstractClusterChannel.AsyncVisitor
           
protected  class AbstractClusterChannel.ChanelErrorVisitor
           
protected  class AbstractClusterChannel.ChannelClosedVisitor
           
protected  class AbstractClusterChannel.ChannelOpenVisitor
           
protected  class AbstractClusterChannel.IncomingMessageVisitor
           
protected  class AbstractClusterChannel.IntChannelListener
           
protected  class AbstractClusterChannel.InternalChannelCloseVisitor
           
protected  class AbstractClusterChannel.InternalChannelOpenVisitor
           
protected  class AbstractClusterChannel.IntMessageHandler
           
protected  class AbstractClusterChannel.IntOutputChannelListener
           
protected  class AbstractClusterChannel.IntWsHandler
           
protected  class AbstractClusterChannel.OutgoingMessageVisitor
           
 
Field Summary
protected  Endpoint endpoint
           
protected  java.util.concurrent.ThreadPoolExecutor execService
           
protected  int protocolId
           
 
Fields inherited from interface com.genesyslab.platform.commons.protocol.Receiver
DEF_INPUT_SIZE
 
Fields inherited from interface com.genesyslab.platform.commons.protocol.Channel
DEFAULT_TIMEOUT, INFINITE_TIMEOUT
 
Constructor Summary
protected AbstractClusterChannel()
           
 
Method Summary
 void addChannelListener(ChannelListener listener)
          Adds listener about connection lifecycle events.
 void addListener(OutputChannelListener listener)
          Attaches listener to OutputChannel implementer instance.
 void clearInput()
          Deprecated. 
 void close()
          Closes channel synchronously.
protected abstract  P createProtocol()
           
protected  void fireClosedEvent(ChannelClosedEvent event)
           
protected  void fireClosedInternalChannelEvent(ChannelClosedEvent event)
           
protected  void fireErrorEvent(ChannelErrorEvent event)
           
protected
<E extends java.lang.Throwable>
E
fireErrorEvent(E thrown)
           
protected  void fireOnMessageRecv(InputChannel channel, Message message)
           
protected  void fireOnMessageSend(OutputChannel channel, Message message)
           
protected  void fireOpenedEvent(java.util.EventObject event)
           
protected  void fireOpenedInternalChannelEvent(ChannelOpenedEvent event)
           
 boolean getCopyResponse()
          Is response to request() copied to receive queue.
 int getInputSize()
          Deprecated. 
 com.genesyslab.platform.commons.connection.interceptor.Interceptor getInterceptor()
          Returns singleton instance of default implementation.
 long getTimeout()
          Returns default timeout for synchronous operations on channel.
protected abstract  void onChannelDisconnected(com.genesyslab.platform.clusterprotocol.ProtocolNodeRec protocolItem, WSDisconnectedEvent event)
           
protected abstract  void onChannelFailure(com.genesyslab.platform.clusterprotocol.ProtocolNodeRec protocolItem, WSTriedUnsuccessfullyEvent event)
           
protected abstract  void onChannelOpened(com.genesyslab.platform.clusterprotocol.ProtocolNodeRec protocolItem, WSOpenedEvent event)
           
 void open()
          Initiates connections to the initialized set of cluster nodes.
Cluster Protocol will become Opened when at least one node is connected.
 Message receive()
          Deprecated. 
 Message receive(long timeout)
          Deprecated. 
 void releaseReceivers()
          Deprecated. 
 void removeChannelListener(ChannelListener listener)
          Removes listener about connection lifecycle events.
 void removeListener(OutputChannelListener listener)
          Detaches listener from OutputChannel implementer instance.
 void resetReceiver()
          Deprecated. 
 void setCopyResponse(boolean copyResponse)
          Is response to request() copied to receive queue.
 void setInputSize(int inputSize)
          Deprecated. 
 void setMessageHandler(MessageHandler msgHandler)
          Sets asynchronous handler for incoming messages.
 void setReceiver(MessageReceiverSupport receiver)
          Deprecated. 
 void setTimeout(long timeout)
          Sets default timeout for synchronous operations on channel.
protected  void setupProtocolNode(com.genesyslab.platform.clusterprotocol.ProtocolNodeRec protocolItem)
           
protected  void throwNotClosed()
           
protected  void throwNotOpened()
           
protected  void throwNull(java.lang.Object obj, java.lang.String name)
           
protected  void throwOnClosed()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.genesyslab.platform.commons.protocol.OutputChannel
send
 
Methods inherited from interface com.genesyslab.platform.commons.protocol.RequestChannel
beginRequest, endRequest, endRequest, request, request, requestAsync, requestAsync
 
Methods inherited from interface com.genesyslab.platform.commons.protocol.Channel
close, open
 
Methods inherited from interface com.genesyslab.platform.commons.protocol.AsyncChannel
beginClose, beginOpen, getState
 

Field Detail

endpoint

protected Endpoint endpoint

execService

protected java.util.concurrent.ThreadPoolExecutor execService

protocolId

protected final int protocolId
Constructor Detail

AbstractClusterChannel

protected AbstractClusterChannel()
Method Detail

setTimeout

public void setTimeout(long timeout)
Description copied from interface: Channel
Sets default timeout for synchronous operations on channel. Please see class description for timeout values meaning.

Specified by:
setTimeout in interface Channel
Parameters:
timeout - timeout in milliseconds

getTimeout

public long getTimeout()
Description copied from interface: Channel
Returns default timeout for synchronous operations on channel. Please see class description for timeout values meaning.

Specified by:
getTimeout in interface Channel
Returns:
timeout

setMessageHandler

public void setMessageHandler(MessageHandler msgHandler)
Description copied from interface: InputChannel
Sets asynchronous handler for incoming messages.

Specified by:
setMessageHandler in interface InputChannel
Parameters:
msgHandler - incoming messages handler

getCopyResponse

public boolean getCopyResponse()
Description copied from interface: RequestChannel
Is response to request() copied to receive queue.

Specified by:
getCopyResponse in interface RequestChannel
Returns:
true if response goes to receive queue

setCopyResponse

public void setCopyResponse(boolean copyResponse)
Description copied from interface: RequestChannel
Is response to request() copied to receive queue.

Specified by:
setCopyResponse in interface RequestChannel
Parameters:
copyResponse - true if response goes to receive queue

createProtocol

protected abstract P createProtocol()

setupProtocolNode

protected void setupProtocolNode(com.genesyslab.platform.clusterprotocol.ProtocolNodeRec protocolItem)

open

public void open()
          throws RegistrationException,
                 ProtocolException,
                 java.lang.IllegalStateException,
                 java.lang.InterruptedException
Initiates connections to the initialized set of cluster nodes.
Cluster Protocol will become Opened when at least one node is connected.

Specified by:
open in interface Channel
Throws:
java.lang.IllegalStateException - if protocol is not Closed, or it has no set nodes configurations or Endpoint's.
ProtocolTimeoutException - if cluster protocol got no notification about node connection in the protocol timeout frame. Note: it does not fail the open request, protocol is Opening and WarmStandby services continue to run re-connections.
RegistrationException - if there is an error related to registration procedure like server error about wrong client name, user password, etc
ProtocolException - if there is any problem related to the connection open
java.lang.InterruptedException
See Also:
Channel.setTimeout(long), Channel.open(long)

close

public void close()
           throws ProtocolException,
                  java.lang.IllegalStateException,
                  java.lang.InterruptedException
Description copied from interface: Channel
Closes channel synchronously.

Specified by:
close in interface Channel
Throws:
ProtocolException - if there is any problem related to the connection close
java.lang.IllegalStateException - exception will not be thrown in current implementation.
java.lang.InterruptedException - in case the close operation was interrupted.

addChannelListener

public void addChannelListener(ChannelListener listener)
Description copied from interface: ChannelListenerSupport
Adds listener about connection lifecycle events.

Specified by:
addChannelListener in interface ChannelListenerSupport
Parameters:
listener - listener

removeChannelListener

public void removeChannelListener(ChannelListener listener)
Description copied from interface: ChannelListenerSupport
Removes listener about connection lifecycle events.

Specified by:
removeChannelListener in interface ChannelListenerSupport
Parameters:
listener - listener

addListener

public void addListener(OutputChannelListener listener)
Description copied from interface: OutputChannel
Attaches listener to OutputChannel implementer instance. Checks for duplication, will not add the same listener twice

Specified by:
addListener in interface OutputChannel
Parameters:
listener - listener to be attached.

removeListener

public void removeListener(OutputChannelListener listener)
Description copied from interface: OutputChannel
Detaches listener from OutputChannel implementer instance. Does nothing if listener was not attached before.

Specified by:
removeListener in interface OutputChannel
Parameters:
listener - listener to be detached.

receive

@Deprecated
public Message receive()
                throws java.lang.InterruptedException,
                       java.lang.IllegalStateException
Deprecated. 

This deprecated method returns null.

Specified by:
receive in interface MessageReceiver
Returns:
Message from the channel or null if the channel is "empty"
Throws:
java.lang.InterruptedException - if thread is interrupted during this method execution
java.lang.IllegalStateException - if channel is not in appropriate state to call the method
See Also:
MessageHandler, DuplexChannel.setMessageHandler(MessageHandler)

receive

@Deprecated
public Message receive(long timeout)
                throws java.lang.InterruptedException,
                       java.lang.IllegalStateException
Deprecated. 

This deprecated method returns null.

Specified by:
receive in interface MessageReceiver
Parameters:
timeout - timeout to waitResponse for message
Returns:
Message from the channel or null if the channel is "empty"
Throws:
java.lang.InterruptedException - if thread is interrupted during this method execution
java.lang.IllegalStateException - if channel is not in appropriate state to call the method
See Also:
MessageHandler, DuplexChannel.setMessageHandler(MessageHandler)

clearInput

@Deprecated
public void clearInput()
Deprecated. 

This deprecated method does nothing.

Specified by:
clearInput in interface Receiver

getInputSize

@Deprecated
public int getInputSize()
Deprecated. 

This deprecated method returns zero.

Specified by:
getInputSize in interface Receiver
Returns:
maximum count of messages stored in receiver

setInputSize

@Deprecated
public void setInputSize(int inputSize)
Deprecated. 

This deprecated method does nothing.

Specified by:
setInputSize in interface Receiver
Parameters:
inputSize - maximum count of messages stored in receiver

releaseReceivers

@Deprecated
public void releaseReceivers()
Deprecated. 

This deprecated method does nothing.

Specified by:
releaseReceivers in interface Receiver

onChannelOpened

protected abstract void onChannelOpened(com.genesyslab.platform.clusterprotocol.ProtocolNodeRec protocolItem,
                                        WSOpenedEvent event)

fireOpenedEvent

protected void fireOpenedEvent(java.util.EventObject event)

fireOpenedInternalChannelEvent

protected void fireOpenedInternalChannelEvent(ChannelOpenedEvent event)

fireClosedInternalChannelEvent

protected void fireClosedInternalChannelEvent(ChannelClosedEvent event)

onChannelDisconnected

protected abstract void onChannelDisconnected(com.genesyslab.platform.clusterprotocol.ProtocolNodeRec protocolItem,
                                              WSDisconnectedEvent event)

fireClosedEvent

protected void fireClosedEvent(ChannelClosedEvent event)

onChannelFailure

protected abstract void onChannelFailure(com.genesyslab.platform.clusterprotocol.ProtocolNodeRec protocolItem,
                                         WSTriedUnsuccessfullyEvent event)

fireOnMessageRecv

protected void fireOnMessageRecv(InputChannel channel,
                                 Message message)

fireOnMessageSend

protected void fireOnMessageSend(OutputChannel channel,
                                 Message message)

fireErrorEvent

protected <E extends java.lang.Throwable> E fireErrorEvent(E thrown)

fireErrorEvent

protected void fireErrorEvent(ChannelErrorEvent event)

getInterceptor

public com.genesyslab.platform.commons.connection.interceptor.Interceptor getInterceptor()
Returns singleton instance of default implementation.


setReceiver

@Deprecated
public void setReceiver(MessageReceiverSupport receiver)
Deprecated. 

This deprecated method throws UnsupportedOperationException.

Specified by:
setReceiver in interface MessageReceiverManagement

resetReceiver

@Deprecated
public void resetReceiver()
Deprecated. 

This deprecated method does nothing.

Specified by:
resetReceiver in interface ReceiverManagement

throwNull

protected void throwNull(java.lang.Object obj,
                         java.lang.String name)

throwNotClosed

protected void throwNotClosed()
                       throws ChannelNotClosedException
Throws:
ChannelNotClosedException

throwNotOpened

protected void throwNotOpened()
                       throws ChannelNotOpenedException
Throws:
ChannelNotOpenedException

throwOnClosed

protected void throwOnClosed()
                      throws ChannelNotOpenedException
Throws:
ChannelNotOpenedException

Platform SDK Java 8.5 API Reference

Send comments on this topicTechpubs.webadmin@genesys.com.
Document version: 8.5.302.00
Copyright © 2006–2017 Genesys Telecommunications Laboratories, Inc. All rights reserved.