This repository has been archived by the owner on Jun 29, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add constant write backoff in GelfTCPSender #248
for cases when a sender cannot write any bytes to the socket channel several times. Limit the time to stay in such mode. stop attempts to send a message in case of InterruptedException. Original pull request: #249
- Loading branch information
Showing
7 changed files
with
142 additions
and
5 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
src/main/java/biz/paluch/logging/gelf/intern/sender/BackOff.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,5 @@ | ||
package biz.paluch.logging.gelf.intern.sender; | ||
|
||
public interface BackOff { | ||
BackOffExecution start(); | ||
} |
8 changes: 8 additions & 0 deletions
8
src/main/java/biz/paluch/logging/gelf/intern/sender/BackOffExecution.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,8 @@ | ||
package biz.paluch.logging.gelf.intern.sender; | ||
|
||
public interface BackOffExecution { | ||
/** | ||
* @return time in ms to wait before a next attempt | ||
*/ | ||
int nextBackOff(); | ||
} |
19 changes: 19 additions & 0 deletions
19
src/main/java/biz/paluch/logging/gelf/intern/sender/ConstantBackOff.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,19 @@ | ||
package biz.paluch.logging.gelf.intern.sender; | ||
|
||
public class ConstantBackOff implements BackOff { | ||
private final int backoffTimeMs; | ||
|
||
public ConstantBackOff(int backoffTimeMs) { | ||
this.backoffTimeMs = backoffTimeMs; | ||
} | ||
|
||
@Override | ||
public BackOffExecution start() { | ||
return new BackOffExecution() { | ||
@Override | ||
public int nextBackOff() { | ||
return backoffTimeMs; | ||
} | ||
}; | ||
} | ||
} |
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