public class OlcbInterface extends Object
Created by bracz on 12/27/15.
Modifier and Type | Class and Description |
---|---|
(package private) class |
OlcbInterface.MessageDispatcher |
(package private) class |
OlcbInterface.OutputConnectionSniffer
Performs local feedback of addressed and global messages.
|
private class |
OlcbInterface.QueuedOutputConnection
This class keeps an output connection operating using an internal queue.
|
static interface |
OlcbInterface.SyncExecutor
Implement this interface if you need to control the thread on which loopback messages are
executed.
|
Modifier and Type | Field and Description |
---|---|
private DatagramService |
dcs |
private DatagramMeteringBuffer |
dmb |
private EventTable |
eventTable |
private OlcbInterface.MessageDispatcher |
inputConnection |
protected Connection |
internalOutputConnection |
private static Logger |
log |
private OlcbInterface.SyncExecutor |
loopbackThread |
(package private) static int |
maxThreads |
private MemoryConfigurationService |
mcs |
(package private) static int |
minThreads |
private Map<NodeID,ConfigRepresentation> |
nodeConfigs |
private NodeID |
nodeId |
private MimicNodeStore |
nodeStore |
protected Connection |
outputConnection |
private OlcbInterface.QueuedOutputConnection |
queuedOutputConnection |
private ThreadPoolExecutor |
threadPool |
(package private) static long |
threadTimeout |
private Timer |
timer |
private OlcbInterface.OutputConnectionSniffer |
wrappedOutputConnection |
Constructor and Description |
---|
OlcbInterface(NodeID nodeId_,
Connection outputConnection_)
Deprecated.
since OlcbLibrary version 0.18. Use
OlcbInterface(NodeID, Connection, ThreadPoolExecutor) instead. |
OlcbInterface(NodeID nodeId_,
Connection outputConnection_,
ThreadPoolExecutor tpe)
Creates the message-level interface.
|
Modifier and Type | Method and Description |
---|---|
void |
dispose()
cleanup local resources
|
void |
flushSendQueue()
Blocks the current thread until the outgoing messages are all sent out.
|
ConfigRepresentation |
getConfigForNode(NodeID remoteNode)
Creates a new or returns a cached CDI representation for the given node.
|
DatagramMeteringBuffer |
getDatagramMeteringBuffer() |
DatagramService |
getDatagramService() |
EventTable |
getEventTable() |
Connection |
getInputConnection()
Accessor for the outside interface for arriving inbound messages.
|
MemoryConfigurationService |
getMemoryConfigurationService() |
NodeID |
getNodeId() |
MimicNodeStore |
getNodeStore() |
Connection |
getOutputConnection()
Accessor for client libraries to send messages out.
|
Timer |
getTimer() |
void |
injectMemoryConfigurationService(MemoryConfigurationService s) |
int |
numMessageListeners() |
void |
registerMessageListener(Connection c) |
(package private) void |
runCallbackOrAbandon(Runnable r)
Calls a piece of code on the loopback thread.
|
void |
runOnThreadPool(Runnable r)
Schedules work on an interface-internal thread.
|
void |
setLoopbackThread(OlcbInterface.SyncExecutor thread)
Force the stack to execute all loopback messages on a given thread.
|
void |
unRegisterMessageListener(Connection c) |
private static final Logger log
private final Timer timer
protected final Connection internalOutputConnection
protected final Connection outputConnection
private final OlcbInterface.OutputConnectionSniffer wrappedOutputConnection
private final OlcbInterface.QueuedOutputConnection queuedOutputConnection
private final OlcbInterface.MessageDispatcher inputConnection
private final NodeID nodeId
private final MimicNodeStore nodeStore
private final DatagramMeteringBuffer dmb
private final DatagramService dcs
private MemoryConfigurationService mcs
private final Map<NodeID,ConfigRepresentation> nodeConfigs
private EventTable eventTable
private ThreadPoolExecutor threadPool
static final int minThreads
static final int maxThreads
static final long threadTimeout
private OlcbInterface.SyncExecutor loopbackThread
@Deprecated public OlcbInterface(NodeID nodeId_, Connection outputConnection_)
OlcbInterface(NodeID, Connection, ThreadPoolExecutor)
instead.nodeId_
- is the node ID for the node on this interface. Will send out a node
initialized ready with this node ID.outputConnection_
- implements the hardware interface for sending messages to the
network. Usually this is an internal object of the CanInterface.public OlcbInterface(NodeID nodeId_, Connection outputConnection_, ThreadPoolExecutor tpe)
nodeId_
- is the node ID for the node on this interface. Will send out a node
initialized ready with this node ID.outputConnection_
- implements the hardware interface for sending messages to the
network. Usually this is an internal object of the CanInterface.tpe
- ThreadPoolExecutor for the interface.public void setLoopbackThread(OlcbInterface.SyncExecutor thread)
thread
- Implementation to jump to the desired thread.public void runOnThreadPool(Runnable r)
r
- work to run.public Timer getTimer()
public Connection getInputConnection()
public Connection getOutputConnection()
public NodeID getNodeId()
public MimicNodeStore getNodeStore()
public DatagramService getDatagramService()
public DatagramMeteringBuffer getDatagramMeteringBuffer()
public MemoryConfigurationService getMemoryConfigurationService()
public void injectMemoryConfigurationService(MemoryConfigurationService s)
public EventTable getEventTable()
public ConfigRepresentation getConfigForNode(NodeID remoteNode)
remoteNode
- target node (on the network)public void flushSendQueue()
public void registerMessageListener(Connection c)
public void unRegisterMessageListener(Connection c)
public int numMessageListeners()
void runCallbackOrAbandon(Runnable r)
r
- Stuff to run on loopback thread.public void dispose()
Copyright © 2018 The OpenLCB Group. All rights reserved.