Skip to content

Commit

Permalink
Update HotSwapPoller.start() to _not_ immediately poll for controllers
Browse files Browse the repository at this point in the history
  • Loading branch information
Valkryst committed Oct 26, 2023
1 parent 2f0a862 commit cfddbcc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 16 deletions.
6 changes: 1 addition & 5 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,7 @@ public class HotSwapExample {
}
});

try {
hotswapPoller.start();
} catch (final Exception e) {
e.printStackTrace();
}
hotswapPoller.start();

System.out.println("Polling for hot-swaps. Try adding or removing a controller.");
}
Expand Down
13 changes: 2 additions & 11 deletions src/main/java/com/valkryst/VController/HotSwapPoller.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,9 @@ private HotSwapPoller() {}
* <p>Starts polling the {@link Controller}s.</p>
*
* <p>See {@link ScheduledExecutorService#scheduleAtFixedRate(Runnable, long, long, TimeUnit)} for caveats.</p>
*
* @throws ClassNotFoundException If there is an error getting the {@link Controller}s.
* @throws IllegalAccessException If there is an error getting the {@link Controller}s.
* @throws IllegalStateException If the {@link HotSwapPoller} is already running or if the current {@link ControllerEnvironment} is not supported.
* @throws InstantiationException If there is an error getting the {@link Controller}s.
* @throws InterruptedException If there is an error getting the {@link Controller}s.
* @throws InvocationTargetException If there is an error getting the {@link Controller}s.
* @throws NoSuchFieldException If there is an error getting the {@link Controller}s.
* @throws NoSuchMethodException If there is an error getting the {@link Controller}s.
*/
public void start() throws ClassNotFoundException, IllegalAccessException, InstantiationException, InterruptedException, InvocationTargetException, NoSuchFieldException, NoSuchMethodException {
final var oldControllers = getControllers();
public void start() {
final var oldControllers = new ArrayList<Controller>();

synchronized (this) {
if (executorService != null) {
Expand Down

0 comments on commit cfddbcc

Please sign in to comment.