You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by dp...@apache.org on 2018/10/06 16:42:52 UTC
[ignite-teamcity-bot] branch master updated: IGNITE-9800: Abs for
server filter added
This is an automated email from the ASF dual-hosted git repository.
dpavlov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite-teamcity-bot.git
The following commit(s) were added to refs/heads/master by this push:
new 1d85dc3 IGNITE-9800: Abs for server filter added
1d85dc3 is described below
commit 1d85dc389b723b0526dcd54de7b79407a9210c0f
Author: Dmitriy Pavlov <dp...@apache.org>
AuthorDate: Sat Oct 6 19:42:47 2018 +0300
IGNITE-9800: Abs for server filter added
---
.../ci/github/ignited/GitHubConnIgnitedImpl.java | 40 ++++++++++------------
.../apache/ignite/ci/tcmodel/hist/BuildRef.java | 8 ++---
2 files changed, 23 insertions(+), 25 deletions(-)
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/github/ignited/GitHubConnIgnitedImpl.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/github/ignited/GitHubConnIgnitedImpl.java
index f44dae4..7b0bc5c 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/github/ignited/GitHubConnIgnitedImpl.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/github/ignited/GitHubConnIgnitedImpl.java
@@ -16,14 +16,11 @@
*/
package org.apache.ignite.ci.github.ignited;
-import com.google.common.cache.Cache;
-import com.google.common.cache.CacheBuilder;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
import java.util.stream.StreamSupport;
@@ -41,33 +38,31 @@ import org.apache.ignite.configuration.CacheConfiguration;
import org.jetbrains.annotations.NotNull;
class GitHubConnIgnitedImpl implements IGitHubConnIgnited {
+ /** Cache name*/
public static final String GIT_HUB_PR = "gitHubPr";
+
+ /** Server id. */
private String srvId;
+
+ /** Pure HTTP Connection API. */
private IGitHubConnection conn;
+ /** Ignite provider. */
@Inject Provider<Ignite> igniteProvider;
+ /** Scheduler. */
@Inject IScheduler scheduler;
- @Deprecated
- private final Cache<String, List<PullRequest>> prListCache
- = CacheBuilder.newBuilder()
- .maximumSize(100)
- .expireAfterWrite(5, TimeUnit.MINUTES)
- .softValues()
- .build();
-
/** Server ID mask for cache Entries. */
private long srvIdMaskHigh;
+ /** PPs cache. */
private IgniteCache<Long, PullRequest> prCache;
- private volatile boolean firstRun = true;
-
public void init(String srvId, IGitHubConnection conn) {
this.srvId = srvId;
this.conn = conn;
- srvIdMaskHigh = srvId.hashCode();
+ srvIdMaskHigh = Math.abs(srvId.hashCode());
prCache = igniteProvider.get().getOrCreateCache(getCache8PartsConfig(GIT_HUB_PR));
}
@@ -92,23 +87,26 @@ class GitHubConnIgnitedImpl implements IGitHubConnIgnited {
.filter(entry -> PullRequest.OPEN.equals(entry.getValue().getState()))
.map(javax.cache.Cache.Entry::getValue)
.collect(Collectors.toList());
-
- /* try {
- return prListCache.get("", conn::getPullRequests);
- }
- catch (ExecutionException e) {
- throw ExceptionUtil.propagateException(e);
- }*/
}
private void actualizePrs() {
runAtualizePrs(srvId, false);
// schedule full resync later
+ scheduler.invokeLater(this::sheduleResync, 20, TimeUnit.SECONDS);
+ }
+
+ /**
+ *
+ */
+ private void sheduleResync() {
scheduler.sheduleNamed(IGitHubConnIgnited.class.getSimpleName() + ".fullReindex",
this::fullReindex, 60, TimeUnit.MINUTES);
}
+ /**
+ *
+ */
private void fullReindex() {
runAtualizePrs(srvId, true);
}
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcmodel/hist/BuildRef.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcmodel/hist/BuildRef.java
index 845c591..fc96679 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcmodel/hist/BuildRef.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcmodel/hist/BuildRef.java
@@ -105,8 +105,8 @@ public class BuildRef extends AbstractRef {
return composite != null && composite;
}
- @Override
- public boolean equals(Object o) {
+ /** {@inheritDoc} */
+ @Override public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
BuildRef buildRef = (BuildRef) o;
@@ -121,8 +121,8 @@ public class BuildRef extends AbstractRef {
Objects.equal(webUrl, buildRef.webUrl);
}
- @Override
- public int hashCode() {
+ /** {@inheritDoc} */
+ @Override public int hashCode() {
return Objects.hashCode(id, buildTypeId, branchName, status, state, buildNumber, defaultBranch, composite, webUrl);
}
}