Repository: incubator-ignite Updated Branches: refs/heads/sprint-1 a3cce2548 -> c851305c3
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9c30477a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorMetricsConfiguration.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorMetricsConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorMetricsConfiguration.java index eec959c..51dc092 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorMetricsConfiguration.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorMetricsConfiguration.java @@ -32,7 +32,7 @@ public class VisorMetricsConfiguration implements Serializable { private long expTime; /** Number of node metrics stored in memory. */ - private int historySize; + private int histSize; /** Frequency of metrics log printout. */ private long logFreq; @@ -69,14 +69,14 @@ public class VisorMetricsConfiguration implements Serializable { * @return Number of node metrics stored in memory. */ public int historySize() { - return historySize; + return histSize; } /** - * @param historySize New number of node metrics stored in memory. + * @param histSize New number of node metrics stored in memory. */ - public void historySize(int historySize) { - this.historySize = historySize; + public void historySize(int histSize) { + this.histSize = histSize; } /** http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9c30477a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJobResult.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJobResult.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJobResult.java index 7d4d665..ea8a8fc 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJobResult.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJobResult.java @@ -36,16 +36,16 @@ public class VisorNodeDataCollectorJobResult implements Serializable { private String gridName; /** Node topology version. */ - private long topologyVersion; + private long topVer; /** Task monitoring state collected from node. */ private boolean taskMonitoringEnabled; /** Node events. */ - private final Collection<VisorGridEvent> events = new ArrayList<>(); + private final Collection<VisorGridEvent> evts = new ArrayList<>(); /** Exception while collecting node events. */ - private Throwable eventsEx; + private Throwable evtsEx; /** Node caches. */ private final Collection<VisorCache> caches = new ArrayList<>(); @@ -86,72 +86,117 @@ public class VisorNodeDataCollectorJobResult implements Serializable { * @return Current topology version. */ public long topologyVersion() { - return topologyVersion; + return topVer; } /** - * @param topologyVersion New topology version value. + * @param topVer New topology version value. */ - public void topologyVersion(long topologyVersion) { - this.topologyVersion = topologyVersion; + public void topologyVersion(long topVer) { + this.topVer = topVer; } + /** + * @return Current task monitoring state. + */ public boolean taskMonitoringEnabled() { return taskMonitoringEnabled; } + /** + * @param taskMonitoringEnabled New value of task monitoring state. + */ public void taskMonitoringEnabled(boolean taskMonitoringEnabled) { this.taskMonitoringEnabled = taskMonitoringEnabled; } + /** + * @return Collection of collected events. + */ public Collection<VisorGridEvent> events() { - return events; + return evts; } + /** + * @return Exception caught during collecting events. + */ public Throwable eventsEx() { - return eventsEx; + return evtsEx; } - public void eventsEx(Throwable eventsEx) { - this.eventsEx = eventsEx; + /** + * @param evtsEx Exception caught during collecting events. + */ + public void eventsEx(Throwable evtsEx) { + this.evtsEx = evtsEx; } + /** + * @return Collected cache metrics. + */ public Collection<VisorCache> caches() { return caches; } + /** + * @return Exception caught during collecting caches metrics. + */ public Throwable cachesEx() { return cachesEx; } + /** + * @param cachesEx Exception caught during collecting caches metrics. + */ public void cachesEx(Throwable cachesEx) { this.cachesEx = cachesEx; } + /** + * @return Collected IGFSs metrics. + */ public Collection<VisorIgfs> igfss() { return igfss; } + /** + * @return Collected IGFSs endpoints. + */ public Collection<VisorIgfsEndpoint> igfsEndpoints() { return igfsEndpoints; } + /** + * @return Exception caught during collecting IGFSs metrics. + */ public Throwable igfssEx() { return igfssEx; } + /** + * @param igfssEx Exception caught during collecting IGFSs metrics. + */ public void igfssEx(Throwable igfssEx) { this.igfssEx = igfssEx; } + /** + * @return Collection of streamers metrics. + */ public Collection<VisorStreamer> streamers() { return streamers; } + /** + * @return Exception caught during collecting streamers metrics. + */ public Throwable streamersEx() { return streamersEx; } + /** + * @param streamersEx Exception caught during collecting streamers metrics. + */ public void streamersEx(Throwable streamersEx) { this.streamersEx = streamersEx; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9c30477a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTask.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTask.java index bcc2874..72ab6dd 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTask.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTask.java @@ -53,7 +53,7 @@ public class VisorNodeDataCollectorTask extends VisorMultiNodeTask<VisorNodeData } finally { if (debug) - logMapped(g.log(), getClass(), map.values()); + logMapped(ignite.log(), getClass(), map.values()); } } @@ -67,62 +67,73 @@ public class VisorNodeDataCollectorTask extends VisorMultiNodeTask<VisorNodeData return reduce(new VisorNodeDataCollectorTaskResult(), results); } - protected VisorNodeDataCollectorTaskResult reduce(VisorNodeDataCollectorTaskResult taskResult, + /** + * @param taskRes Task result. + * @param results Results. + */ + protected VisorNodeDataCollectorTaskResult reduce(VisorNodeDataCollectorTaskResult taskRes, List<ComputeJobResult> results) { for (ComputeJobResult res : results) { - VisorNodeDataCollectorJobResult jobResult = res.getData(); + VisorNodeDataCollectorJobResult jobRes = res.getData(); - if (jobResult != null) { + if (jobRes != null) { UUID nid = res.getNode().id(); IgniteException unhandledEx = res.getException(); if (unhandledEx == null) - reduceJobResult(taskResult, jobResult, nid); + reduceJobResult(taskRes, jobRes, nid); else { // Ignore nodes that left topology. if (!(unhandledEx instanceof ClusterGroupEmptyException)) - taskResult.unhandledEx().put(nid, unhandledEx); + taskRes.unhandledEx().put(nid, unhandledEx); } } } - return taskResult; + return taskRes; } - protected void reduceJobResult(VisorNodeDataCollectorTaskResult taskResult, - VisorNodeDataCollectorJobResult jobResult, UUID nid) { - taskResult.gridNames().put(nid, jobResult.gridName()); + /** + * Reduce job result. + * + * @param taskRes Task result. + * @param jobRes Job result. + * @param nid Node ID. + */ + protected void reduceJobResult(VisorNodeDataCollectorTaskResult taskRes, + VisorNodeDataCollectorJobResult jobRes, UUID nid) { + taskRes.gridNames().put(nid, jobRes.gridName()); - taskResult.topologyVersions().put(nid, jobResult.topologyVersion()); + taskRes.topologyVersions().put(nid, jobRes.topologyVersion()); - taskResult.taskMonitoringEnabled().put(nid, jobResult.taskMonitoringEnabled()); + taskRes.taskMonitoringEnabled().put(nid, jobRes.taskMonitoringEnabled()); - if (!jobResult.events().isEmpty()) - taskResult.events().addAll(jobResult.events()); + if (!jobRes.events().isEmpty()) + taskRes.events().addAll(jobRes.events()); - if (jobResult.eventsEx() != null) - taskResult.eventsEx().put(nid, jobResult.eventsEx()); + if (jobRes.eventsEx() != null) + taskRes.eventsEx().put(nid, jobRes.eventsEx()); - if (!jobResult.caches().isEmpty()) - taskResult.caches().put(nid, jobResult.caches()); + if (!jobRes.caches().isEmpty()) + taskRes.caches().put(nid, jobRes.caches()); - if (jobResult.cachesEx() != null) - taskResult.cachesEx().put(nid, jobResult.cachesEx()); + if (jobRes.cachesEx() != null) + taskRes.cachesEx().put(nid, jobRes.cachesEx()); - if (!jobResult.streamers().isEmpty()) - taskResult.streamers().put(nid, jobResult.streamers()); + if (!jobRes.streamers().isEmpty()) + taskRes.streamers().put(nid, jobRes.streamers()); - if (jobResult.streamersEx() != null) - taskResult.streamersEx().put(nid, jobResult.streamersEx()); + if (jobRes.streamersEx() != null) + taskRes.streamersEx().put(nid, jobRes.streamersEx()); - if (!jobResult.igfss().isEmpty()) - taskResult.igfss().put(nid, jobResult.igfss()); + if (!jobRes.igfss().isEmpty()) + taskRes.igfss().put(nid, jobRes.igfss()); - if (!jobResult.igfsEndpoints().isEmpty()) - taskResult.igfsEndpoints().put(nid, jobResult.igfsEndpoints()); + if (!jobRes.igfsEndpoints().isEmpty()) + taskRes.igfsEndpoints().put(nid, jobRes.igfsEndpoints()); - if (jobResult.igfssEx() != null) - taskResult.igfssEx().put(nid, jobResult.igfssEx()); + if (jobRes.igfssEx() != null) + taskRes.igfssEx().put(nid, jobRes.igfssEx()); } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9c30477a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskArg.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskArg.java index f7e1eb9..7be546d 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskArg.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskArg.java @@ -39,8 +39,11 @@ public class VisorNodeDataCollectorTaskArg implements Serializable { private int sample; /** If {@code true} then collect information about system caches. */ - private boolean systemCaches; + private boolean sysCaches; + /** + * Default constructor. + */ public VisorNodeDataCollectorTaskArg() { // No-op. } @@ -52,20 +55,20 @@ public class VisorNodeDataCollectorTaskArg implements Serializable { * @param evtOrderKey Event order key, unique for Visor instance. * @param evtThrottleCntrKey Event throttle counter key, unique for Visor instance. * @param sample How many entries use in sampling. - * @param systemCaches If {@code true} then collect information about system caches. + * @param sysCaches If {@code true} then collect information about system caches. */ public VisorNodeDataCollectorTaskArg( boolean taskMonitoringEnabled, String evtOrderKey, String evtThrottleCntrKey, int sample, - boolean systemCaches + boolean sysCaches ) { this.taskMonitoringEnabled = taskMonitoringEnabled; this.evtOrderKey = evtOrderKey; this.evtThrottleCntrKey = evtThrottleCntrKey; this.sample = sample; - this.systemCaches = systemCaches; + this.sysCaches = sysCaches; } /** @@ -128,13 +131,13 @@ public class VisorNodeDataCollectorTaskArg implements Serializable { * @return {@code true} if Visor should collect metrics for system caches. */ public boolean systemCaches() { - return systemCaches; + return sysCaches; } /** - * @param systemCaches {@code true} if Visor should collect metrics for system caches. + * @param sysCaches {@code true} if Visor should collect metrics for system caches. */ - public void systemCaches(boolean systemCaches) { - this.systemCaches = systemCaches; + public void systemCaches(boolean sysCaches) { + this.sysCaches = sysCaches; } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9c30477a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskResult.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskResult.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskResult.java index 0b3a95c..f9f5214 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskResult.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskResult.java @@ -39,16 +39,16 @@ public class VisorNodeDataCollectorTaskResult implements Serializable { private final Map<UUID, String> gridNames = new HashMap<>(); /** Nodes topology versions. */ - private final Map<UUID, Long> topologyVersions = new HashMap<>(); + private final Map<UUID, Long> topVersions = new HashMap<>(); /** All task monitoring state collected from nodes. */ private final Map<UUID, Boolean> taskMonitoringEnabled = new HashMap<>(); /** All events collected from nodes. */ - private final List<VisorGridEvent> events = new ArrayList<>(); + private final List<VisorGridEvent> evts = new ArrayList<>(); /** Exceptions caught during collecting events from nodes. */ - private final Map<UUID, Throwable> eventsEx = new HashMap<>(); + private final Map<UUID, Throwable> evtsEx = new HashMap<>(); /** All caches collected from nodes. */ private final Map<UUID, Collection<VisorCache>> caches = new HashMap<>(); @@ -77,11 +77,11 @@ public class VisorNodeDataCollectorTaskResult implements Serializable { public boolean isEmpty() { return gridNames.isEmpty() && - topologyVersions.isEmpty() && + topVersions.isEmpty() && unhandledEx.isEmpty() && taskMonitoringEnabled.isEmpty() && - events.isEmpty() && - eventsEx.isEmpty() && + evts.isEmpty() && + evtsEx.isEmpty() && caches.isEmpty() && cachesEx.isEmpty() && igfss.isEmpty() && @@ -109,7 +109,7 @@ public class VisorNodeDataCollectorTaskResult implements Serializable { * @return Nodes topology versions. */ public Map<UUID, Long> topologyVersions() { - return topologyVersions; + return topVersions; } /** @@ -123,14 +123,14 @@ public class VisorNodeDataCollectorTaskResult implements Serializable { * @return All events collected from nodes. */ public List<VisorGridEvent> events() { - return events; + return evts; } /** * @return Exceptions caught during collecting events from nodes. */ public Map<UUID, Throwable> eventsEx() { - return eventsEx; + return evtsEx; } /** http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9c30477a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeEventsCollectorTask.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeEventsCollectorTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeEventsCollectorTask.java index 0d25312..41090b7 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeEventsCollectorTask.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeEventsCollectorTask.java @@ -25,7 +25,6 @@ import org.apache.ignite.internal.util.typedef.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.internal.visor.*; import org.apache.ignite.internal.visor.event.*; -import org.apache.ignite.internal.visor.util.*; import org.apache.ignite.lang.*; import org.jetbrains.annotations.*; @@ -33,6 +32,7 @@ import java.io.*; import java.util.*; import static org.apache.ignite.events.EventType.*; +import static org.apache.ignite.internal.visor.util.VisorTaskUtils.*; /** * Task that runs on specified node and returns events data. @@ -50,14 +50,14 @@ public class VisorNodeEventsCollectorTask extends VisorMultiNodeTask<VisorNodeEv /** {@inheritDoc} */ @Override protected Iterable<? extends VisorGridEvent> reduce0(List<ComputeJobResult> results) { - Collection<VisorGridEvent> allEvents = new ArrayList<>(); + Collection<VisorGridEvent> allEvts = new ArrayList<>(); for (ComputeJobResult r : results) { if (r.getException() == null) - allEvents.addAll((Collection<VisorGridEvent>) r.getData()); + allEvts.addAll((Collection<VisorGridEvent>) r.getData()); } - return allEvents.isEmpty() ? Collections.<VisorGridEvent>emptyList() : allEvents; + return allEvts.isEmpty() ? Collections.<VisorGridEvent>emptyList() : allEvts; } /** @@ -81,23 +81,23 @@ public class VisorNodeEventsCollectorTask extends VisorMultiNodeTask<VisorNodeEv private final String taskName; /** Task or job events with session. */ - private final IgniteUuid taskSessionId; + private final IgniteUuid taskSesId; /** * @param keyOrder Arguments for node local storage key. * @param typeArg Arguments for type filter. * @param timeArg Arguments for time filter. * @param taskName Arguments for task name filter. - * @param taskSessionId Arguments for task session filter. + * @param taskSesId Arguments for task session filter. */ public VisorNodeEventsCollectorTaskArg(@Nullable String keyOrder, @Nullable int[] typeArg, @Nullable Long timeArg, - @Nullable String taskName, @Nullable IgniteUuid taskSessionId) { + @Nullable String taskName, @Nullable IgniteUuid taskSesId) { this.keyOrder = keyOrder; this.typeArg = typeArg; this.timeArg = timeArg; this.taskName = taskName; - this.taskSessionId = taskSessionId; + this.taskSesId = taskSesId; } /** @@ -111,13 +111,12 @@ public class VisorNodeEventsCollectorTask extends VisorMultiNodeTask<VisorNodeEv /** * @param timeArg Arguments for time filter. * @param taskName Arguments for task name filter. - * @param taskSessionId Arguments for task session filter. + * @param taskSesId Arguments for task session filter. */ public static VisorNodeEventsCollectorTaskArg createTasksArg(@Nullable Long timeArg, @Nullable String taskName, - @Nullable IgniteUuid taskSessionId) { - return new VisorNodeEventsCollectorTaskArg(null, - VisorTaskUtils.concat(EVTS_JOB_EXECUTION, EVTS_TASK_EXECUTION), - timeArg, taskName, taskSessionId); + @Nullable IgniteUuid taskSesId) { + return new VisorNodeEventsCollectorTaskArg(null, concat(EVTS_JOB_EXECUTION, EVTS_TASK_EXECUTION), + timeArg, taskName, taskSesId); } /** @@ -160,7 +159,7 @@ public class VisorNodeEventsCollectorTask extends VisorMultiNodeTask<VisorNodeEv * @return Task or job events with session. */ public IgniteUuid taskSessionId() { - return taskSessionId; + return taskSesId; } /** {@inheritDoc} */ @@ -241,17 +240,17 @@ public class VisorNodeEventsCollectorTask extends VisorMultiNodeTask<VisorNodeEv * @param e Event * @return {@code true} if not contains {@code visor} in task name. */ - private boolean filterByTaskSessionId(Event e, IgniteUuid taskSessionId) { + private boolean filterByTaskSessionId(Event e, IgniteUuid taskSesId) { if (e.getClass().equals(TaskEvent.class)) { TaskEvent te = (TaskEvent)e; - return te.taskSessionId().equals(taskSessionId); + return te.taskSessionId().equals(taskSesId); } if (e.getClass().equals(JobEvent.class)) { JobEvent je = (JobEvent)e; - return je.taskSessionId().equals(taskSessionId); + return je.taskSessionId().equals(taskSesId); } return true; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9c30477a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorRestConfiguration.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorRestConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorRestConfiguration.java index 2f5a47c..1bdb7b7 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorRestConfiguration.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorRestConfiguration.java @@ -59,7 +59,7 @@ public class VisorRestConfiguration implements Serializable { private Integer tcpPort; /** Context factory for SSL. */ - private String tcpSslContextFactory; + private String tcpSslCtxFactory; /** * @param c Grid configuration. @@ -203,14 +203,14 @@ public class VisorRestConfiguration implements Serializable { * @return Context factory for SSL. */ @Nullable public String tcpSslContextFactory() { - return tcpSslContextFactory; + return tcpSslCtxFactory; } /** * @param tcpSslCtxFactory New context factory for SSL. */ public void tcpSslContextFactory(String tcpSslCtxFactory) { - tcpSslContextFactory = tcpSslCtxFactory; + this.tcpSslCtxFactory = tcpSslCtxFactory; } /** {@inheritDoc} */ http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9c30477a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSpisConfiguration.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSpisConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSpisConfiguration.java index ff27163..4cd62e8 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSpisConfiguration.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSpisConfiguration.java @@ -76,7 +76,7 @@ public class VisorSpisConfiguration implements Serializable { * Methods with {@code Deprecated} annotation are skipped. * * @param spi SPI to collect information on. - * @return Tuple where first component is SPI name and + * @return Tuple where first component is SPI name and map with properties as second. */ private static IgniteBiTuple<String, Map<String, Object>> collectSpiInfo(IgniteSpi spi) { Class<? extends IgniteSpi> spiCls = spi.getClass(); @@ -127,6 +127,10 @@ public class VisorSpisConfiguration implements Serializable { return new IgniteBiTuple<String, Map<String, Object>>(spi.getName(), res); } + /** + * @param spis Array of spi to process. + * @return Tuple where first component is SPI name and map with properties as second. + */ private static IgniteBiTuple<String, Map<String, Object>>[] collectSpiInfo(IgniteSpi[] spis) { IgniteBiTuple[] res = new IgniteBiTuple[spis.length]; @@ -321,7 +325,8 @@ public class VisorSpisConfiguration implements Serializable { /** * @param indexingSpis New indexing SPIs. */ - public void indexingSpis(IgniteBiTuple<String, Map<String, Object>>... indexingSpis) { + @SafeVarargs + public final void indexingSpis(IgniteBiTuple<String, Map<String, Object>>... indexingSpis) { this.indexingSpis = indexingSpis; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9c30477a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorTransactionConfiguration.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorTransactionConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorTransactionConfiguration.java new file mode 100644 index 0000000..9f2c74a --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorTransactionConfiguration.java @@ -0,0 +1,153 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.apache.ignite.internal.visor.node; + +import org.apache.ignite.configuration.*; +import org.apache.ignite.internal.util.typedef.internal.*; +import org.apache.ignite.transactions.*; + +/** + * Data transfer object for transaction configuration. + */ +public class VisorTransactionConfiguration { + /** Default cache concurrency. */ + private IgniteTxConcurrency dfltConcurrency; + + /** Default transaction isolation. */ + private IgniteTxIsolation dfltIsolation; + + /** Default transaction timeout. */ + private long dfltTxTimeout; + + /** Pessimistic tx log linger. */ + private int pessimisticTxLogLinger; + + /** Pessimistic tx log size. */ + private int pessimisticTxLogSize; + + /** Default transaction serializable flag. */ + private boolean txSerEnabled; + + /** + * Create data transfer object for transaction configuration. + * + * @param src Transaction configuration. + * @return Data transfer object. + */ + public static VisorTransactionConfiguration from(TransactionConfiguration src) { + VisorTransactionConfiguration cfg = new VisorTransactionConfiguration(); + + cfg.defaultTxConcurrency(src.getDefaultTxConcurrency()); + cfg.defaultTxIsolation(src.getDefaultTxIsolation()); + cfg.defaultTxTimeout(src.getDefaultTxTimeout()); + cfg.pessimisticTxLogLinger(src.getPessimisticTxLogLinger()); + cfg.pessimisticTxLogSize(src.getPessimisticTxLogSize()); + cfg.txSerializableEnabled(src.isTxSerializableEnabled()); + + return cfg; + } + + /** + * @return Default cache transaction concurrency. + */ + public IgniteTxConcurrency defaultTxConcurrency() { + return dfltConcurrency; + } + + /** + * @param dfltConcurrency Default cache transaction concurrency. + */ + public void defaultTxConcurrency(IgniteTxConcurrency dfltConcurrency) { + this.dfltConcurrency = dfltConcurrency; + } + + /** + * @return Default cache transaction isolation. + */ + public IgniteTxIsolation defaultTxIsolation() { + return dfltIsolation; + } + + /** + * @param dfltIsolation Default cache transaction isolation. + */ + public void defaultTxIsolation(IgniteTxIsolation dfltIsolation) { + this.dfltIsolation = dfltIsolation; + } + + /** + * @return Default transaction timeout. + */ + public long defaultTxTimeout() { + return dfltTxTimeout; + } + + /** + * @param dfltTxTimeout Default transaction timeout. + */ + public void defaultTxTimeout(long dfltTxTimeout) { + this.dfltTxTimeout = dfltTxTimeout; + } + + /** + * @return Pessimistic log cleanup delay in milliseconds. + */ + public int pessimisticTxLogLinger() { + return pessimisticTxLogLinger; + } + + /** + * @param pessimisticTxLogLinger Pessimistic log cleanup delay. + */ + public void pessimisticTxLogLinger(int pessimisticTxLogLinger) { + this.pessimisticTxLogLinger = pessimisticTxLogLinger; + } + + /** + * @return Pessimistic transaction log size. + */ + public int getPessimisticTxLogSize() { + return pessimisticTxLogSize; + } + + /** + * @param pessimisticTxLogSize Pessimistic transactions log size. + */ + public void pessimisticTxLogSize(int pessimisticTxLogSize) { + this.pessimisticTxLogSize = pessimisticTxLogSize; + } + + /** + * @return {@code True} if serializable transactions are enabled, {@code false} otherwise. + */ + public boolean txSerializableEnabled() { + return txSerEnabled; + } + + /** + * @param txSerEnabled Flag to enable/disable serializable cache transactions. + */ + public void txSerializableEnabled(boolean txSerEnabled) { + this.txSerEnabled = txSerEnabled; + } + + /** {@inheritDoc} */ + @Override public String toString() { + return S.toString(VisorTransactionConfiguration.class, this); + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9c30477a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryCleanupTask.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryCleanupTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryCleanupTask.java index 5cf9c1b..060af20 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryCleanupTask.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryCleanupTask.java @@ -57,7 +57,7 @@ public class VisorQueryCleanupTask extends VisorMultiNodeTask<Map<UUID, Collecti } finally { if (debug) - logMapped(g.log(), getClass(), map.values()); + logMapped(ignite.log(), getClass(), map.values()); } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9c30477a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryTask.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryTask.java index 2213b43..8528214 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryTask.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryTask.java @@ -127,7 +127,7 @@ public class VisorQueryTask extends VisorOneNodeTask<VisorQueryTask.VisorQueryAr /** Next record from future. */ private final R next; - /** Flag indicating that this furure was read from last check. */ + /** Flag indicating that this future was read from last check. */ private Boolean accessed; /** @@ -156,7 +156,7 @@ public class VisorQueryTask extends VisorOneNodeTask<VisorQueryTask.VisorQueryAr } /** - * @return Flag indicating that this furure was read from last check.. + * @return Flag indicating that this future was read from last check.. */ public Boolean accessed() { return accessed; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9c30477a/modules/core/src/main/java/org/apache/ignite/internal/visor/streamer/VisorStreamerConfiguration.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/streamer/VisorStreamerConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/streamer/VisorStreamerConfiguration.java index fe44b70..7f23c3c 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/streamer/VisorStreamerConfiguration.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/streamer/VisorStreamerConfiguration.java @@ -49,7 +49,7 @@ public class VisorStreamerConfiguration implements Serializable { private int maxConcurrentSessions; /** Flag indicating whether streamer executor service should be shut down on Ignite stop. */ - private boolean executorServiceShutdown; + private boolean executorSrvcShutdown; /** * @param scfg Streamer configuration. @@ -160,7 +160,7 @@ public class VisorStreamerConfiguration implements Serializable { * @return Flag indicating whether streamer executor service should be shut down on Ignite stop. */ public boolean executorServiceShutdown() { - return executorServiceShutdown; + return executorSrvcShutdown; } /** @@ -168,7 +168,7 @@ public class VisorStreamerConfiguration implements Serializable { * on Ignite stop. */ public void executorServiceShutdown(boolean executorSrvcShutdown) { - executorServiceShutdown = executorSrvcShutdown; + this.executorSrvcShutdown = executorSrvcShutdown; } /** {@inheritDoc} */ http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9c30477a/modules/core/src/main/java/org/apache/ignite/internal/visor/streamer/VisorStreamerMetrics.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/streamer/VisorStreamerMetrics.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/streamer/VisorStreamerMetrics.java index a1ef9ad..bdf6e0b 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/streamer/VisorStreamerMetrics.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/streamer/VisorStreamerMetrics.java @@ -37,7 +37,7 @@ public class VisorStreamerMetrics implements Serializable { private int waiting; /** Stages execution capacity. */ - private int capacity; + private int cap; /** Pipeline minimum execution time. */ private long pipelineMinExecTm; @@ -151,14 +151,14 @@ public class VisorStreamerMetrics implements Serializable { * @return Stages execution capacity. */ public int capacity() { - return capacity; + return cap; } /** * @param cap New stages execution capacity. */ public void capacity(int cap) { - capacity = cap; + this.cap = cap; } /** http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9c30477a/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorMimeTypes.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorMimeTypes.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorMimeTypes.java index 9e450ac..acd56a9 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorMimeTypes.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorMimeTypes.java @@ -24,13 +24,13 @@ import java.io.*; import java.util.*; /** - * Helper class to get mimetype. + * Helper class to get MIME type. */ public class VisorMimeTypes { /** Bytes to read from file for mimetype detection. */ private static final int PREVIEW_SIZE = 11; - /** Common mimetypes. */ + /** Common MIME types. */ private static final Map<String, String> mimeTypes = U.newHashMap(810); static { @@ -840,6 +840,10 @@ public class VisorMimeTypes { mimeTypes.put("dssc", "application/dssc+der"); } + /** + * @param f File to detect content type. + * @return Content type. + */ @Nullable public static String getContentType(File f) { try (FileInputStream is = new FileInputStream(f)) { byte[] data = new byte[Math.min((int)f.length(), PREVIEW_SIZE)]; @@ -853,25 +857,30 @@ public class VisorMimeTypes { } } + /** + * @param data Bytes to detect content type. + * @param name File name to detect content type by file name. + * @return Content type. + */ @Nullable public static String getContentType(byte[] data, String name) { if (data == null) return null; - byte[] header = new byte[PREVIEW_SIZE]; + byte[] hdr = new byte[PREVIEW_SIZE]; - System.arraycopy(data, 0, header, 0, Math.min(data.length, header.length)); + System.arraycopy(data, 0, hdr, 0, Math.min(data.length, hdr.length)); - int c1 = header[0] & 0xff; - int c2 = header[1] & 0xff; - int c3 = header[2] & 0xff; - int c4 = header[3] & 0xff; - int c5 = header[4] & 0xff; - int c6 = header[5] & 0xff; - int c7 = header[6] & 0xff; - int c8 = header[7] & 0xff; - int c9 = header[8] & 0xff; - int c10 = header[9] & 0xff; - int c11 = header[10] & 0xff; + int c1 = hdr[0] & 0xff; + int c2 = hdr[1] & 0xff; + int c3 = hdr[2] & 0xff; + int c4 = hdr[3] & 0xff; + int c5 = hdr[4] & 0xff; + int c6 = hdr[5] & 0xff; + int c7 = hdr[6] & 0xff; + int c8 = hdr[7] & 0xff; + int c9 = hdr[8] & 0xff; + int c10 = hdr[9] & 0xff; + int c11 = hdr[10] & 0xff; if (c1 == 0xCA && c2 == 0xFE && c3 == 0xBA && c4 == 0xBE) return "application/java-vm"; @@ -879,8 +888,10 @@ public class VisorMimeTypes { if (c1 == 0xD0 && c2 == 0xCF && c3 == 0x11 && c4 == 0xE0 && c5 == 0xA1 && c6 == 0xB1 && c7 == 0x1A && c8 == 0xE1) { // if the name is set then check if it can be validated by name, because it could be a xls or powerpoint String contentType = guessContentTypeFromName(name); + if (contentType != null) return contentType; + return "application/msword"; } if (c1 == 0x25 && c2 == 0x50 && c3 == 0x44 && c4 == 0x46 && c5 == 0x2d && c6 == 0x31 && c7 == 0x2e) @@ -987,14 +998,18 @@ public class VisorMimeTypes { return guessContentTypeFromName(name); } + /** + * @param name File name to detect content type by file name. + * @return Content type. + */ @Nullable public static String guessContentTypeFromName(String name) { if (name == null) return null; - int lastIndex = name.lastIndexOf('.'); + int lastIdx = name.lastIndexOf('.'); - if (lastIndex != -1) { - String extention = name.substring(lastIndex + 1).toLowerCase(); + if (lastIdx != -1) { + String extention = name.substring(lastIdx + 1).toLowerCase(); return mimeTypes.get(extention); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9c30477a/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java index 4f54e50..728b569 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java @@ -94,6 +94,7 @@ public class VisorTaskUtils { /** Maximum folder depth. I.e. if depth is 4 we look in starting folder and 3 levels of sub-folders. */ public static final int MAX_FOLDER_DEPTH = 4; + /** Comparator for log files by last modified date. */ private static final Comparator<VisorLogFile> LAST_MODIFIED = new Comparator<VisorLogFile>() { @Override public int compare(VisorLogFile f1, VisorLogFile f2) { return Long.compare(f2.lastModified(), f1.lastModified()); @@ -135,12 +136,12 @@ public class VisorTaskUtils { assert arrays != null; assert arrays.length > 1; - int length = 0; + int len = 0; for (int[] a : arrays) - length += a.length; + len += a.length; - int[] r = Arrays.copyOf(arrays[0], length); + int[] r = Arrays.copyOf(arrays[0], len); for (int i = 1, shift = 0; i < arrays.length; i++) { shift += arrays[i - 1].length; @@ -173,9 +174,8 @@ public class VisorTaskUtils { int i = 0; - for (Object elm : col) { + for (Object elm : col) res[i++] = compactObject(elm); - } return res; } @@ -446,6 +446,11 @@ public class VisorTaskUtils { return F.asList(new VisorLogFile(file)); } + /** + * @param fld Folder with files to match. + * @param ptrn Pattern to match against file name. + * @return Collection of matched files. + */ public static List<VisorLogFile> matchedFiles(File fld, final String ptrn) { List<VisorLogFile> files = fileTree(fld, MAX_FOLDER_DEPTH, new FileFilter() { @@ -483,6 +488,13 @@ public class VisorTaskUtils { return false; } + /** + * Decode file charset. + * + * @param f File to process. + * @return File charset. + * @throws IOException + */ public static Charset decode(File f) throws IOException { SortedMap<String, Charset> charsets = Charset.availableCharsets(); @@ -497,11 +509,11 @@ public class VisorTaskUtils { orderedCharsets.addAll(charsets.values()); try (RandomAccessFile raf = new RandomAccessFile(f, "r")) { - FileChannel channel = raf.getChannel(); + FileChannel ch = raf.getChannel(); ByteBuffer buf = ByteBuffer.allocate(4096); - channel.read(buf); + ch.read(buf); buf.flip(); @@ -597,18 +609,18 @@ public class VisorTaskUtils { /** * Extract max size from eviction policy if available. * - * @param policy Eviction policy. + * @param plc Eviction policy. * @return Extracted max size. */ - public static Integer evictionPolicyMaxSize(CacheEvictionPolicy policy) { - if (policy instanceof CacheLruEvictionPolicyMBean) - return ((CacheLruEvictionPolicyMBean)policy).getMaxSize(); + public static Integer evictionPolicyMaxSize(CacheEvictionPolicy plc) { + if (plc instanceof CacheLruEvictionPolicyMBean) + return ((CacheLruEvictionPolicyMBean)plc).getMaxSize(); - if (policy instanceof CacheRandomEvictionPolicyMBean) - return ((CacheRandomEvictionPolicyMBean)policy).getMaxSize(); + if (plc instanceof CacheRandomEvictionPolicyMBean) + return ((CacheRandomEvictionPolicyMBean)plc).getMaxSize(); - if (policy instanceof CacheFifoEvictionPolicyMBean) - return ((CacheFifoEvictionPolicyMBean)policy).getMaxSize(); + if (plc instanceof CacheFifoEvictionPolicyMBean) + return ((CacheFifoEvictionPolicyMBean)plc).getMaxSize(); return null; } @@ -736,11 +748,11 @@ public class VisorTaskUtils { String cmd = String.format("ping -%s 1 %s", U.isWindows() ? "n" : "c", addr.getHostAddress()); - Process myProcess = Runtime.getRuntime().exec(cmd); + Process myProc = Runtime.getRuntime().exec(cmd); - myProcess.waitFor(); + myProc.waitFor(); - return myProcess.exitValue() == 0; + return myProc.exitValue() == 0; } catch (IOException ignore) { return false; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9c30477a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala ---------------------------------------------------------------------- diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala index 1fd989b..775a696 100644 --- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala +++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala @@ -775,7 +775,6 @@ object VisorCacheCommand { val preloadCfg = cfg.preloadConfiguration() val evictCfg = cfg.evictConfiguration() val defaultCfg = cfg.defaultConfiguration() - val dgcCfg = cfg.dgcConfiguration() val storeCfg = cfg.storeConfiguration() val writeBehind = cfg.writeBehind() @@ -840,10 +839,6 @@ object VisorCacheCommand { cacheT += ("Indexing SPI Name", cfg.indexingSpiName()) cacheT += ("Cache Interceptor", cfg.interceptor()) - cacheT += ("DGC Frequency", dgcCfg.frequency()) - cacheT += ("DGC Remove Locks Flag", dgcCfg.removedLocks()) - cacheT += ("DGC Suspect Lock Timeout", dgcCfg.suspectLockTimeout()) - cacheT += ("Store Enabled", storeCfg.enabled()) cacheT += ("Store", storeCfg.store()) cacheT += ("Store Values In Bytes", storeCfg.valueBytes()) http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9c30477a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/config/VisorConfigurationCommand.scala ---------------------------------------------------------------------- diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/config/VisorConfigurationCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/config/VisorConfigurationCommand.scala index 463e41d..afa1023 100644 --- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/config/VisorConfigurationCommand.scala +++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/config/VisorConfigurationCommand.scala @@ -323,10 +323,12 @@ class VisorConfigurationCommand { val execCfg = cfg.executeService() - execSvcT += ("Executor service", safe(execCfg.executeService(), DFLT)) - execSvcT += ("System executor service", safe(execCfg.systemExecutorService(), DFLT)) - execSvcT += ("Peer-to-Peer executor service", safe(execCfg.p2pExecutorService(), DFLT)) - execSvcT += ("REST Executor Service", safe(execCfg.restExecutorService(), DFLT)) + execSvcT += ("Public thread pool size", safe(execCfg.publicThreadPoolSize(), DFLT)) + execSvcT += ("System thread pool size", safe(execCfg.systemThreadPoolSize(), DFLT)) + execSvcT += ("Management thread pool size", safe(execCfg.managementThreadPoolSize(), DFLT)) + execSvcT += ("IGFS thread pool size", safe(execCfg.igfsThreadPoolSize(), DFLT)) + execSvcT += ("Peer-to-Peer thread pool size", safe(execCfg.peerClassLoadingThreadPoolSize(), DFLT)) + execSvcT += ("REST thread pool size", safe(execCfg.restThreadPoolSize(), DFLT)) execSvcT.render()