Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#21 Add support for event notifications
Add Event publishing for connection acquire and lease times
- Loading branch information
1 parent
7eb2f12
commit 95f4827
Showing
10 changed files
with
218 additions
and
4 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
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
19 changes: 19 additions & 0 deletions
19
...in/java/com/vladmihalcea/flexypool/event/ConnectionAcquireTimeThresholdExceededEvent.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 com.vladmihalcea.flexypool.event; | ||
|
||
/** | ||
* <code>ConnectionAcquireTimeThresholdExceededEvent</code> - Event generated when a connection acquire has exceeded the given time threshold | ||
* | ||
* @author Vlad Mihalcea | ||
*/ | ||
public class ConnectionAcquireTimeThresholdExceededEvent extends TimeThresholdExceededEvent { | ||
|
||
private static final long serialVersionUID = -2107982228572130887L; | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public ConnectionAcquireTimeThresholdExceededEvent(String uniqueName, | ||
long timeThresholdMillis, long actualTimeMillis) { | ||
super(uniqueName, timeThresholdMillis, actualTimeMillis); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
...main/java/com/vladmihalcea/flexypool/event/ConnectionLeaseTimeThresholdExceededEvent.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 com.vladmihalcea.flexypool.event; | ||
|
||
/** | ||
* <code>ConnectionLeaseTimeThresholdExceededEvent</code> - Event generated when a connection lease has exceeded the given time threshold | ||
* | ||
* @author Vlad Mihalcea | ||
*/ | ||
public class ConnectionLeaseTimeThresholdExceededEvent extends TimeThresholdExceededEvent { | ||
|
||
private static final long serialVersionUID = -2107982228572130887L; | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public ConnectionLeaseTimeThresholdExceededEvent(String uniqueName, | ||
long timeThresholdMillis, long actualTimeMillis) { | ||
super(uniqueName, timeThresholdMillis, actualTimeMillis); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
...-pool-core/src/main/java/com/vladmihalcea/flexypool/event/TimeThresholdExceededEvent.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,35 @@ | ||
package com.vladmihalcea.flexypool.event; | ||
|
||
/** | ||
* <code>TimeThresholdExceededEvent</code> - Event generated when a time threshold is exceeded | ||
* | ||
* @author Vlad Mihalcea | ||
*/ | ||
public abstract class TimeThresholdExceededEvent extends Event { | ||
|
||
private static final long serialVersionUID = 8983594872506186227L; | ||
|
||
private final long timeThresholdMillis; | ||
|
||
private final long actualTimeMillis; | ||
|
||
/** | ||
* Init constructor | ||
* @param uniqueName FlexyPool unique name | ||
* @param timeThresholdMillis time threshold millis | ||
* @param actualTimeMillis actual time millis | ||
*/ | ||
public TimeThresholdExceededEvent(String uniqueName, long timeThresholdMillis, long actualTimeMillis) { | ||
super(uniqueName); | ||
this.timeThresholdMillis = timeThresholdMillis; | ||
this.actualTimeMillis = actualTimeMillis; | ||
} | ||
|
||
public long getTimeThresholdMillis() { | ||
return timeThresholdMillis; | ||
} | ||
|
||
public long getActualTimeMillis() { | ||
return actualTimeMillis; | ||
} | ||
} |
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