You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ag...@apache.org on 2017/04/14 15:27:56 UTC
[31/44] ignite git commit: IGNITE-4988 Cleanup and refactor VisorXxx
tasks and DTO for ignite-2.0
http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/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 81c09b9..5018f43 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
@@ -17,14 +17,18 @@
package org.apache.ignite.internal.visor.node;
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
-import org.apache.ignite.internal.LessNamingBean;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
import org.apache.ignite.internal.visor.cache.VisorCache;
import org.apache.ignite.internal.visor.event.VisorGridEvent;
import org.apache.ignite.internal.visor.igfs.VisorIgfs;
@@ -34,7 +38,7 @@ import org.apache.ignite.internal.visor.util.VisorExceptionWrapper;
/**
* Data collector task result.
*/
-public class VisorNodeDataCollectorTaskResult implements Serializable, LessNamingBean {
+public class VisorNodeDataCollectorTaskResult extends VisorDataTransferObject {
/** */
private static final long serialVersionUID = 0L;
@@ -42,47 +46,54 @@ public class VisorNodeDataCollectorTaskResult implements Serializable, LessNamin
private boolean active;
/** Unhandled exceptions from nodes. */
- private final Map<UUID, VisorExceptionWrapper> unhandledEx = new HashMap<>();
+ private Map<UUID, VisorExceptionWrapper> unhandledEx = new HashMap<>();
/** Nodes grid names. */
- private final Map<UUID, String> igniteInstanceNames = new HashMap<>();
+ private Map<UUID, String> gridNames = new HashMap<>();
/** Nodes topology versions. */
- private final Map<UUID, Long> topVersions = new HashMap<>();
+ private Map<UUID, Long> topVersions = new HashMap<>();
/** All task monitoring state collected from nodes. */
- private final Map<UUID, Boolean> taskMonitoringEnabled = new HashMap<>();
+ private Map<UUID, Boolean> taskMonitoringEnabled = new HashMap<>();
/** Nodes error counts. */
- private final Map<UUID, Long> errCnts = new HashMap<>();
+ private Map<UUID, Long> errCnts = new HashMap<>();
/** All events collected from nodes. */
- private final List<VisorGridEvent> evts = new ArrayList<>();
+ private List<VisorGridEvent> evts = new ArrayList<>();
/** Exceptions caught during collecting events from nodes. */
- private final Map<UUID, VisorExceptionWrapper> evtsEx = new HashMap<>();
+ private Map<UUID, VisorExceptionWrapper> evtsEx = new HashMap<>();
/** All caches collected from nodes. */
- private final Map<UUID, Collection<VisorCache>> caches = new HashMap<>();
+ private Map<UUID, Collection<VisorCache>> caches = new HashMap<>();
/** Exceptions caught during collecting caches from nodes. */
- private final Map<UUID, VisorExceptionWrapper> cachesEx = new HashMap<>();
+ private Map<UUID, VisorExceptionWrapper> cachesEx = new HashMap<>();
/** All IGFS collected from nodes. */
- private final Map<UUID, Collection<VisorIgfs>> igfss = new HashMap<>();
+ private Map<UUID, Collection<VisorIgfs>> igfss = new HashMap<>();
/** All IGFS endpoints collected from nodes. */
- private final Map<UUID, Collection<VisorIgfsEndpoint>> igfsEndpoints = new HashMap<>();
+ private Map<UUID, Collection<VisorIgfsEndpoint>> igfsEndpoints = new HashMap<>();
/** Exceptions caught during collecting IGFS from nodes. */
- private final Map<UUID, VisorExceptionWrapper> igfssEx = new HashMap<>();
+ private Map<UUID, VisorExceptionWrapper> igfssEx = new HashMap<>();
+
+ /**
+ * Default constructor.
+ */
+ public VisorNodeDataCollectorTaskResult() {
+ // No-op.
+ }
/**
* @return {@code true} If no data was collected.
*/
public boolean isEmpty() {
return
- igniteInstanceNames.isEmpty() &&
+ gridNames.isEmpty() &&
topVersions.isEmpty() &&
unhandledEx.isEmpty() &&
taskMonitoringEnabled.isEmpty() &&
@@ -112,84 +123,123 @@ public class VisorNodeDataCollectorTaskResult implements Serializable, LessNamin
/**
* @return Unhandled exceptions from nodes.
*/
- public Map<UUID, VisorExceptionWrapper> unhandledEx() {
+ public Map<UUID, VisorExceptionWrapper> getUnhandledEx() {
return unhandledEx;
}
/**
- * @return Nodes Ignite instance names.
+ * @return Nodes grid names.
*/
- public Map<UUID, String> igniteInstanceNames() {
- return igniteInstanceNames;
+ public Map<UUID, String> getGridNames() {
+ return gridNames;
}
/**
* @return Nodes topology versions.
*/
- public Map<UUID, Long> topologyVersions() {
+ public Map<UUID, Long> getTopologyVersions() {
return topVersions;
}
/**
* @return All task monitoring state collected from nodes.
*/
- public Map<UUID, Boolean> taskMonitoringEnabled() {
+ public Map<UUID, Boolean> isTaskMonitoringEnabled() {
return taskMonitoringEnabled;
}
/**
* @return All events collected from nodes.
*/
- public List<VisorGridEvent> events() {
+ public List<VisorGridEvent> getEvents() {
return evts;
}
/**
* @return Exceptions caught during collecting events from nodes.
*/
- public Map<UUID, VisorExceptionWrapper> eventsEx() {
+ public Map<UUID, VisorExceptionWrapper> getEventsEx() {
return evtsEx;
}
/**
* @return All caches collected from nodes.
*/
- public Map<UUID, Collection<VisorCache>> caches() {
+ public Map<UUID, Collection<VisorCache>> getCaches() {
return caches;
}
/**
* @return Exceptions caught during collecting caches from nodes.
*/
- public Map<UUID, VisorExceptionWrapper> cachesEx() {
+ public Map<UUID, VisorExceptionWrapper> getCachesEx() {
return cachesEx;
}
/**
* @return All IGFS collected from nodes.
*/
- public Map<UUID, Collection<VisorIgfs>> igfss() {
+ public Map<UUID, Collection<VisorIgfs>> getIgfss() {
return igfss;
}
/**
* @return All IGFS endpoints collected from nodes.
*/
- public Map<UUID, Collection<VisorIgfsEndpoint>> igfsEndpoints() {
+ public Map<UUID, Collection<VisorIgfsEndpoint>> getIgfsEndpoints() {
return igfsEndpoints;
}
/**
* @return Exceptions caught during collecting IGFS from nodes.
*/
- public Map<UUID, VisorExceptionWrapper> igfssEx() {
+ public Map<UUID, VisorExceptionWrapper> getIgfssEx() {
return igfssEx;
}
/**
* @return Nodes error counts.
*/
- public Map<UUID, Long> errorCounts() {
+ public Map<UUID, Long> getErrorCounts() {
return errCnts;
}
+
+ /** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ out.writeBoolean(active);
+ U.writeMap(out, unhandledEx);
+ U.writeMap(out, gridNames);
+ U.writeMap(out, topVersions);
+ U.writeMap(out, taskMonitoringEnabled);
+ U.writeMap(out, errCnts);
+ U.writeCollection(out, evts);
+ U.writeMap(out, evtsEx);
+ U.writeMap(out, caches);
+ U.writeMap(out, cachesEx);
+ U.writeMap(out, igfss);
+ U.writeMap(out, igfsEndpoints);
+ U.writeMap(out, igfssEx);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+ active = in.readBoolean();
+ unhandledEx = U.readMap(in);
+ gridNames = U.readMap(in);
+ topVersions = U.readMap(in);
+ taskMonitoringEnabled = U.readMap(in);
+ errCnts = U.readMap(in);
+ evts = U.readList(in);
+ evtsEx = U.readMap(in);
+ caches = U.readMap(in);
+ cachesEx = U.readMap(in);
+ igfss = U.readMap(in);
+ igfsEndpoints = U.readMap(in);
+ igfssEx = U.readMap(in);
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorNodeDataCollectorTaskResult.class, this);
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/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 f219908..bb6c83e 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
@@ -17,7 +17,6 @@
package org.apache.ignite.internal.visor.node;
-import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -38,18 +37,14 @@ import org.apache.ignite.internal.visor.util.VisorEventMapper;
import org.apache.ignite.lang.IgniteClosure;
import org.apache.ignite.lang.IgnitePredicate;
import org.apache.ignite.lang.IgniteUuid;
-import org.jetbrains.annotations.Nullable;
-import static org.apache.ignite.events.EventType.EVTS_JOB_EXECUTION;
-import static org.apache.ignite.events.EventType.EVTS_TASK_EXECUTION;
import static org.apache.ignite.internal.visor.util.VisorTaskUtils.EVT_MAPPER;
-import static org.apache.ignite.internal.visor.util.VisorTaskUtils.concat;
/**
* Task that runs on specified node and returns events data.
*/
@GridInternal
-public class VisorNodeEventsCollectorTask extends VisorMultiNodeTask<VisorNodeEventsCollectorTask.VisorNodeEventsCollectorTaskArg,
+public class VisorNodeEventsCollectorTask extends VisorMultiNodeTask<VisorNodeEventsCollectorTaskArg,
Iterable<? extends VisorGridEvent>, Collection<? extends VisorGridEvent>> {
/** */
private static final long serialVersionUID = 0L;
@@ -72,114 +67,6 @@ public class VisorNodeEventsCollectorTask extends VisorMultiNodeTask<VisorNodeEv
}
/**
- * Argument for task returns events data.
- */
- @SuppressWarnings("PublicInnerClass")
- public static class VisorNodeEventsCollectorTaskArg implements Serializable {
- /** */
- private static final long serialVersionUID = 0L;
-
- /** Node local storage key. */
- private final String keyOrder;
-
- /** Arguments for type filter. */
- private final int[] typeArg;
-
- /** Arguments for time filter. */
- private final Long timeArg;
-
- /** Task or job events with task name contains. */
- private final String taskName;
-
- /** Task or job events with session. */
- 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 taskSesId Arguments for task session filter.
- */
- public VisorNodeEventsCollectorTaskArg(@Nullable String keyOrder, @Nullable int[] typeArg,
- @Nullable Long timeArg,
- @Nullable String taskName, @Nullable IgniteUuid taskSesId) {
- this.keyOrder = keyOrder;
- this.typeArg = typeArg;
- this.timeArg = timeArg;
- this.taskName = taskName;
- this.taskSesId = taskSesId;
- }
-
- /**
- * @param typeArg Arguments for type filter.
- * @param timeArg Arguments for time filter.
- */
- public static VisorNodeEventsCollectorTaskArg createEventsArg(@Nullable int[] typeArg, @Nullable Long timeArg) {
- return new VisorNodeEventsCollectorTaskArg(null, typeArg, timeArg, null, null);
- }
-
- /**
- * @param timeArg Arguments for time filter.
- * @param taskName Arguments for task name filter.
- * @param taskSesId Arguments for task session filter.
- */
- public static VisorNodeEventsCollectorTaskArg createTasksArg(@Nullable Long timeArg, @Nullable String taskName,
- @Nullable IgniteUuid taskSesId) {
- return new VisorNodeEventsCollectorTaskArg(null, concat(EVTS_JOB_EXECUTION, EVTS_TASK_EXECUTION),
- timeArg, taskName, taskSesId);
- }
-
- /**
- * @param keyOrder Arguments for node local storage key.
- * @param typeArg Arguments for type filter.
- */
- public static VisorNodeEventsCollectorTaskArg createLogArg(@Nullable String keyOrder, @Nullable int[] typeArg) {
- return new VisorNodeEventsCollectorTaskArg(keyOrder, typeArg, null, null, null);
- }
-
- /**
- * @return Node local storage key.
- */
- @Nullable public String keyOrder() {
- return keyOrder;
- }
-
- /**
- * @return Arguments for type filter.
- */
- public int[] typeArgument() {
- return typeArg;
- }
-
- /**
- * @return Arguments for time filter.
- */
- public Long timeArgument() {
- return timeArg;
- }
-
- /**
- * @return Task or job events with task name contains.
- */
- public String taskName() {
- return taskName;
- }
-
- /**
- * @return Task or job events with session.
- */
- public IgniteUuid taskSessionId() {
- return taskSesId;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return S.toString(VisorNodeEventsCollectorTaskArg.class, this);
- }
- }
-
- /**
* Job for task returns events data.
*/
protected static class VisorNodeEventsCollectorJob extends VisorJob<VisorNodeEventsCollectorTaskArg,
@@ -279,12 +166,12 @@ public class VisorNodeEventsCollectorTask extends VisorMultiNodeTask<VisorNodeEv
/** {@inheritDoc} */
@Override protected Collection<? extends VisorGridEvent> run(final VisorNodeEventsCollectorTaskArg arg) {
- final long startEvtTime = arg.timeArgument() == null ? 0L : System.currentTimeMillis() - arg.timeArgument();
+ final long startEvtTime = arg.getTimeArgument() == null ? 0L : System.currentTimeMillis() - arg.getTimeArgument();
final ConcurrentMap<String, Long> nl = ignite.cluster().nodeLocalMap();
- final Long startEvtOrder = arg.keyOrder() != null && nl.containsKey(arg.keyOrder()) ?
- nl.get(arg.keyOrder()) : -1L;
+ final Long startEvtOrder = arg.getKeyOrder() != null && nl.containsKey(arg.getKeyOrder()) ?
+ nl.get(arg.getKeyOrder()) : -1L;
Collection<Event> evts = ignite.events().localQuery(new IgnitePredicate<Event>() {
/** */
@@ -292,10 +179,10 @@ public class VisorNodeEventsCollectorTask extends VisorMultiNodeTask<VisorNodeEv
@Override public boolean apply(Event evt) {
return evt.localOrder() > startEvtOrder &&
- (arg.typeArgument() == null || F.contains(arg.typeArgument(), evt.type())) &&
+ (arg.getTypeArgument() == null || F.contains(arg.getTypeArgument(), evt.type())) &&
(evt.timestamp() >= startEvtTime) &&
- (arg.taskName() == null || filterByTaskName(evt, arg.taskName())) &&
- (arg.taskSessionId() == null || filterByTaskSessionId(evt, arg.taskSessionId()));
+ (arg.getTaskName() == null || filterByTaskName(evt, arg.getTaskName())) &&
+ (arg.getTaskSessionId() == null || filterByTaskSessionId(evt, arg.getTaskSessionId()));
}
});
@@ -319,8 +206,8 @@ public class VisorNodeEventsCollectorTask extends VisorMultiNodeTask<VisorNodeEv
}
// Update latest order in node local, if not empty.
- if (arg.keyOrder() != null && !res.isEmpty())
- nl.put(arg.keyOrder(), maxOrder);
+ if (arg.getKeyOrder() != null && !res.isEmpty())
+ nl.put(arg.getKeyOrder(), maxOrder);
return res;
}
@@ -330,4 +217,4 @@ public class VisorNodeEventsCollectorTask extends VisorMultiNodeTask<VisorNodeEv
return S.toString(VisorNodeEventsCollectorJob.class, this);
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeEventsCollectorTaskArg.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeEventsCollectorTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeEventsCollectorTaskArg.java
new file mode 100644
index 0000000..c2e6b4a
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeEventsCollectorTaskArg.java
@@ -0,0 +1,163 @@
+/*
+ * 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 java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
+import org.apache.ignite.lang.IgniteUuid;
+import org.jetbrains.annotations.Nullable;
+
+import static org.apache.ignite.events.EventType.EVTS_JOB_EXECUTION;
+import static org.apache.ignite.events.EventType.EVTS_TASK_EXECUTION;
+import static org.apache.ignite.internal.visor.util.VisorTaskUtils.concat;
+
+/**
+ * Argument for task returns events data.
+ */
+public class VisorNodeEventsCollectorTaskArg extends VisorDataTransferObject {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Node local storage key. */
+ private String keyOrder;
+
+ /** Arguments for type filter. */
+ private int[] typeArg;
+
+ /** Arguments for time filter. */
+ private Long timeArg;
+
+ /** Task or job events with task name contains. */
+ private String taskName;
+
+ /** Task or job events with session. */
+ private IgniteUuid taskSesId;
+
+ /**
+ * Default constructor.
+ */
+ public VisorNodeEventsCollectorTaskArg() {
+ // No-op.
+ }
+
+ /**
+ * @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 taskSesId Arguments for task session filter.
+ */
+ public VisorNodeEventsCollectorTaskArg(@Nullable String keyOrder, @Nullable int[] typeArg,
+ @Nullable Long timeArg,
+ @Nullable String taskName, @Nullable IgniteUuid taskSesId) {
+ this.keyOrder = keyOrder;
+ this.typeArg = typeArg;
+ this.timeArg = timeArg;
+ this.taskName = taskName;
+ this.taskSesId = taskSesId;
+ }
+
+ /**
+ * @param typeArg Arguments for type filter.
+ * @param timeArg Arguments for time filter.
+ */
+ public static VisorNodeEventsCollectorTaskArg createEventsArg(@Nullable int[] typeArg, @Nullable Long timeArg) {
+ return new VisorNodeEventsCollectorTaskArg(null, typeArg, timeArg, null, null);
+ }
+
+ /**
+ * @param timeArg Arguments for time filter.
+ * @param taskName Arguments for task name filter.
+ * @param taskSesId Arguments for task session filter.
+ */
+ public static VisorNodeEventsCollectorTaskArg createTasksArg(@Nullable Long timeArg, @Nullable String taskName,
+ @Nullable IgniteUuid taskSesId) {
+ return new VisorNodeEventsCollectorTaskArg(null, concat(EVTS_JOB_EXECUTION, EVTS_TASK_EXECUTION),
+ timeArg, taskName, taskSesId);
+ }
+
+ /**
+ * @param keyOrder Arguments for node local storage key.
+ * @param typeArg Arguments for type filter.
+ */
+ public static VisorNodeEventsCollectorTaskArg createLogArg(@Nullable String keyOrder, @Nullable int[] typeArg) {
+ return new VisorNodeEventsCollectorTaskArg(keyOrder, typeArg, null, null, null);
+ }
+
+ /**
+ * @return Node local storage key.
+ */
+ @Nullable public String getKeyOrder() {
+ return keyOrder;
+ }
+
+ /**
+ * @return Arguments for type filter.
+ */
+ public int[] getTypeArgument() {
+ return typeArg;
+ }
+
+ /**
+ * @return Arguments for time filter.
+ */
+ public Long getTimeArgument() {
+ return timeArg;
+ }
+
+ /**
+ * @return Task or job events with task name contains.
+ */
+ public String getTaskName() {
+ return taskName;
+ }
+
+ /**
+ * @return Task or job events with session.
+ */
+ public IgniteUuid getTaskSessionId() {
+ return taskSesId;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ U.writeString(out, keyOrder);
+ out.writeObject(typeArg);
+ out.writeObject(timeArg);
+ U.writeString(out, taskName);
+ U.writeGridUuid(out, taskSesId);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+ keyOrder = U.readString(in);
+ typeArg = (int[])in.readObject();
+ timeArg = (Long)in.readObject();
+ taskName = U.readString(in);
+ taskSesId = U.readGridUuid(in);
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorNodeEventsCollectorTaskArg.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeGcTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeGcTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeGcTask.java
index 42afc73..bdc1104 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeGcTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeGcTask.java
@@ -28,15 +28,13 @@ import org.apache.ignite.internal.processors.task.GridInternal;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.visor.VisorJob;
import org.apache.ignite.internal.visor.VisorMultiNodeTask;
-import org.apache.ignite.lang.IgniteBiTuple;
import org.jetbrains.annotations.Nullable;
/**
* Task to run gc on nodes.
*/
@GridInternal
-public class VisorNodeGcTask extends VisorMultiNodeTask<Void, Map<UUID, IgniteBiTuple<Long, Long>>,
- IgniteBiTuple<Long, Long>> {
+public class VisorNodeGcTask extends VisorMultiNodeTask<Void, Map<UUID, VisorNodeGcTaskResult>, VisorNodeGcTaskResult> {
/** */
private static final long serialVersionUID = 0L;
@@ -46,11 +44,11 @@ public class VisorNodeGcTask extends VisorMultiNodeTask<Void, Map<UUID, IgniteBi
}
/** {@inheritDoc} */
- @Nullable @Override protected Map<UUID, IgniteBiTuple<Long, Long>> reduce0(List<ComputeJobResult> results) {
- Map<UUID, IgniteBiTuple<Long, Long>> total = new HashMap<>();
+ @Nullable @Override protected Map<UUID, VisorNodeGcTaskResult> reduce0(List<ComputeJobResult> results) {
+ Map<UUID, VisorNodeGcTaskResult> total = new HashMap<>();
for (ComputeJobResult res : results) {
- IgniteBiTuple<Long, Long> jobRes = res.getData();
+ VisorNodeGcTaskResult jobRes = res.getData();
total.put(res.getNode().id(), jobRes);
}
@@ -59,7 +57,7 @@ public class VisorNodeGcTask extends VisorMultiNodeTask<Void, Map<UUID, IgniteBi
}
/** Job that perform GC on node. */
- private static class VisorNodeGcJob extends VisorJob<Void, IgniteBiTuple<Long, Long>> {
+ private static class VisorNodeGcJob extends VisorJob<Void, VisorNodeGcTaskResult> {
/** */
private static final long serialVersionUID = 0L;
@@ -74,14 +72,14 @@ public class VisorNodeGcTask extends VisorMultiNodeTask<Void, Map<UUID, IgniteBi
}
/** {@inheritDoc} */
- @Override protected IgniteBiTuple<Long, Long> run(Void arg) {
+ @Override protected VisorNodeGcTaskResult run(Void arg) {
ClusterNode locNode = ignite.localNode();
long before = freeHeap(locNode);
System.gc();
- return new IgniteBiTuple<>(before, freeHeap(locNode));
+ return new VisorNodeGcTaskResult(before, freeHeap(locNode));
}
/**
@@ -99,4 +97,4 @@ public class VisorNodeGcTask extends VisorMultiNodeTask<Void, Map<UUID, IgniteBi
return S.toString(VisorNodeGcJob.class, this);
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeGcTaskResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeGcTaskResult.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeGcTaskResult.java
new file mode 100644
index 0000000..eb12ef7
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeGcTaskResult.java
@@ -0,0 +1,85 @@
+/*
+ * 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 java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
+
+/**
+ * Argument for task returns GC execution results.
+ */
+public class VisorNodeGcTaskResult extends VisorDataTransferObject {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Size before GC execution. */
+ private long sizeBefore;
+
+ /** Size after GC execution. */
+ private long sizeAfter;
+
+ /**
+ * Default constructor.
+ */
+ public VisorNodeGcTaskResult() {
+ // No-op.
+ }
+
+ /**
+ * @param sizeBefore Size before GC execution.
+ * @param sizeAfter Size after GC execution.
+ */
+ public VisorNodeGcTaskResult(long sizeBefore, long sizeAfter) {
+ this.sizeBefore = sizeBefore;
+ this.sizeAfter = sizeAfter;
+ }
+
+ /**
+ * @return Size before GC execution.
+ */
+ public Long getSizeBefore() {
+ return sizeBefore;
+ }
+
+ /**
+ * @return Size after GC execution.
+ */
+ public Long getSizeAfter() {
+ return sizeAfter;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ out.writeLong(sizeBefore);
+ out.writeLong(sizeAfter);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+ sizeBefore = in.readLong();
+ sizeAfter = in.readLong();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorNodeGcTaskResult.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodePingTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodePingTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodePingTask.java
index f59ea01..6169dcb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodePingTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodePingTask.java
@@ -22,7 +22,6 @@ import java.util.UUID;
import org.apache.ignite.cluster.ClusterTopologyException;
import org.apache.ignite.compute.ComputeJobResult;
import org.apache.ignite.internal.processors.task.GridInternal;
-import org.apache.ignite.internal.util.lang.GridTuple3;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.visor.VisorJob;
import org.apache.ignite.internal.visor.VisorOneNodeTask;
@@ -32,7 +31,7 @@ import org.jetbrains.annotations.Nullable;
* Ping other node.
*/
@GridInternal
-public class VisorNodePingTask extends VisorOneNodeTask<UUID, GridTuple3<Boolean, Long, Long>> {
+public class VisorNodePingTask extends VisorOneNodeTask<UUID, VisorNodePingTaskResult> {
/** */
private static final long serialVersionUID = 0L;
@@ -42,19 +41,19 @@ public class VisorNodePingTask extends VisorOneNodeTask<UUID, GridTuple3<Boolean
}
/** {@inheritDoc} */
- @Nullable @Override protected GridTuple3<Boolean, Long, Long> reduce0(List<ComputeJobResult> results) {
+ @Nullable @Override protected VisorNodePingTaskResult reduce0(List<ComputeJobResult> results) {
try {
return super.reduce0(results);
}
catch (ClusterTopologyException ignored) {
- return new GridTuple3<>(false, -1L, -1L);
+ return new VisorNodePingTaskResult(false, -1L, -1L);
}
}
/**
* Job that ping node.
*/
- private static class VisorNodePingJob extends VisorJob<UUID, GridTuple3<Boolean, Long, Long>> {
+ private static class VisorNodePingJob extends VisorJob<UUID, VisorNodePingTaskResult> {
/** */
private static final long serialVersionUID = 0L;
@@ -67,10 +66,10 @@ public class VisorNodePingTask extends VisorOneNodeTask<UUID, GridTuple3<Boolean
}
/** {@inheritDoc} */
- @Override protected GridTuple3<Boolean, Long, Long> run(UUID nodeToPing) {
+ @Override protected VisorNodePingTaskResult run(UUID nodeToPing) {
long start = System.currentTimeMillis();
- return new GridTuple3<>(ignite.cluster().pingNode(nodeToPing), start, System.currentTimeMillis());
+ return new VisorNodePingTaskResult(ignite.cluster().pingNode(nodeToPing), start, System.currentTimeMillis());
}
/** {@inheritDoc} */
@@ -78,4 +77,4 @@ public class VisorNodePingTask extends VisorOneNodeTask<UUID, GridTuple3<Boolean
return S.toString(VisorNodePingJob.class, this);
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodePingTaskResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodePingTaskResult.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodePingTaskResult.java
new file mode 100644
index 0000000..5328f65
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodePingTaskResult.java
@@ -0,0 +1,99 @@
+/*
+ * 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 java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
+
+/**
+ * Result for {@link VisorNodePingTask}.
+ */
+public class VisorNodePingTaskResult extends VisorDataTransferObject {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Node alive. */
+ private boolean alive;
+
+ /** Ping start time. */
+ private long startTime;
+
+ /** Ping finish time. */
+ private long finishTime;
+
+ /**
+ * Default constructor.
+ */
+ public VisorNodePingTaskResult() {
+ // No-op.
+ }
+
+ /**
+ * @param alive Node alive.
+ * @param startTime Ping start time.
+ * @param finishTime Ping finish time.
+ */
+ public VisorNodePingTaskResult(boolean alive, long startTime, long finishTime) {
+ this.alive = alive;
+ this.startTime = startTime;
+ this.finishTime = finishTime;
+ }
+
+ /**
+ * @return Node alive.
+ */
+ public boolean isAlive() {
+ return alive;
+ }
+
+ /**
+ * @return Ping start time.
+ */
+ public long getStartTime() {
+ return startTime;
+ }
+
+ /**
+ * @return Ping finish time.
+ */
+ public long getFinishTime() {
+ return finishTime;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ out.writeBoolean(alive);
+ out.writeLong(startTime);
+ out.writeLong(finishTime);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+ alive = in.readBoolean();
+ startTime = in.readLong();
+ finishTime = in.readLong();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorNodePingTaskResult.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeSuppressedErrors.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeSuppressedErrors.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeSuppressedErrors.java
new file mode 100644
index 0000000..482adce
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeSuppressedErrors.java
@@ -0,0 +1,89 @@
+/*
+ * 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 java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.List;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
+
+/**
+ * Create data transfer object for node's suppressed errors.
+ */
+public class VisorNodeSuppressedErrors extends VisorDataTransferObject {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Order number of last suppressed error. */
+ private Long order;
+
+ /** List of suppressed errors. */
+ private List<VisorSuppressedError> errors;
+
+ /**
+ * Default constructor.
+ */
+ public VisorNodeSuppressedErrors() {
+ // No-op.
+ }
+
+ /**
+ * Create data transfer object for node's suppressed errors.
+ *
+ * @param order Order number of last suppressed error.
+ * @param errors List of suppressed errors.
+ */
+ public VisorNodeSuppressedErrors(Long order, List<VisorSuppressedError> errors) {
+ this.order = order;
+ this.errors = errors;
+ }
+
+ /**
+ * @return Order number of last suppressed error.
+ */
+ public Long getOrder() {
+ return order;
+ }
+
+ /**
+ * @return List of suppressed errors.
+ */
+ public List<VisorSuppressedError> getErrors() {
+ return errors;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ out.writeLong(order);
+ U.writeCollection(out, errors);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+ order = in.readLong();
+ errors = U.readList(in);
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorNodeSuppressedErrors.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeSuppressedErrorsTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeSuppressedErrorsTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeSuppressedErrorsTask.java
index 1f673ca..c7b9cf7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeSuppressedErrorsTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeSuppressedErrorsTask.java
@@ -29,7 +29,6 @@ import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.visor.VisorJob;
import org.apache.ignite.internal.visor.VisorMultiNodeTask;
import org.apache.ignite.internal.visor.util.VisorExceptionWrapper;
-import org.apache.ignite.lang.IgniteBiTuple;
import org.jetbrains.annotations.Nullable;
/**
@@ -37,8 +36,7 @@ import org.jetbrains.annotations.Nullable;
*/
@GridInternal
public class VisorNodeSuppressedErrorsTask extends VisorMultiNodeTask<Map<UUID, Long>,
- Map<UUID, IgniteBiTuple<Long, List<IgniteExceptionRegistry.ExceptionInfo>>>,
- IgniteBiTuple<Long, List<IgniteExceptionRegistry.ExceptionInfo>>> {
+ Map<UUID, VisorNodeSuppressedErrors>, VisorNodeSuppressedErrors> {
/** */
private static final long serialVersionUID = 0L;
@@ -48,13 +46,13 @@ public class VisorNodeSuppressedErrorsTask extends VisorMultiNodeTask<Map<UUID,
}
/** {@inheritDoc} */
- @Nullable @Override protected Map<UUID, IgniteBiTuple<Long, List<IgniteExceptionRegistry.ExceptionInfo>>>
+ @Nullable @Override protected Map<UUID, VisorNodeSuppressedErrors>
reduce0(List<ComputeJobResult> results) {
- Map<UUID, IgniteBiTuple<Long, List<IgniteExceptionRegistry.ExceptionInfo>>> taskRes =
+ Map<UUID, VisorNodeSuppressedErrors> taskRes =
new HashMap<>(results.size());
for (ComputeJobResult res : results) {
- IgniteBiTuple<Long, List<IgniteExceptionRegistry.ExceptionInfo>> jobRes = res.getData();
+ VisorNodeSuppressedErrors jobRes = res.getData();
taskRes.put(res.getNode().id(), jobRes);
}
@@ -65,8 +63,7 @@ public class VisorNodeSuppressedErrorsTask extends VisorMultiNodeTask<Map<UUID,
/**
* Job to collect last errors on nodes.
*/
- private static class VisorNodeSuppressedErrorsJob extends VisorJob<Map<UUID, Long>,
- IgniteBiTuple<Long, List<IgniteExceptionRegistry.ExceptionInfo>>> {
+ private static class VisorNodeSuppressedErrorsJob extends VisorJob<Map<UUID, Long>, VisorNodeSuppressedErrors> {
/** */
private static final long serialVersionUID = 0L;
@@ -81,20 +78,20 @@ public class VisorNodeSuppressedErrorsTask extends VisorMultiNodeTask<Map<UUID,
}
/** {@inheritDoc} */
- @Override protected IgniteBiTuple<Long, List<IgniteExceptionRegistry.ExceptionInfo>> run(Map<UUID, Long> arg) {
+ @Override protected VisorNodeSuppressedErrors run(Map<UUID, Long> arg) {
Long lastOrder = arg.get(ignite.localNode().id());
long order = lastOrder != null ? lastOrder : 0;
List<IgniteExceptionRegistry.ExceptionInfo> errors = ignite.context().exceptionRegistry().getErrors(order);
- List<IgniteExceptionRegistry.ExceptionInfo> wrapped = new ArrayList<>(errors.size());
+ List<VisorSuppressedError> wrapped = new ArrayList<>(errors.size());
for (IgniteExceptionRegistry.ExceptionInfo error : errors) {
if (error.order() > order)
order = error.order();
- wrapped.add(new IgniteExceptionRegistry.ExceptionInfo(error.order(),
+ wrapped.add(new VisorSuppressedError(error.order(),
new VisorExceptionWrapper(error.error()),
error.message(),
error.threadId(),
@@ -102,7 +99,7 @@ public class VisorNodeSuppressedErrorsTask extends VisorMultiNodeTask<Map<UUID,
error.time()));
}
- return new IgniteBiTuple<>(order, wrapped);
+ return new VisorNodeSuppressedErrors(order, wrapped);
}
/** {@inheritDoc} */
@@ -110,4 +107,4 @@ public class VisorNodeSuppressedErrorsTask extends VisorMultiNodeTask<Map<UUID,
return S.toString(VisorNodeSuppressedErrorsJob.class, this);
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorPeerToPeerConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorPeerToPeerConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorPeerToPeerConfiguration.java
index 93177fd..ab9e140 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorPeerToPeerConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorPeerToPeerConfiguration.java
@@ -17,18 +17,21 @@
package org.apache.ignite.internal.visor.node;
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.Arrays;
+import java.util.List;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.LessNamingBean;
import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
import org.jetbrains.annotations.Nullable;
-import static org.apache.ignite.internal.visor.util.VisorTaskUtils.compactArray;
-
/**
* Data transfer object for node P2P configuration properties.
*/
-public class VisorPeerToPeerConfiguration implements Serializable, LessNamingBean {
+public class VisorPeerToPeerConfiguration extends VisorDataTransferObject {
/** */
private static final long serialVersionUID = 0L;
@@ -39,44 +42,62 @@ public class VisorPeerToPeerConfiguration implements Serializable, LessNamingBea
private int p2pMissedResCacheSize;
/** List of packages from the system classpath that need to be loaded from task originating node. */
- private String p2pLocClsPathExcl;
+ private List<String> p2pLocClsPathExcl;
/**
- * @param c Grid configuration.
- * @return Data transfer object for node P2P configuration properties.
+ * Default constructor.
*/
- public static VisorPeerToPeerConfiguration from(IgniteConfiguration c) {
- VisorPeerToPeerConfiguration cfg = new VisorPeerToPeerConfiguration();
-
- cfg.p2pEnabled = c.isPeerClassLoadingEnabled();
- cfg.p2pMissedResCacheSize = c.getPeerClassLoadingMissedResourcesCacheSize();
- cfg.p2pLocClsPathExcl = compactArray(c.getPeerClassLoadingLocalClassPathExclude());
+ public VisorPeerToPeerConfiguration() {
+ // No-op.
+ }
- return cfg;
+ /**
+ * Create data transfer object for node P2P configuration properties.
+ *
+ * @param c Grid configuration.
+ */
+ public VisorPeerToPeerConfiguration(IgniteConfiguration c) {
+ p2pEnabled = c.isPeerClassLoadingEnabled();
+ p2pMissedResCacheSize = c.getPeerClassLoadingMissedResourcesCacheSize();
+ p2pLocClsPathExcl = Arrays.asList(c.getPeerClassLoadingLocalClassPathExclude());
}
/**
* @return Whether peer-to-peer class loading is enabled.
*/
- public boolean p2pEnabled() {
+ public boolean isPeerClassLoadingEnabled() {
return p2pEnabled;
}
/**
* @return Missed resource cache size.
*/
- public int p2pMissedResponseCacheSize() {
+ public int getPeerClassLoadingMissedResourcesCacheSize() {
return p2pMissedResCacheSize;
}
/**
* @return List of packages from the system classpath that need to be loaded from task originating node.
*/
- @Nullable public String p2pLocalClassPathExclude() {
+ @Nullable public List<String> getPeerClassLoadingLocalClassPathExclude() {
return p2pLocClsPathExcl;
}
/** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ out.writeBoolean(p2pEnabled);
+ out.writeInt(p2pMissedResCacheSize);
+ U.writeCollection(out, p2pLocClsPathExcl);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+ p2pEnabled = in.readBoolean();
+ p2pMissedResCacheSize = in.readInt();
+ p2pLocClsPathExcl = U.readList(in);
+ }
+
+ /** {@inheritDoc} */
@Override public String toString() {
return S.toString(VisorPeerToPeerConfiguration.class, this);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/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 78a54b3..1f1e2b7 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
@@ -17,11 +17,14 @@
package org.apache.ignite.internal.visor.node;
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import org.apache.ignite.configuration.ConnectorConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.LessNamingBean;
import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
import org.jetbrains.annotations.Nullable;
import static java.lang.System.getProperty;
@@ -33,7 +36,7 @@ import static org.apache.ignite.internal.visor.util.VisorTaskUtils.intValue;
/**
* Create data transfer object for node REST configuration properties.
*/
-public class VisorRestConfiguration implements Serializable, LessNamingBean {
+public class VisorRestConfiguration extends VisorDataTransferObject {
/** */
private static final long serialVersionUID = 0L;
@@ -43,9 +46,6 @@ public class VisorRestConfiguration implements Serializable, LessNamingBean {
/** Whether or not SSL is enabled for TCP binary protocol. */
private boolean tcpSslEnabled;
- /** Rest accessible folders (log command can get files from). */
- private String[] accessibleFolders;
-
/** Jetty config path. */
private String jettyPath;
@@ -65,95 +65,116 @@ public class VisorRestConfiguration implements Serializable, LessNamingBean {
private String tcpSslCtxFactory;
/**
+ * Default constructor.
+ */
+ public VisorRestConfiguration() {
+ // No-op.
+ }
+
+ /**
+ * Create data transfer object for node REST configuration properties.
+ *
* @param c Grid configuration.
- * @return Create data transfer object for node REST configuration properties.
*/
- public static VisorRestConfiguration from(IgniteConfiguration c) {
- VisorRestConfiguration cfg = new VisorRestConfiguration();
+ public VisorRestConfiguration(IgniteConfiguration c) {
+ assert c != null;
ConnectorConfiguration clnCfg = c.getConnectorConfiguration();
- boolean restEnabled = clnCfg != null;
-
- cfg.restEnabled = restEnabled;
+ restEnabled = clnCfg != null;
if (restEnabled) {
- cfg.tcpSslEnabled = clnCfg.isSslEnabled();
- cfg.jettyPath = clnCfg.getJettyPath();
- cfg.jettyHost = getProperty(IGNITE_JETTY_HOST);
- cfg.jettyPort = intValue(IGNITE_JETTY_PORT, null);
- cfg.tcpHost = clnCfg.getHost();
- cfg.tcpPort = clnCfg.getPort();
- cfg.tcpSslCtxFactory = compactClass(clnCfg.getSslContextFactory());
+ tcpSslEnabled = clnCfg.isSslEnabled();
+ jettyPath = clnCfg.getJettyPath();
+ jettyHost = getProperty(IGNITE_JETTY_HOST);
+ jettyPort = intValue(IGNITE_JETTY_PORT, null);
+ tcpHost = clnCfg.getHost();
+ tcpPort = clnCfg.getPort();
+ tcpSslCtxFactory = compactClass(clnCfg.getSslContextFactory());
}
-
- return cfg;
}
/**
* @return Whether REST enabled or not.
*/
- public boolean restEnabled() {
+ public boolean isRestEnabled() {
return restEnabled;
}
/**
* @return Whether or not SSL is enabled for TCP binary protocol.
*/
- public boolean tcpSslEnabled() {
+ public boolean isTcpSslEnabled() {
return tcpSslEnabled;
}
/**
- * @return Rest accessible folders (log command can get files from).
- */
- @Nullable public String[] accessibleFolders() {
- return accessibleFolders;
- }
-
- /**
* @return Jetty config path.
*/
- @Nullable public String jettyPath() {
+ @Nullable public String getJettyPath() {
return jettyPath;
}
/**
* @return Jetty host.
*/
- @Nullable public String jettyHost() {
+ @Nullable public String getJettyHost() {
return jettyHost;
}
/**
* @return Jetty port.
*/
- @Nullable public Integer jettyPort() {
+ @Nullable public Integer getJettyPort() {
return jettyPort;
}
/**
* @return REST TCP binary host.
*/
- @Nullable public String tcpHost() {
+ @Nullable public String getTcpHost() {
return tcpHost;
}
/**
* @return REST TCP binary port.
*/
- @Nullable public Integer tcpPort() {
+ @Nullable public Integer getTcpPort() {
return tcpPort;
}
/**
* @return Context factory for SSL.
*/
- @Nullable public String tcpSslContextFactory() {
+ @Nullable public String getTcpSslContextFactory() {
return tcpSslCtxFactory;
}
/** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ out.writeBoolean(restEnabled);
+ out.writeBoolean(tcpSslEnabled);
+ U.writeString(out, jettyPath);
+ U.writeString(out, jettyHost);
+ out.writeObject(jettyPort);
+ U.writeString(out, tcpHost);
+ out.writeObject(tcpPort);
+ U.writeString(out, tcpSslCtxFactory);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+ restEnabled = in.readBoolean();
+ tcpSslEnabled = in.readBoolean();
+ jettyPath = U.readString(in);
+ jettyHost = U.readString(in);
+ jettyPort = (Integer)in.readObject();
+ tcpHost = U.readString(in);
+ tcpPort = (Integer)in.readObject();
+ tcpSslCtxFactory = U.readString(in);
+ }
+
+ /** {@inheritDoc} */
@Override public String toString() {
return S.toString(VisorRestConfiguration.class, this);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSegmentationConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSegmentationConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSegmentationConfiguration.java
index 44909fc..6516141 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSegmentationConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSegmentationConfiguration.java
@@ -17,10 +17,13 @@
package org.apache.ignite.internal.visor.node;
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.LessNamingBean;
import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
import org.apache.ignite.plugin.segmentation.SegmentationPolicy;
import org.jetbrains.annotations.Nullable;
@@ -29,7 +32,7 @@ import static org.apache.ignite.internal.visor.util.VisorTaskUtils.compactArray;
/**
* Data transfer object for node segmentation configuration properties.
*/
-public class VisorSegmentationConfiguration implements Serializable, LessNamingBean {
+public class VisorSegmentationConfiguration extends VisorDataTransferObject {
/** */
private static final long serialVersionUID = 0L;
@@ -46,57 +49,79 @@ public class VisorSegmentationConfiguration implements Serializable, LessNamingB
private boolean waitOnStart;
/** Whether or not all resolvers should succeed for node to be in correct segment. */
- private boolean passRequired;
+ private boolean allResolversPassReq;
/**
- * @param c Grid configuration.
- * @return Data transfer object for node segmentation configuration properties.
+ * Default constructor.
*/
- public static VisorSegmentationConfiguration from(IgniteConfiguration c) {
- VisorSegmentationConfiguration cfg = new VisorSegmentationConfiguration();
-
- cfg.plc = c.getSegmentationPolicy();
- cfg.resolvers = compactArray(c.getSegmentationResolvers());
- cfg.checkFreq = c.getSegmentCheckFrequency();
- cfg.waitOnStart = c.isWaitForSegmentOnStart();
- cfg.passRequired = c.isAllSegmentationResolversPassRequired();
+ public VisorSegmentationConfiguration() {
+ // No-op.
+ }
- return cfg;
+ /**
+ * Create data transfer object for node segmentation configuration properties.
+ *
+ * @param c Grid configuration.
+ */
+ public VisorSegmentationConfiguration(IgniteConfiguration c) {
+ plc = c.getSegmentationPolicy();
+ resolvers = compactArray(c.getSegmentationResolvers());
+ checkFreq = c.getSegmentCheckFrequency();
+ waitOnStart = c.isWaitForSegmentOnStart();
+ allResolversPassReq = c.isAllSegmentationResolversPassRequired();
}
/**
* @return Segmentation policy.
*/
- public SegmentationPolicy policy() {
+ public SegmentationPolicy getPolicy() {
return plc;
}
/**
* @return Segmentation resolvers.
*/
- @Nullable public String resolvers() {
+ @Nullable public String getResolvers() {
return resolvers;
}
/**
* @return Frequency of network segment check by discovery manager.
*/
- public long checkFrequency() {
+ public long getCheckFrequency() {
return checkFreq;
}
/**
* @return Whether or not node should wait for correct segment on start.
*/
- public boolean waitOnStart() {
+ public boolean isWaitOnStart() {
return waitOnStart;
}
/**
* @return Whether or not all resolvers should succeed for node to be in correct segment.
*/
- public boolean passRequired() {
- return passRequired;
+ public boolean isAllSegmentationResolversPassRequired() {
+ return allResolversPassReq;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ U.writeEnum(out, plc);
+ U.writeString(out, resolvers);
+ out.writeLong(checkFreq);
+ out.writeBoolean(waitOnStart);
+ out.writeBoolean(allResolversPassReq);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+ plc = SegmentationPolicy.fromOrdinal(in.readByte());
+ resolvers = U.readString(in);
+ checkFreq = in.readLong();
+ waitOnStart = in.readBoolean();
+ allResolversPassReq = in.readBoolean();
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSpiDescription.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSpiDescription.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSpiDescription.java
new file mode 100644
index 0000000..2d1eb48
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSpiDescription.java
@@ -0,0 +1,89 @@
+/*
+ * 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 java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.Map;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
+
+/**
+ * Transfer object for single spi description.
+ */
+public class VisorSpiDescription extends VisorDataTransferObject {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** SPI class name. */
+ private String clsName;
+
+ /** SPI fields description. */
+ private Map<String, Object> fldDesc;
+
+ /**
+ * Default constructor.
+ */
+ public VisorSpiDescription() {
+ // No-op.
+ }
+
+ /**
+ * Construct Visor spi description object.
+ *
+ * @param clsName SPI class name.
+ * @param fldDesc SPI fields description.
+ */
+ public VisorSpiDescription(String clsName, Map<String, Object> fldDesc) {
+ this.clsName = clsName;
+ this.fldDesc = fldDesc;
+ }
+
+ /**
+ * @return SPI class name.
+ */
+ public String getClassName() {
+ return clsName;
+ }
+
+ /**
+ * @return SPI fields description.
+ */
+ public Map<String, Object> getFieldDescriptions() {
+ return fldDesc;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ U.writeString(out, clsName);
+ U.writeMap(out, fldDesc);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+ clsName = U.readString(in);
+ fldDesc = U.readMap(in);
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorSpiDescription.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/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 55653a3..83cc7c1 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
@@ -17,16 +17,16 @@
package org.apache.ignite.internal.visor.node;
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.HashMap;
-import java.util.Map;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.LessNamingBean;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.lang.IgniteBiTuple;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
import org.apache.ignite.spi.IgniteSpi;
import org.apache.ignite.spi.IgniteSpiConfiguration;
@@ -36,36 +36,43 @@ import static org.apache.ignite.internal.visor.util.VisorTaskUtils.compactObject
/**
* Data transfer object for node SPIs configuration properties.
*/
-public class VisorSpisConfiguration implements Serializable, LessNamingBean {
+public class VisorSpisConfiguration extends VisorDataTransferObject {
/** */
private static final long serialVersionUID = 0L;
/** Discovery SPI. */
- private IgniteBiTuple<String, Map<String, Object>> discoSpi;
+ private VisorSpiDescription discoSpi;
/** Communication SPI. */
- private IgniteBiTuple<String, Map<String, Object>> commSpi;
+ private VisorSpiDescription commSpi;
/** Event storage SPI. */
- private IgniteBiTuple<String, Map<String, Object>> evtSpi;
+ private VisorSpiDescription evtSpi;
/** Collision SPI. */
- private IgniteBiTuple<String, Map<String, Object>> colSpi;
+ private VisorSpiDescription colSpi;
/** Deployment SPI. */
- private IgniteBiTuple<String, Map<String, Object>> deploySpi;
+ private VisorSpiDescription deploySpi;
/** Checkpoint SPIs. */
- private IgniteBiTuple<String, Map<String, Object>>[] cpSpis;
+ private VisorSpiDescription[] cpSpis;
/** Failover SPIs. */
- private IgniteBiTuple<String, Map<String, Object>>[] failSpis;
+ private VisorSpiDescription[] failSpis;
/** Load balancing SPIs. */
- private IgniteBiTuple<String, Map<String, Object>>[] loadBalancingSpis;
+ private VisorSpiDescription[] loadBalancingSpis;
/** Indexing SPIs. */
- private IgniteBiTuple<String, Map<String, Object>>[] indexingSpis;
+ private VisorSpiDescription[] indexingSpis;
+
+ /**
+ * Default constructor.
+ */
+ public VisorSpisConfiguration() {
+ // No-op.
+ }
/**
* Collects SPI information based on GridSpiConfiguration-annotated methods.
@@ -74,7 +81,7 @@ public class VisorSpisConfiguration implements Serializable, LessNamingBean {
* @param spi SPI to collect information on.
* @return Tuple where first component is SPI name and map with properties as second.
*/
- private static IgniteBiTuple<String, Map<String, Object>> collectSpiInfo(IgniteSpi spi) {
+ private static VisorSpiDescription collectSpiInfo(IgniteSpi spi) {
Class<? extends IgniteSpi> spiCls = spi.getClass();
HashMap<String, Object> res = new HashMap<>();
@@ -88,13 +95,13 @@ public class VisorSpisConfiguration implements Serializable, LessNamingBean {
if (mtdName.startsWith("set")) {
String propName = Character.toLowerCase(mtdName.charAt(3)) + mtdName.substring(4);
- String[] getterNames = new String[] {
- "get" + mtdName.substring(3),
- "is" + mtdName.substring(3),
- "get" + mtdName.substring(3) + "Formatted"
- };
-
try {
+ String[] getterNames = new String[] {
+ "get" + mtdName.substring(3),
+ "is" + mtdName.substring(3),
+ "get" + mtdName.substring(3) + "Formatted"
+ };
+
for (String getterName : getterNames) {
try {
Method getter = spiCls.getDeclaredMethod(getterName);
@@ -120,106 +127,129 @@ public class VisorSpisConfiguration implements Serializable, LessNamingBean {
}
}
- return new IgniteBiTuple<String, Map<String, Object>>(spi.getName(), res);
+ return new VisorSpiDescription(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];
+ private static VisorSpiDescription[] collectSpiInfo(IgniteSpi[] spis) {
+ VisorSpiDescription[] res = new VisorSpiDescription[spis.length];
for (int i = 0; i < spis.length; i++)
res[i] = collectSpiInfo(spis[i]);
- return (IgniteBiTuple<String, Map<String, Object>>[])res;
+ return res;
}
/**
+ * Create data transfer object for node SPIs configuration properties.
+ *
* @param c Grid configuration.
- * @return Data transfer object for node SPIs configuration properties.
*/
- public static VisorSpisConfiguration from(IgniteConfiguration c) {
- VisorSpisConfiguration cfg = new VisorSpisConfiguration();
-
- cfg.discoSpi = collectSpiInfo(c.getDiscoverySpi());
- cfg.commSpi = collectSpiInfo(c.getCommunicationSpi());
- cfg.evtSpi = collectSpiInfo(c.getEventStorageSpi());
- cfg.colSpi = collectSpiInfo(c.getCollisionSpi());
- cfg.deploySpi = collectSpiInfo(c.getDeploymentSpi());
- cfg.cpSpis = collectSpiInfo(c.getCheckpointSpi());
- cfg.failSpis = collectSpiInfo(c.getFailoverSpi());
- cfg.loadBalancingSpis = collectSpiInfo(c.getLoadBalancingSpi());
- cfg.indexingSpis = F.asArray(collectSpiInfo(c.getIndexingSpi()));
-
- return cfg;
+ public VisorSpisConfiguration(IgniteConfiguration c) {
+ discoSpi = collectSpiInfo(c.getDiscoverySpi());
+ commSpi = collectSpiInfo(c.getCommunicationSpi());
+ evtSpi = collectSpiInfo(c.getEventStorageSpi());
+ colSpi = collectSpiInfo(c.getCollisionSpi());
+ deploySpi = collectSpiInfo(c.getDeploymentSpi());
+ cpSpis = collectSpiInfo(c.getCheckpointSpi());
+ failSpis = collectSpiInfo(c.getFailoverSpi());
+ loadBalancingSpis = collectSpiInfo(c.getLoadBalancingSpi());
+ indexingSpis = F.asArray(collectSpiInfo(c.getIndexingSpi()));
}
/**
* @return Discovery SPI.
*/
- public IgniteBiTuple<String, Map<String, Object>> discoverySpi() {
+ public VisorSpiDescription getDiscoverySpi() {
return discoSpi;
}
/**
* @return Communication SPI.
*/
- public IgniteBiTuple<String, Map<String, Object>> communicationSpi() {
+ public VisorSpiDescription getCommunicationSpi() {
return commSpi;
}
/**
* @return Event storage SPI.
*/
- public IgniteBiTuple<String, Map<String, Object>> eventStorageSpi() {
+ public VisorSpiDescription getEventStorageSpi() {
return evtSpi;
}
/**
* @return Collision SPI.
*/
- public IgniteBiTuple<String, Map<String, Object>> collisionSpi() {
+ public VisorSpiDescription getCollisionSpi() {
return colSpi;
}
/**
* @return Deployment SPI.
*/
- public IgniteBiTuple<String, Map<String, Object>> deploymentSpi() {
+ public VisorSpiDescription getDeploymentSpi() {
return deploySpi;
}
/**
* @return Checkpoint SPIs.
*/
- public IgniteBiTuple<String, Map<String, Object>>[] checkpointSpis() {
+ public VisorSpiDescription[] getCheckpointSpis() {
return cpSpis;
}
/**
* @return Failover SPIs.
*/
- public IgniteBiTuple<String, Map<String, Object>>[] failoverSpis() {
+ public VisorSpiDescription[] getFailoverSpis() {
return failSpis;
}
/**
* @return Load balancing SPIs.
*/
- public IgniteBiTuple<String, Map<String, Object>>[] loadBalancingSpis() {
+ public VisorSpiDescription[] getLoadBalancingSpis() {
return loadBalancingSpis;
}
/**
* @return Indexing SPIs.
*/
- public IgniteBiTuple<String, Map<String, Object>>[] indexingSpis() {
+ public VisorSpiDescription[] getIndexingSpis() {
return indexingSpis;
}
/** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ out.writeObject(discoSpi);
+ out.writeObject(commSpi);
+ out.writeObject(evtSpi);
+ out.writeObject(colSpi);
+ out.writeObject(deploySpi);
+ out.writeObject(cpSpis);
+ out.writeObject(failSpis);
+ out.writeObject(loadBalancingSpis);
+ out.writeObject(indexingSpis);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+ discoSpi = (VisorSpiDescription)in.readObject();
+ commSpi = (VisorSpiDescription)in.readObject();
+ evtSpi = (VisorSpiDescription)in.readObject();
+ colSpi = (VisorSpiDescription)in.readObject();
+ deploySpi = (VisorSpiDescription)in.readObject();
+ cpSpis = (VisorSpiDescription[])in.readObject();
+ failSpis = (VisorSpiDescription[])in.readObject();
+ loadBalancingSpis = (VisorSpiDescription[])in.readObject();
+ indexingSpis = (VisorSpiDescription[])in.readObject();
+ }
+
+ /** {@inheritDoc} */
@Override public String toString() {
return S.toString(VisorSpisConfiguration.class, this);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSuppressedError.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSuppressedError.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSuppressedError.java
new file mode 100644
index 0000000..2ffaabd
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSuppressedError.java
@@ -0,0 +1,147 @@
+/*
+ * 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 java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.internal.util.tostring.GridToStringExclude;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
+import org.apache.ignite.internal.visor.util.VisorExceptionWrapper;
+
+/**
+ * Data transfer object for suppressed errors.
+ */
+public class VisorSuppressedError extends VisorDataTransferObject {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** */
+ private long order;
+
+ /** */
+ @GridToStringExclude
+ private VisorExceptionWrapper error;
+
+ /** */
+ private long threadId;
+
+ /** */
+ private String threadName;
+
+ /** */
+ private long time;
+
+ /** */
+ private String msg;
+
+ /**
+ * Default constructor.
+ */
+ public VisorSuppressedError() {
+ // No-op.
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param order Locally unique ID that is atomically incremented for each new error.
+ * @param error Suppressed error.
+ * @param msg Message that describe reason why error was suppressed.
+ * @param threadId Thread ID.
+ * @param threadName Thread name.
+ * @param time Occurrence time.
+ */
+ public VisorSuppressedError(long order, VisorExceptionWrapper error, String msg, long threadId, String threadName, long time) {
+ this.order = order;
+ this.error = error;
+ this.threadId = threadId;
+ this.threadName = threadName;
+ this.time = time;
+ this.msg = msg;
+ }
+
+ /**
+ * @return Locally unique ID that is atomically incremented for each new error.
+ */
+ public long getOrder() {
+ return order;
+ }
+
+ /**
+ * @return Gets message that describe reason why error was suppressed.
+ */
+ public String getMessage() {
+ return msg;
+ }
+
+ /**
+ * @return Suppressed error.
+ */
+ public VisorExceptionWrapper getError() {
+ return error;
+ }
+
+ /**
+ * @return Gets thread ID.
+ */
+ public long getThreadId() {
+ return threadId;
+ }
+
+ /**
+ * @return Gets thread name.
+ */
+ public String getThreadName() {
+ return threadName;
+ }
+
+ /**
+ * @return Gets time.
+ */
+ public long getTime() {
+ return time;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ out.writeLong(order);
+ out.writeObject(error);
+ out.writeLong(threadId);
+ U.writeString(out, threadName);
+ out.writeLong(time);
+ U.writeString(out, msg);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+ order = in.readLong();
+ error = (VisorExceptionWrapper)in.readObject();
+ threadId = in.readLong();
+ threadName= U.readString(in);
+ time = in.readLong();
+ msg = U.readString(in);
+ }
+
+ /** {@inheritDoc} */
+ public String toString() {
+ return S.toString(VisorSuppressedError.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/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
index 6855c43..1ac827a 100644
--- 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
@@ -17,28 +17,33 @@
package org.apache.ignite.internal.visor.node;
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import org.apache.ignite.configuration.TransactionConfiguration;
-import org.apache.ignite.internal.LessNamingBean;
import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
import org.apache.ignite.transactions.TransactionConcurrency;
import org.apache.ignite.transactions.TransactionIsolation;
+import static org.apache.ignite.internal.visor.util.VisorTaskUtils.compactClass;
+
/**
* Data transfer object for transaction configuration.
*/
-public class VisorTransactionConfiguration implements Serializable, LessNamingBean {
+public class VisorTransactionConfiguration extends VisorDataTransferObject {
/** */
private static final long serialVersionUID = 0L;
/** Default cache concurrency. */
- private TransactionConcurrency dfltTxConcurrency;
+ private TransactionConcurrency dfltConcurrency;
/** Default transaction isolation. */
- private TransactionIsolation dfltTxIsolation;
+ private TransactionIsolation dfltIsolation;
/** Default transaction timeout. */
- private long dfltTxTimeout;
+ private long dfltTimeout;
/** Pessimistic tx log linger. */
private int pessimisticTxLogLinger;
@@ -46,53 +51,62 @@ public class VisorTransactionConfiguration implements Serializable, LessNamingBe
/** Pessimistic tx log size. */
private int pessimisticTxLogSize;
- /** Default transaction serializable flag. */
- private boolean txSerEnabled;
+ /** Transaction manager factory. */
+ private String txMgrFactory;
/**
- * Create data transfer object for transaction configuration.
- *
- * @param src Transaction configuration.
- * @return Data transfer object.
+ * Default constructor.
*/
- public static VisorTransactionConfiguration from(TransactionConfiguration src) {
- VisorTransactionConfiguration cfg = new VisorTransactionConfiguration();
+ public VisorTransactionConfiguration() {
+ // No-op.
+ }
- cfg.dfltTxConcurrency = src.getDefaultTxConcurrency();
- cfg.dfltTxIsolation = src.getDefaultTxIsolation();
- cfg.dfltTxTimeout = src.getDefaultTxTimeout();
- cfg.pessimisticTxLogLinger = src.getPessimisticTxLogLinger();
- cfg.pessimisticTxLogSize = src.getPessimisticTxLogSize();
- cfg.txSerEnabled = src.isTxSerializableEnabled();
+ /**
+ * Whether to use JTA {@code javax.transaction.Synchronization}
+ * instead of {@code javax.transaction.xa.XAResource}.
+ */
+ private boolean useJtaSync;
- return cfg;
+ /**
+ * Create data transfer object for transaction configuration.
+ *
+ * @param cfg Transaction configuration.
+ */
+ public VisorTransactionConfiguration(TransactionConfiguration cfg) {
+ dfltConcurrency = cfg.getDefaultTxConcurrency();
+ dfltIsolation = cfg.getDefaultTxIsolation();
+ dfltTimeout = cfg.getDefaultTxTimeout();
+ pessimisticTxLogLinger = cfg.getPessimisticTxLogLinger();
+ pessimisticTxLogSize = cfg.getPessimisticTxLogSize();
+ txMgrFactory = compactClass(cfg.getTxManagerFactory());
+ useJtaSync = cfg.isUseJtaSynchronization();
}
/**
* @return Default cache transaction concurrency.
*/
- public TransactionConcurrency defaultTxConcurrency() {
- return dfltTxConcurrency;
+ public TransactionConcurrency getDefaultTxConcurrency() {
+ return dfltConcurrency;
}
/**
* @return Default cache transaction isolation.
*/
- public TransactionIsolation defaultTxIsolation() {
- return dfltTxIsolation;
+ public TransactionIsolation getDefaultTxIsolation() {
+ return dfltIsolation;
}
/**
* @return Default transaction timeout.
*/
- public long defaultTxTimeout() {
- return dfltTxTimeout;
+ public long getDefaultTxTimeout() {
+ return dfltTimeout;
}
/**
* @return Pessimistic log cleanup delay in milliseconds.
*/
- public int pessimisticTxLogLinger() {
+ public int getPessimisticTxLogLinger() {
return pessimisticTxLogLinger;
}
@@ -104,10 +118,38 @@ public class VisorTransactionConfiguration implements Serializable, LessNamingBe
}
/**
- * @return {@code True} if serializable transactions are enabled, {@code false} otherwise.
+ * @return Transaction manager factory.
*/
- public boolean txSerializableEnabled() {
- return txSerEnabled;
+ public String getTxManagerFactory() {
+ return txMgrFactory;
+ }
+
+ /**
+ * @return Whether to use JTA {@code javax.transaction.Synchronization}
+ * instead of {@code javax.transaction.xa.XAResource}.
+ */
+ public boolean isUseJtaSync() {
+ return useJtaSync;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ U.writeEnum(out, dfltConcurrency);
+ U.writeEnum(out, dfltIsolation);
+ out.writeLong(dfltTimeout);
+ out.writeInt(pessimisticTxLogLinger);
+ out.writeInt(pessimisticTxLogSize);
+ U.writeString(out, txMgrFactory);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+ dfltConcurrency = TransactionConcurrency.fromOrdinal(in.readByte());
+ dfltIsolation = TransactionIsolation.fromOrdinal(in.readByte());
+ dfltTimeout = in.readLong();
+ pessimisticTxLogLinger = in.readInt();
+ pessimisticTxLogSize = in.readInt();
+ txMgrFactory = U.readString(in);
}
/** {@inheritDoc} */