-
Notifications
You must be signed in to change notification settings - Fork 160
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added TransportClientPoolExhaustedException at transport level
Signed-off-by: Alberto Codutti <alberto.codutti@eurotech.com>
- Loading branch information
Showing
7 changed files
with
125 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
...ain/java/org/eclipse/kapua/transport/exception/TransportClientPoolExhaustedException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2020, 2022 Eurotech and/or its affiliates and others | ||
* | ||
* This program and the accompanying materials are made | ||
* available under the terms of the Eclipse Public License 2.0 | ||
* which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Eurotech - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.kapua.transport.exception; | ||
|
||
import javax.validation.constraints.NotNull; | ||
|
||
/** | ||
* The {@link TransportException} to throw when is not possible to get an instance of the {@link org.eclipse.kapua.transport.TransportFacade} within the configured timeout | ||
* | ||
* @since 2.0.0 | ||
*/ | ||
public class TransportClientPoolExhaustedException extends TransportException { | ||
|
||
private final String serverIp; | ||
private final Long borrowWaitTimeout; | ||
|
||
/** | ||
* Constructor. | ||
* | ||
* @param serverIp The serverIp to which connect the {@link org.eclipse.kapua.transport.TransportFacade} | ||
* @since 2.0.0 | ||
*/ | ||
public TransportClientPoolExhaustedException(@NotNull String serverIp, Long borrowWaitTimeout) { | ||
super(TransportErrorCodes.CLIENT_POOL_EXHAUSTED, serverIp, borrowWaitTimeout); | ||
|
||
this.serverIp = serverIp; | ||
this.borrowWaitTimeout = borrowWaitTimeout; | ||
} | ||
|
||
/** | ||
* Constructor. | ||
* | ||
* @param cause the root cause of the {@link Exception}. | ||
* @param serverIp The serverIp to which connect the {@link org.eclipse.kapua.transport.TransportFacade} | ||
* @since 2.0.0 | ||
*/ | ||
public TransportClientPoolExhaustedException(@NotNull Throwable cause, @NotNull String serverIp, Long borrowWaitTimeout) { | ||
super(TransportErrorCodes.CLIENT_POOL_EXHAUSTED, cause, serverIp, borrowWaitTimeout); | ||
|
||
this.serverIp = serverIp; | ||
this.borrowWaitTimeout = borrowWaitTimeout; | ||
} | ||
|
||
/** | ||
* Gets the IP to which we wanted unsuccessfully to connect. | ||
* | ||
* @return The IP to which we wanted unsuccessfully to connect. | ||
* @since 2.0.0 | ||
*/ | ||
public String getRequestMessage() { | ||
return serverIp; | ||
} | ||
|
||
/** | ||
* Gets the configured timeout for the borrow operation. | ||
* | ||
* @return The configured timeout for the borrow operation. | ||
* @since 2.0.0 | ||
*/ | ||
public Long getBorrowWaitTimeout() { | ||
return borrowWaitTimeout; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters