Class ThrottledConnection
java.lang.Object
uk.ac.manchester.spinnaker.connections.ThrottledConnection
- All Implemented Interfaces:
Closeable
,AutoCloseable
public class ThrottledConnection extends Object implements Closeable
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
Fields Modifier and Type Field Description static long
THROTTLE_NS
The minimum interval between messages, in nanoseconds. -
Constructor Summary
Constructors Constructor Description ThrottledConnection(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 Type Method Description void
close()
ChipLocation
getLocation()
ByteBuffer
receive()
Get a message from the connection.void
send(SDPMessage message)
Throttled send.String
toString()
-
Field Details
-
THROTTLE_NS
public static final long THROTTLE_NSThe minimum interval between messages, in nanoseconds.- See Also:
- Constant Field Values
-
-
Constructor Details
-
ThrottledConnection
@MustBeClosed public ThrottledConnection(IPTag iptag) throws IOException, ProcessException, InterruptedExceptionCreate 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:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
getLocation
-
toString
-