Skip to content

Commit

Permalink
refactor: disableReconnect added to TestClient.java
Browse files Browse the repository at this point in the history
Changed modifier of disableReconnect in TestClientImpl.java to public
  • Loading branch information
belagertem committed Jan 20, 2025
1 parent 1c6c16f commit 8f70435
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ public interface TestClient {
*/
void enableReconnect();

/**
* Disable reconnection attempts on connection loss.
*/
void disableReconnect();

/**
* Disconnects the SDC client from the target.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,19 +126,19 @@ public class TestClientImpl extends AbstractIdleService implements TestClient, W
/**
* Creates an SDCri consumer instance.
*
* @param targetDeviceEpr EPR address to filter for
* @param targetDeviceFacility facility to filter for
* @param targetDeviceBuilding building to filter for
* @param targetDeviceEpr EPR address to filter for
* @param targetDeviceFacility facility to filter for
* @param targetDeviceBuilding building to filter for
* @param targetDevicePointOfCare point of care to filter for
* @param targetDeviceFloor floor to filter for
* @param targetDeviceRoom room to filter for
* @param targetDeviceBed bed to filter for
* @param adapterAddress ip of the network interface to bind to
* @param maxWait max waiting time to find and connect to target device
* @param reconnectTries number of tries a reconnection is attempted
* @param reconnectWait the wait time between reconnection attempts in seconds
* @param testClientUtil test client utility
* @param testRunObserver observer for invalidating test runs on unexpected errors
* @param targetDeviceFloor floor to filter for
* @param targetDeviceRoom room to filter for
* @param targetDeviceBed bed to filter for
* @param adapterAddress ip of the network interface to bind to
* @param maxWait max waiting time to find and connect to target device
* @param reconnectTries number of tries a reconnection is attempted
* @param reconnectWait the wait time between reconnection attempts in seconds
* @param testClientUtil test client utility
* @param testRunObserver observer for invalidating test runs on unexpected errors
*/
@Inject
public TestClientImpl(
Expand Down Expand Up @@ -408,6 +408,12 @@ public void enableReconnect() {
this.reconnectEnabled.set(true);
}

@Override
public void disableReconnect() {
LOG.info(TriggerOnErrorOrWorseLogAppender.RESET_WHITELIST_MARKER, "Disable reconnect feature.");
this.reconnectEnabled.set(false);
}

@Override
public synchronized void disconnect() throws TimeoutException {
disconnect(true);
Expand Down Expand Up @@ -562,11 +568,6 @@ private List<String> buildThreadNameWhiteList() {
convertToRegex(WATCHDOG_SCHEDULED_EXECUTOR_NAME_FORMAT));
}

private void disableReconnect() {
LOG.info(TriggerOnErrorOrWorseLogAppender.RESET_WHITELIST_MARKER, "Disable reconnect feature.");
this.reconnectEnabled.set(false);
}

private String convertToRegex(final String pattern) {
return pattern.replaceAll("%d", "[\\\\d]+");
}
Expand Down

0 comments on commit 8f70435

Please sign in to comment.