Platform SDK Java 8.5 API Reference

com.genesyslab.platform.commons.protocol
Class AbstractQueueReceiver<T>

java.lang.Object
  extended by com.genesyslab.platform.commons.protocol.AbstractQueueReceiver<T>
All Implemented Interfaces:
ChannelListener, Listener, Receiver, ReceiverSupport
Direct Known Subclasses:
QueueMessageReceiver, QueueRequestReceiver

public abstract class AbstractQueueReceiver<T>
extends java.lang.Object
implements ReceiverSupport


Field Summary
 
Fields inherited from interface com.genesyslab.platform.commons.protocol.Receiver
DEF_INPUT_SIZE
 
Constructor Summary
protected AbstractQueueReceiver(int queueSize, T fake)
           
protected AbstractQueueReceiver(int queueSize, T fake, boolean growQueue)
           
protected AbstractQueueReceiver(java.util.concurrent.LinkedBlockingQueue<T> queue, T fake)
           
 
Method Summary
 void clearInput()
          Clears input of the receiver.
 long getEnqueTimeout()
           
protected abstract  java.lang.Object getFake()
           
 int getInputSize()
          Returns the amount of messages this Receiver can hold before start to "forget stale messages".
 int getMaxInputSize()
           
protected  com.genesyslab.platform.commons.protocol.runtime.channel.QueueSupport<T> getQueueSupport()
           
 void onChannelClosed(ChannelClosedEvent event)
          onChannelClosed is called when the channel closed by any reason.
 void onChannelError(ChannelErrorEvent event)
          onChannelError is called when some not critical channel error occurs.
 void onChannelOpened(java.util.EventObject event)
          onChannelOpened is called when the channel opening will be completed successfully.
 void processMessage(T message)
           
 T receive()
           
 T receive(long timeout)
           
 void releaseReceivers()
          Notifies receivers (threads waiting on receive() methods) they should stop waiting and return null.
 void setEnqueTimeout(long enqueTimeout)
          Using timeout can slow down the processing of messages from server.
 void setInputSize(int inputSize)
          Sets the amount of messages this Receiver can hold before start to "forget stale messages".
 void setMaxInputSize(int maxInputSize)
          Maximum capacity the queue can grow to if such growing is enabled.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractQueueReceiver

protected AbstractQueueReceiver(int queueSize,
                                T fake,
                                boolean growQueue)

AbstractQueueReceiver

protected AbstractQueueReceiver(int queueSize,
                                T fake)

AbstractQueueReceiver

protected AbstractQueueReceiver(java.util.concurrent.LinkedBlockingQueue<T> queue,
                                T fake)
Method Detail

getEnqueTimeout

public long getEnqueTimeout()

setEnqueTimeout

public void setEnqueTimeout(long enqueTimeout)
Using timeout can slow down the processing of messages from server. Using this property is advanced topic, use it only if you know what kind of effect it can cause to the internals of connection layer. It will be usually used in advanced scenarios with ConnectionInvoker.

Parameters:
enqueTimeout - enqueue timeout

getInputSize

public int getInputSize()
Description copied from interface: Receiver
Returns the amount of messages this Receiver can hold before start to "forget stale messages".

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

setInputSize

public void setInputSize(int inputSize)
Description copied from interface: Receiver
Sets the amount of messages this Receiver can hold before start to "forget stale messages".

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

getMaxInputSize

public int getMaxInputSize()

setMaxInputSize

public void setMaxInputSize(int maxInputSize)
Maximum capacity the queue can grow to if such growing is enabled.

Parameters:
maxInputSize - max capacity

clearInput

public void clearInput()
Description copied from interface: Receiver
Clears input of the receiver. Please note, that there is no strict guaranties that input will be empty after this method has returned, the messages could be delivered by another thread.

Specified by:
clearInput in interface Receiver

onChannelOpened

public void onChannelOpened(java.util.EventObject event)
Description copied from interface: ChannelListener
onChannelOpened is called when the channel opening will be completed successfully.

Specified by:
onChannelOpened in interface ChannelListener
Parameters:
event - details.

onChannelClosed

public void onChannelClosed(ChannelClosedEvent event)
Description copied from interface: ChannelListener
onChannelClosed is called when the channel closed by any reason.

Specified by:
onChannelClosed in interface ChannelListener
Parameters:
event - details. See event.getCause() to analize the source reason.

onChannelError

public void onChannelError(ChannelErrorEvent event)
Description copied from interface: ChannelListener
onChannelError is called when some not critical channel error occurs. (like unknown attribute in message occurs)

Specified by:
onChannelError in interface ChannelListener
Parameters:
event - details. See event.getCause() to analize the problem source.

releaseReceivers

public void releaseReceivers()
Description copied from interface: Receiver
Notifies receivers (threads waiting on receive() methods) they should stop waiting and return null.

Specified by:
releaseReceivers in interface Receiver

getQueueSupport

protected com.genesyslab.platform.commons.protocol.runtime.channel.QueueSupport<T> getQueueSupport()

receive

public T receive()
          throws java.lang.InterruptedException,
                 java.lang.IllegalStateException
Throws:
java.lang.InterruptedException
java.lang.IllegalStateException

receive

public T receive(long timeout)
          throws java.lang.InterruptedException,
                 java.lang.IllegalStateException
Throws:
java.lang.InterruptedException
java.lang.IllegalStateException

processMessage

public void processMessage(T message)

getFake

protected abstract java.lang.Object getFake()

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.