Class ThrottledConnection
java.lang.Object
uk.ac.manchester.spinnaker.connections.ThrottledConnection
- All Implemented Interfaces:
Closeable,AutoCloseable
An SDP connection that uses a throttle to stop SCAMP from overloading. Note
that this does not bother to implement the full connection API.
- Author:
- Donal Fellows
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final longThe minimum interval between messages, in nanoseconds. -
Constructor Summary
ConstructorsConstructorDescriptionThrottledConnection(IPTag iptag) Create a throttled connection for talking to a board and point an IPTag so that messages sent to it arrive on this connection. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()receive()Get a message from the connection.voidsend(SDPMessage message) Throttled send.toString()
-
Field Details
-
THROTTLE_NS
public static final long THROTTLE_NSThe minimum interval between messages, in nanoseconds.- See Also:
-
-
Constructor Details
-
ThrottledConnection
@MustBeClosed public ThrottledConnection(IPTag iptag) throws IOException, ProcessException, InterruptedException Create a throttled connection for talking to a board and point an IPTag so that messages sent to it arrive on this connection.- Parameters:
iptag- The tag to reprogram to talk to this connection.- Throws:
IOException- If IO fails.ProcessException- If SpiNNaker rejects the reprogramming.InterruptedException- If communications are interrupted.
-
-
Method Details
-
receive
Get a message from the connection.- Returns:
- The content of the message.
- Throws:
SocketTimeoutException- If no message is received by the timeout.IOException- If IO fails.InterruptedException- If communications are interrupted.
-
send
Throttled send.- Parameters:
message- The message to send.- Throws:
IOException- If IO fails.
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
getLocation
-
toString
-