code: private void handleResponse(PowerShellResponseHandler response, PowerShellResponse powerShellResponse) {
          try {
              response.handle(powerShellResponse);
          } catch (Exception ex) {
              logger.log(Level.SEVERE, "PowerShell not available", ex);
          }
      }
docs: Handle response in callback way