private static Map<MACAddress, LifxLightCommunicationTracker> macTrackerMapping = new ConcurrentHashMap<>();
- public static void lock(@Nullable MACAddress mac) {
+ public static void lock(@Nullable MACAddress mac) throws InterruptedException {
if (mac != null) {
LifxLightCommunicationTracker tracker = getOrCreateTracker(mac);
tracker.lock();
return tracker;
}
- private static void waitForNextPacketInterval(long timestamp) {
+ private static void waitForNextPacketInterval(long timestamp) throws InterruptedException {
long timeToWait = Math.max(PACKET_INTERVAL - (System.currentTimeMillis() - timestamp), 0);
if (timeToWait > 0) {
- try {
- Thread.sleep(timeToWait);
- } catch (InterruptedException e) {
- LOGGER.error("An exception occurred while putting the thread to sleep : '{}'", e.getMessage());
- }
+ Thread.sleep(timeToWait);
}
}
}
}
- public static void lock() {
+ public static void lock() throws InterruptedException {
long lastStamp = 0;
for (LifxLightCommunicationTracker tracker : trackers) {
tracker.lock();