com.neeve.sma.impl.loopback
Class LoopbackBus

java.lang.Object
  extended by com.neeve.root.RootObject
      extended by com.neeve.sma.SmaObject
          extended by com.neeve.sma.impl.loopback.LoopbackBus

public final class LoopbackBus
extends SmaObject

The loopback bus implementation.


Nested Class Summary
 class LoopbackBus.Agent
          Represents a messaging agent
 class LoopbackBus.AgentParameters
          Contains an agent's operating parameters
static class LoopbackBus.AgentQueueWaitStrategy
          Enumerates a agent's queue wait strategy
 class LoopbackBus.AgentTestController
          Implements an agent's test controller.
 class LoopbackBus.TestController
          Implements an agent's test controller.
 
Method Summary
 boolean agentHasSubscriptions(String name)
          Return if an agent has active subscriptions
static void clearAllInstances()
          Clear all loopback bus instances
 void clearMessageDiscard()
          Clear the discard message setting
 void discardMessages()
          Set the bus to discard all inbound messages
 void dumpActivityTrackingInfo()
          If Activity Tracking has been enabled for, will dump the current Activity Tracking History for this bus.
 void dumpPendingAck(StringBuilder builder)
          Dumps diagnostic information about guaranteed messages pending acknowledgement to the provide StringBuilder
 void enableWaitForQuiescence(boolean val)
          Enable a loopback bus's 'wait for quiescence" feature
 LoopbackBus.Agent getAgent(String name)
          Get a connected agent
 LoopbackBus.AgentParameters getAgentParameters(String name)
          Get an agent's operating parameters
 LoopbackBus.AgentTestController getAgentTestController(String name)
          Get an agent's test controller.
static LoopbackBus getInstance()
          Return the default loopback bus instance
static LoopbackBus getInstance(String name)
          Return a named loopback bus instance.
 LoopbackBus.TestController getTestController()
          Returns the overal
 boolean isAgentConnected(String name)
          Check if an agent is connected to the bus
 LoopbackBus reset()
          Reset a loopback bus.
 boolean waitForPendingAcks(long timeout)
          Waits for acknowledgements for guaranteed messages sent through this bus.
 boolean waitForPendingAcks(long timeout, TimeUnit timeUnit)
          Equivalent to calling waitForPendingAcks(long, TimeUnit) with TimeUnit.MILLISECONDS
 void waitForQuiescence()
          Wait for quiescence with no timeout.
 boolean waitForQuiescence(long timeout)
          Wait for quiescence for a specified timeout (in milliseconds)
 boolean waitForQuiescence(long timeout, TimeUnit timeUnit)
          Wait for quiescence for a specified time (in TimeUnits)
 
Methods inherited from class com.neeve.root.RootObject
getChecked, getThreaded, getTracer, setChecked, setTracer
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static LoopbackBus getInstance(String name)
Return a named loopback bus instance.

Parameters:
name - The name of the bus to return.
Returns:
Returns the loopback bus of the supplied name.
Threading:
This method is safe for concurrent access by multiple threads

getInstance

public static LoopbackBus getInstance()
Return the default loopback bus instance

Returns:
Returns the default loopback bus
Threading:
This method is safe for concurrent access by multiple threads

clearAllInstances

public static void clearAllInstances()
Clear all loopback bus instances

Threading:
This method is safe for concurrent access by multiple threads

getAgentParameters

public final LoopbackBus.AgentParameters getAgentParameters(String name)
Get an agent's operating parameters

Parameters:
name - The agent's name.

getAgentTestController

public final LoopbackBus.AgentTestController getAgentTestController(String name)
Get an agent's test controller.

Parameters:
name - The agent's name.

getTestController

public LoopbackBus.TestController getTestController()
Returns the overal


reset

public final LoopbackBus reset()
Reset a loopback bus.

Threading:
This method is not safe for concurrent access with any other method in this class.

This method resets a bus. After returning from this method, the bus state is equivalent to a newly created bus.


isAgentConnected

public final boolean isAgentConnected(String name)
Check if an agent is connected to the bus

Threading:
This method is not safe for concurrent access with any other method in this class

agentHasSubscriptions

public final boolean agentHasSubscriptions(String name)
Return if an agent has active subscriptions


getAgent

public final LoopbackBus.Agent getAgent(String name)
Get a connected agent

Parameters:
name - The agent's name

enableWaitForQuiescence

public final void enableWaitForQuiescence(boolean val)
Enable a loopback bus's 'wait for quiescence" feature


waitForPendingAcks

public final boolean waitForPendingAcks(long timeout,
                                        TimeUnit timeUnit)
Equivalent to calling waitForPendingAcks(long, TimeUnit) with TimeUnit.MILLISECONDS

Parameters:
timeout - The amount of time to wait for pending acknowledgements.
timeUnit - The timeout used to wait
Returns:
true if the the number of pending acknowledgements reached 0 or false if the timeout was reached or the current thread was interrupted.
See Also:
waitForPendingAcks(long)

waitForPendingAcks

public final boolean waitForPendingAcks(long timeout)
Waits for acknowledgements for guaranteed messages sent through this bus.

If a timeout of 0 or less is specified the calling thread will wait until either the count of messages pending acknowledgements reaches 0 or the calling thread is interrupted.

In the event that the caller is interrupted, an InterruptedException is not thrown. Instead the thread is re-interrupted and false is returned

Parameters:
timeout - The amount of time to wait for pending acknowledgements
Returns:
true if the the number of pending acknowledgements reached 0 or false if the timeout was reached or the current thread was interrupted.

dumpPendingAck

public final void dumpPendingAck(StringBuilder builder)
Dumps diagnostic information about guaranteed messages pending acknowledgement to the provide StringBuilder

Parameters:
builder - The StringBuilder into which to write the diagnostics

waitForQuiescence

public final void waitForQuiescence()
Wait for quiescence with no timeout.


waitForQuiescence

public final boolean waitForQuiescence(long timeout)
Wait for quiescence for a specified timeout (in milliseconds)

Parameters:
timeout - The timeout to wait (in milliseconds). Specifying a value of < 0 is equivalent to invoking waitForQuiescence()
Returns:
Returns false if wait timed out.

waitForQuiescence

public final boolean waitForQuiescence(long timeout,
                                       TimeUnit timeUnit)
Wait for quiescence for a specified time (in TimeUnits)

Parameters:
timeout - The timeout to wait (in units specified by timeUnit)
timeUnit - The time unit to use to interpret timeout
Returns:
Returns false if wait timed out.

dumpActivityTrackingInfo

public final void dumpActivityTrackingInfo()
If Activity Tracking has been enabled for, will dump the current Activity Tracking History for this bus.

Threading:
This method is safe for concurrent access by multiple threads.

discardMessages

public final void discardMessages()
Set the bus to discard all inbound messages


clearMessageDiscard

public final void clearMessageDiscard()
Clear the discard message setting



Copyright © 2016 Neeve Research, LLC. All Rights Reserved.