-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add jmon, add to parsers (zfs and smartctl), add svn-client-wrapper, …
…plus some minor stuff
- Loading branch information
jjYBdx4IL
authored and
jjYBdx4IL
committed
Jun 6, 2021
1 parent
92d2d8b
commit befd53e
Showing
97 changed files
with
5,575 additions
and
285 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -39,4 +39,4 @@ mvn clean install -Psite-archive -N | |
-- | ||
devel/java/github/misc@7856 | ||
devel/java/github/misc@7872 |
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
79 changes: 79 additions & 0 deletions
79
io-utils/src/main/java/com/github/jjYBdx4IL/utils/concurrent/CountDownLatchEx.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,79 @@ | ||
/* | ||
* Copyright © 2017 jjYBdx4IL (https://github.com/jjYBdx4IL) | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.github.jjYBdx4IL.utils.concurrent; | ||
|
||
/** | ||
* A CountDownLatch variant that does not suppress notifies. | ||
*/ | ||
|
||
public class CountDownLatchEx { | ||
|
||
protected long counter; | ||
|
||
/** | ||
* The constructor. | ||
*/ | ||
public CountDownLatchEx(long count) { | ||
if (count < 1) { | ||
throw new IllegalArgumentException(); | ||
} | ||
counter = count; | ||
} | ||
|
||
/** | ||
* The constructor. | ||
*/ | ||
public CountDownLatchEx() { | ||
this(1); | ||
} | ||
|
||
/** | ||
* Wait for notify or countdown to reach 0. Returns when countdown reaches | ||
* zero or on notify. Returns immeditaly if countdown is already at 0. | ||
* | ||
* @return true if countdown reached 0 | ||
*/ | ||
public synchronized boolean await() throws InterruptedException { | ||
if (counter <= 0) { | ||
return true; | ||
} | ||
wait(); | ||
return counter <= 0; | ||
} | ||
|
||
/** | ||
* Wait for notify or countdown to reach 0. Returns when countdown reaches | ||
* zero or on notify. Returns immeditaly if countdown is already at 0. | ||
* | ||
* @return true if countdown reached 0 | ||
*/ | ||
public synchronized boolean await(long millis) throws InterruptedException { | ||
if (counter <= 0) { | ||
return true; | ||
} | ||
wait(millis); | ||
return counter <= 0; | ||
} | ||
|
||
/** | ||
* Count down and notify once (only) upon reaching 0. | ||
*/ | ||
public synchronized void countDown() { | ||
if (--counter == 0) { | ||
notify(); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.