|
Platform SDK Java 8.5 API Reference | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.genesyslab.platform.clusterprotocol.AbstractClusterChannel<P>
P
- the base client protocol type.public abstract class AbstractClusterChannel<P extends ClientChannel>
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
|
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 |
---|
protected Endpoint endpoint
protected java.util.concurrent.ThreadPoolExecutor execService
protected final int protocolId
Constructor Detail |
---|
protected AbstractClusterChannel()
Method Detail |
---|
public void setTimeout(long timeout)
Channel
setTimeout
in interface Channel
timeout
- timeout in millisecondspublic long getTimeout()
Channel
getTimeout
in interface Channel
public void setMessageHandler(MessageHandler msgHandler)
InputChannel
setMessageHandler
in interface InputChannel
msgHandler
- incoming messages handlerpublic boolean getCopyResponse()
RequestChannel
request()
copied to receive queue.
getCopyResponse
in interface RequestChannel
public void setCopyResponse(boolean copyResponse)
RequestChannel
request()
copied to receive queue.
setCopyResponse
in interface RequestChannel
copyResponse
- true if response goes to receive queueprotected abstract P createProtocol()
protected void setupProtocolNode(com.genesyslab.platform.clusterprotocol.ProtocolNodeRec protocolItem)
public void open() throws RegistrationException, ProtocolException, java.lang.IllegalStateException, java.lang.InterruptedException
Opened
when at least one node is connected.
open
in interface Channel
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
Channel.setTimeout(long)
,
Channel.open(long)
public void close() throws ProtocolException, java.lang.IllegalStateException, java.lang.InterruptedException
Channel
close
in interface Channel
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.public void addChannelListener(ChannelListener listener)
ChannelListenerSupport
addChannelListener
in interface ChannelListenerSupport
listener
- listenerpublic void removeChannelListener(ChannelListener listener)
ChannelListenerSupport
removeChannelListener
in interface ChannelListenerSupport
listener
- listenerpublic 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.@Deprecated public Message receive() throws java.lang.InterruptedException, java.lang.IllegalStateException
null
.
receive
in interface MessageReceiver
java.lang.InterruptedException
- if thread is interrupted during this method
execution
java.lang.IllegalStateException
- if channel is not in appropriate state
to call the methodMessageHandler
,
DuplexChannel.setMessageHandler(MessageHandler)
@Deprecated public Message receive(long timeout) throws java.lang.InterruptedException, java.lang.IllegalStateException
null
.
receive
in interface MessageReceiver
timeout
- timeout to waitResponse for message
java.lang.InterruptedException
- if thread is interrupted during this method
execution
java.lang.IllegalStateException
- if channel is not in appropriate state
to call the methodMessageHandler
,
DuplexChannel.setMessageHandler(MessageHandler)
@Deprecated public void clearInput()
clearInput
in interface Receiver
@Deprecated public int getInputSize()
getInputSize
in interface Receiver
@Deprecated public void setInputSize(int inputSize)
setInputSize
in interface Receiver
inputSize
- maximum count of messages stored in receiver@Deprecated public void releaseReceivers()
releaseReceivers
in interface Receiver
protected abstract void onChannelOpened(com.genesyslab.platform.clusterprotocol.ProtocolNodeRec protocolItem, WSOpenedEvent event)
protected void fireOpenedEvent(java.util.EventObject event)
protected void fireOpenedInternalChannelEvent(ChannelOpenedEvent event)
protected void fireClosedInternalChannelEvent(ChannelClosedEvent event)
protected abstract void onChannelDisconnected(com.genesyslab.platform.clusterprotocol.ProtocolNodeRec protocolItem, WSDisconnectedEvent event)
protected void fireClosedEvent(ChannelClosedEvent event)
protected abstract void onChannelFailure(com.genesyslab.platform.clusterprotocol.ProtocolNodeRec protocolItem, WSTriedUnsuccessfullyEvent event)
protected void fireOnMessageRecv(InputChannel channel, Message message)
protected void fireOnMessageSend(OutputChannel channel, Message message)
protected <E extends java.lang.Throwable> E fireErrorEvent(E thrown)
protected void fireErrorEvent(ChannelErrorEvent event)
public com.genesyslab.platform.commons.connection.interceptor.Interceptor getInterceptor()
@Deprecated public void setReceiver(MessageReceiverSupport receiver)
UnsupportedOperationException
.
setReceiver
in interface MessageReceiverManagement
@Deprecated public void resetReceiver()
resetReceiver
in interface ReceiverManagement
protected void throwNull(java.lang.Object obj, java.lang.String name)
protected void throwNotClosed() throws ChannelNotClosedException
ChannelNotClosedException
protected void throwNotOpened() throws ChannelNotOpenedException
ChannelNotOpenedException
protected void throwOnClosed() throws ChannelNotOpenedException
ChannelNotOpenedException
|
Platform SDK Java 8.5 API Reference | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |