-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #72 from eparovyshnaya/553807
# 553807 - revise permission observatory API - Observatory is renamed to Pool - GuardedObservatory is renamed to Observatory - schedule semantics is formed to a separate class - which is, in turn, covered with tests - lic.base bundle version is incremented in _patch_ part according to [semver](semver.org) as the new release cycle has just begun Signed-off-by: elena.parovyshnaya <[email protected]>
- Loading branch information
Showing
12 changed files
with
276 additions
and
131 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
82 changes: 82 additions & 0 deletions
82
....base/src/org/eclipse/passage/lic/internal/base/permission/observatory/CheckSchedule.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,82 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2019 ArSysOp | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* ArSysOp - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.passage.lic.internal.base.permission.observatory; | ||
|
||
import java.time.temporal.ChronoUnit; | ||
|
||
/** | ||
* <p> | ||
* Schedule for observatory checks. | ||
* </p> | ||
* | ||
* <p> | ||
* Been defined for <i>5 minutes</i>, causes the observatory to check for new | ||
* expired entries each 5 minutes (or so). | ||
* </p> | ||
* | ||
* @since 0.6 | ||
*/ | ||
public class CheckSchedule { | ||
|
||
private final int amount; | ||
private final ChronoUnit unit; | ||
|
||
/** | ||
* <p> | ||
* Use desired units to define the most suitable check schedule. | ||
* </p> | ||
* | ||
* <p> | ||
* For example, {@code new CheckSchedule(2, ChronoUnit.DAYS)}, been given to an | ||
* observatory, will cause the closest expiration check to happen only in two | ||
* days since the observatory opening. | ||
* </p> | ||
* | ||
* @param amount number of units | ||
* @unit {@linkplain ChronoUnit} constant to measure {@code amount} | ||
* @since 0.6 | ||
*/ | ||
public CheckSchedule(int amount, ChronoUnit unit) { | ||
this.amount = amount; | ||
this.unit = unit; | ||
} | ||
|
||
/** | ||
* Default schedules are measured in minutes. | ||
* | ||
* @param minutes number of minutes | ||
* @since 0.6 | ||
*/ | ||
public CheckSchedule(int minutes) { | ||
this(minutes, ChronoUnit.MINUTES); | ||
} | ||
|
||
/** | ||
* Default schedule is 10 minutes. | ||
* | ||
* @since 0.6 | ||
*/ | ||
public CheckSchedule() { | ||
this(10, ChronoUnit.MINUTES); | ||
} | ||
|
||
/** | ||
* Reports the scheduled period duration in seconds. | ||
* | ||
* @since 0.6 | ||
*/ | ||
public long seconds() { | ||
return unit.getDuration().getSeconds() * amount; | ||
} | ||
|
||
} |
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
92 changes: 0 additions & 92 deletions
92
.../src/org/eclipse/passage/lic/internal/base/permission/observatory/GuardedObservatory.java
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
Oops, something went wrong.