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/27 07:13:48 UTC
[32/36] ignite git commit: IGNITE-4988 Rework Visor task arguments.
Code cleanup for ignite-2.0.
http://git-wip-us.apache.org/repos/asf/ignite/blob/6a435b17/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStopTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStopTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStopTask.java
index f90ddbd..9f7c018 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStopTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStopTask.java
@@ -27,19 +27,19 @@ import org.apache.ignite.internal.visor.VisorOneNodeTask;
* Task that stop specified caches on specified node.
*/
@GridInternal
-public class VisorCacheStopTask extends VisorOneNodeTask<String, Void> {
+public class VisorCacheStopTask extends VisorOneNodeTask<VisorCacheStopTaskArg, Void> {
/** */
private static final long serialVersionUID = 0L;
/** {@inheritDoc} */
- @Override protected VisorCacheStopJob job(String arg) {
+ @Override protected VisorCacheStopJob job(VisorCacheStopTaskArg arg) {
return new VisorCacheStopJob(arg, debug);
}
/**
* Job that stop specified caches.
*/
- private static class VisorCacheStopJob extends VisorJob<String, Void> {
+ private static class VisorCacheStopJob extends VisorJob<VisorCacheStopTaskArg, Void> {
/** */
private static final long serialVersionUID = 0L;
@@ -49,14 +49,19 @@ public class VisorCacheStopTask extends VisorOneNodeTask<String, Void> {
* @param cacheName Cache name to clear.
* @param debug Debug flag.
*/
- private VisorCacheStopJob(String cacheName, boolean debug) {
+ private VisorCacheStopJob(VisorCacheStopTaskArg cacheName, boolean debug) {
super(cacheName, debug);
}
/** {@inheritDoc} */
- @Override protected Void run(String cacheName) {
+ @Override protected Void run(VisorCacheStopTaskArg arg) {
+ String cacheName = arg.getCacheName();
+
IgniteCache cache = ignite.cache(cacheName);
+ if (cache == null)
+ throw new IllegalStateException("Failed to find cache for name: " + cacheName);
+
cache.destroy();
return null;
@@ -67,4 +72,4 @@ public class VisorCacheStopTask extends VisorOneNodeTask<String, Void> {
return S.toString(VisorCacheStopJob.class, this);
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/6a435b17/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStopTaskArg.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStopTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStopTaskArg.java
new file mode 100644
index 0000000..4976036
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStopTaskArg.java
@@ -0,0 +1,72 @@
+/*
+ * 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.cache;
+
+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;
+
+/**
+ * Argument for {@link VisorCacheStopTask}.
+ */
+public class VisorCacheStopTaskArg extends VisorDataTransferObject {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Cache name. */
+ private String cacheName;
+
+ /**
+ * Default constructor.
+ */
+ public VisorCacheStopTaskArg() {
+ // No-op.
+ }
+
+ /**
+ * @param cacheName Cache name.
+ */
+ public VisorCacheStopTaskArg(String cacheName) {
+ this.cacheName = cacheName;
+ }
+
+ /**
+ * @return Cache name.
+ */
+ public String getCacheName() {
+ return cacheName;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ U.writeString(out, cacheName);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+ cacheName = U.readString(in);
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorCacheStopTaskArg.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/6a435b17/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStoreConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStoreConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStoreConfiguration.java
index dc1ba2a..1c0c6b8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStoreConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStoreConfiguration.java
@@ -72,6 +72,9 @@ public class VisorCacheStoreConfiguration extends VisorDataTransferObject {
/** Keep binary in store flag. */
private boolean storeKeepBinary;
+ /** Write coalescing flag for write-behind cache store */
+ private boolean writeBehindCoalescing;
+
/**
* Default constructor.
*/
@@ -105,6 +108,8 @@ public class VisorCacheStoreConfiguration extends VisorDataTransferObject {
flushThreadCnt = ccfg.getWriteBehindFlushThreadCount();
storeKeepBinary = ccfg.isStoreKeepBinary();
+
+ writeBehindCoalescing = ccfg.getWriteBehindCoalescing();
}
/**
@@ -191,6 +196,13 @@ public class VisorCacheStoreConfiguration extends VisorDataTransferObject {
return storeKeepBinary;
}
+ /**
+ * @return Write coalescing flag.
+ */
+ public boolean getWriteBehindCoalescing() {
+ return writeBehindCoalescing;
+ }
+
/** {@inheritDoc} */
@Override protected void writeExternalData(ObjectOutput out) throws IOException {
out.writeBoolean(jdbcStore);
@@ -204,6 +216,7 @@ public class VisorCacheStoreConfiguration extends VisorDataTransferObject {
out.writeInt(flushSz);
out.writeInt(flushThreadCnt);
out.writeBoolean(storeKeepBinary);
+ out.writeBoolean(writeBehindCoalescing);
}
/** {@inheritDoc} */
@@ -219,6 +232,7 @@ public class VisorCacheStoreConfiguration extends VisorDataTransferObject {
flushSz = in.readInt();
flushThreadCnt = in.readInt();
storeKeepBinary = in.readBoolean();
+ writeBehindCoalescing = in.readBoolean();
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/6a435b17/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorPartitionMap.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorPartitionMap.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorPartitionMap.java
index f263db5..cadad0c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorPartitionMap.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorPartitionMap.java
@@ -20,6 +20,7 @@ package org.apache.ignite.internal.visor.cache;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
+import java.util.HashMap;
import java.util.Map;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionState;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap;
@@ -75,12 +76,31 @@ public class VisorPartitionMap extends VisorDataTransferObject {
/** {@inheritDoc} */
@Override protected void writeExternalData(ObjectOutput out) throws IOException {
- U.writeIntKeyMap(out, parts);
+ if (parts != null) {
+ out.writeInt(parts.size());
+
+ for (Map.Entry<Integer, GridDhtPartitionState> e : parts.entrySet()) {
+ out.writeInt(e.getKey());
+ U.writeEnum(out, e.getValue());
+ }
+ }
+ else
+ out.writeInt(-1);
}
/** {@inheritDoc} */
@Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
- parts = U.readIntKeyMap(in);
+ int size = in.readInt();
+
+ // Check null flag.
+ if (size == -1)
+ parts = null;
+ else {
+ parts = new HashMap<>(size, 1.0f);
+
+ for (int i = 0; i < size; i++)
+ parts.put(in.readInt(), GridDhtPartitionState.fromOrdinal(in.readByte()));
+ }
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/6a435b17/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorComputeCancelSessionsTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorComputeCancelSessionsTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorComputeCancelSessionsTask.java
index 4ee025d..f28d988 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorComputeCancelSessionsTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorComputeCancelSessionsTask.java
@@ -20,7 +20,6 @@ package org.apache.ignite.internal.visor.compute;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.UUID;
import org.apache.ignite.IgniteCompute;
import org.apache.ignite.compute.ComputeJobResult;
import org.apache.ignite.compute.ComputeTaskFuture;
@@ -35,12 +34,12 @@ import org.jetbrains.annotations.Nullable;
* Cancels given tasks sessions.
*/
@GridInternal
-public class VisorComputeCancelSessionsTask extends VisorMultiNodeTask<Map<UUID, Set<IgniteUuid>>, Void, Void> {
+public class VisorComputeCancelSessionsTask extends VisorMultiNodeTask<VisorComputeCancelSessionsTaskArg, Void, Void> {
/** */
private static final long serialVersionUID = 0L;
/** {@inheritDoc} */
- @Override protected VisorComputeCancelSessionsJob job(Map<UUID, Set<IgniteUuid>> arg) {
+ @Override protected VisorComputeCancelSessionsJob job(VisorComputeCancelSessionsTaskArg arg) {
return new VisorComputeCancelSessionsJob(arg, debug);
}
@@ -53,7 +52,7 @@ public class VisorComputeCancelSessionsTask extends VisorMultiNodeTask<Map<UUID,
/**
* Job that cancel tasks.
*/
- private static class VisorComputeCancelSessionsJob extends VisorJob<Map<UUID, Set<IgniteUuid>>, Void> {
+ private static class VisorComputeCancelSessionsJob extends VisorJob<VisorComputeCancelSessionsTaskArg, Void> {
/** */
private static final long serialVersionUID = 0L;
@@ -61,13 +60,13 @@ public class VisorComputeCancelSessionsTask extends VisorMultiNodeTask<Map<UUID,
* @param arg Map with task sessions IDs to cancel.
* @param debug Debug flag.
*/
- private VisorComputeCancelSessionsJob(Map<UUID, Set<IgniteUuid>> arg, boolean debug) {
+ private VisorComputeCancelSessionsJob(VisorComputeCancelSessionsTaskArg arg, boolean debug) {
super(arg, debug);
}
/** {@inheritDoc} */
- @Override protected Void run(Map<UUID, Set<IgniteUuid>> arg) {
- Set<IgniteUuid> sesIds = arg.get(ignite.localNode().id());
+ @Override protected Void run(VisorComputeCancelSessionsTaskArg arg) {
+ Set<IgniteUuid> sesIds = arg.getSessionIds().get(ignite.localNode().id());
if (sesIds != null && !sesIds.isEmpty()) {
IgniteCompute compute = ignite.compute(ignite.cluster().forLocal());
http://git-wip-us.apache.org/repos/asf/ignite/blob/6a435b17/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorComputeCancelSessionsTaskArg.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorComputeCancelSessionsTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorComputeCancelSessionsTaskArg.java
new file mode 100644
index 0000000..28b7953
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorComputeCancelSessionsTaskArg.java
@@ -0,0 +1,76 @@
+/*
+ * 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.compute;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+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;
+
+/**
+ * Arguments for task {@link VisorComputeCancelSessionsTask}
+ */
+public class VisorComputeCancelSessionsTaskArg extends VisorDataTransferObject {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Session IDs to cancel. */
+ private Map<UUID, Set<IgniteUuid>> sesIds;
+
+ /**
+ * Default constructor.
+ */
+ public VisorComputeCancelSessionsTaskArg() {
+ // No-op.
+ }
+
+ /**
+ * @param sesIds Session IDs to cancel.
+ */
+ public VisorComputeCancelSessionsTaskArg(Map<UUID, Set<IgniteUuid>> sesIds) {
+ this.sesIds = sesIds;
+ }
+
+ /**
+ * @return Session IDs to cancel.
+ */
+ public Map<UUID, Set<IgniteUuid>> getSessionIds() {
+ return sesIds;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ U.writeMap(out, sesIds);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+ sesIds = U.readMap(in);
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorComputeCancelSessionsTaskArg.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/6a435b17/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorGatewayTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorGatewayTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorGatewayTask.java
index 658d6a1..f1fb79b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorGatewayTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorGatewayTask.java
@@ -63,6 +63,18 @@ public class VisorGatewayTask implements ComputeTask<Object[], Object> {
/** */
private static final int JOB_ARG_IDX = 3;
+ /** Array with additional length in arguments for specific nested types */
+ private static final Map<Class, Integer> TYPE_ARG_LENGTH = new HashMap<>(4);
+
+ static {
+ TYPE_ARG_LENGTH.put(Collection.class, 2);
+ TYPE_ARG_LENGTH.put(Set.class, 2);
+ TYPE_ARG_LENGTH.put(List.class, 2);
+ TYPE_ARG_LENGTH.put(Map.class, 3);
+ TYPE_ARG_LENGTH.put(IgniteBiTuple.class, 4);
+ TYPE_ARG_LENGTH.put(GridTuple3.class, 6);
+ }
+
/** Auto-injected grid instance. */
@IgniteInstanceResource
protected transient IgniteEx ignite;
@@ -140,16 +152,19 @@ public class VisorGatewayTask implements ComputeTask<Object[], Object> {
* Construct job argument.
*
* @param cls Class.
+ * @param startIdx Index of first value argument.
*/
- @Nullable private Object toJobArgument(Class cls) throws ClassNotFoundException {
- String arg = argument(JOB_ARG_IDX);
+ @Nullable private Object toJobArgument(Class cls, int startIdx) throws ClassNotFoundException {
+ String arg = argument(startIdx);
- if (cls == Collection.class || cls == Set.class) {
+ boolean isList = cls == Collection.class || cls == List.class;
+
+ if (isList || cls == Set.class) {
Class<?> itemsCls = Class.forName(arg);
- Collection<Object> res = cls == Collection.class ? new ArrayList<>() : new HashSet<>();
+ Collection<Object> res = isList ? new ArrayList<>() : new HashSet<>();
- String items = argument(JOB_ARG_IDX + 1);
+ String items = argument(startIdx + 1);
if (items != null) {
for (String item : items.split(";"))
@@ -162,20 +177,20 @@ public class VisorGatewayTask implements ComputeTask<Object[], Object> {
if (cls == IgniteBiTuple.class) {
Class<?> keyCls = Class.forName(arg);
- String valClsName = argument(JOB_ARG_IDX + 1);
+ String valClsName = argument(startIdx + 1);
assert valClsName != null;
Class<?> valCls = Class.forName(valClsName);
- return new IgniteBiTuple<>(toObject(keyCls, (String)argument(JOB_ARG_IDX + 2)),
- toObject(valCls, (String)argument(JOB_ARG_IDX + 3)));
+ return new IgniteBiTuple<>(toObject(keyCls, (String)argument(startIdx + 2)),
+ toObject(valCls, (String)argument(startIdx + 3)));
}
if (cls == Map.class) {
Class<?> keyCls = Class.forName(arg);
- String valClsName = argument(JOB_ARG_IDX + 1);
+ String valClsName = argument(startIdx + 1);
assert valClsName != null;
@@ -183,7 +198,7 @@ public class VisorGatewayTask implements ComputeTask<Object[], Object> {
Map<Object, Object> res = new HashMap<>();
- String entries = argument(JOB_ARG_IDX + 2);
+ String entries = argument(startIdx + 2);
if (entries != null) {
for (String entry : entries.split(";")) {
@@ -202,8 +217,8 @@ public class VisorGatewayTask implements ComputeTask<Object[], Object> {
}
if (cls == GridTuple3.class) {
- String v2ClsName = argument(JOB_ARG_IDX + 1);
- String v3ClsName = argument(JOB_ARG_IDX + 2);
+ String v2ClsName = argument(startIdx + 1);
+ String v3ClsName = argument(startIdx + 2);
assert v2ClsName != null;
assert v3ClsName != null;
@@ -212,8 +227,8 @@ public class VisorGatewayTask implements ComputeTask<Object[], Object> {
Class<?> v2Cls = Class.forName(v2ClsName);
Class<?> v3Cls = Class.forName(v3ClsName);
- return new GridTuple3<>(toObject(v1Cls, (String)argument(JOB_ARG_IDX + 3)), toObject(v2Cls,
- (String)argument(JOB_ARG_IDX + 4)), toObject(v3Cls, (String)argument(JOB_ARG_IDX + 5)));
+ return new GridTuple3<>(toObject(v1Cls, (String)argument(startIdx + 3)), toObject(v2Cls,
+ (String)argument(startIdx + 4)), toObject(v3Cls, (String)argument(startIdx + 5)));
}
return toObject(cls, arg);
@@ -299,6 +314,17 @@ public class VisorGatewayTask implements ComputeTask<Object[], Object> {
IgniteUuid.class == cls || IgniteBiTuple.class == cls || GridTuple3.class == cls;
}
+ /**
+ * Extract Class object from arguments.
+ *
+ * @param idx Index of argument.
+ */
+ private Class toClass(int idx) throws ClassNotFoundException {
+ Object arg = argument(idx); // Workaround generics: extract argument as Object to use in String.valueOf().
+
+ return Class.forName(String.valueOf(arg));
+ }
+
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override public Object execute() throws IgniteException {
@@ -321,20 +347,41 @@ public class VisorGatewayTask implements ComputeTask<Object[], Object> {
if (argCls == Void.class)
jobArgs = null;
else if (isBuildInObject(argCls))
- jobArgs = toJobArgument(argCls);
+ jobArgs = toJobArgument(argCls, JOB_ARG_IDX);
else {
int beanArgsCnt = argsCnt - JOB_ARG_IDX;
for (Constructor ctor : argCls.getDeclaredConstructors()) {
Class[] types = ctor.getParameterTypes();
- if (types.length == beanArgsCnt) {
- Object[] initArgs = new Object[beanArgsCnt];
+ int args = types.length;
+
+ // Length of arguments that required to constructor by influence of nested complex objects.
+ int needArgs = args;
+
+ for (Class type: types)
+ // When constructor required specified types increase length of required arguments.
+ if (TYPE_ARG_LENGTH.containsKey(type))
+ needArgs += TYPE_ARG_LENGTH.get(type);
+
+ if (needArgs == beanArgsCnt) {
+ Object[] initArgs = new Object[args];
+
+ for (int i = 0, ctrIdx = 0; i < beanArgsCnt; i++, ctrIdx++) {
+ Class type = types[ctrIdx];
+
+ // Parse nested complex objects from arguments for specified types.
+ if (TYPE_ARG_LENGTH.containsKey(type)) {
+ initArgs[ctrIdx] = toJobArgument(toClass(JOB_ARG_IDX + i), JOB_ARG_IDX + 1 + i);
- for (int i = 0; i < beanArgsCnt; i++) {
- String val = argument(i + JOB_ARG_IDX);
+ i += TYPE_ARG_LENGTH.get(type);
+ }
+ // In common case convert value to object.
+ else {
+ String val = argument(JOB_ARG_IDX + i);
- initArgs[i] = toObject(types[i], val);
+ initArgs[ctrIdx] = toObject(type, val);
+ }
}
jobArgs = ctor.newInstance(initArgs);
http://git-wip-us.apache.org/repos/asf/ignite/blob/6a435b17/modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadInfo.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadInfo.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadInfo.java
index 3db4074..f48e6c1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadInfo.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadInfo.java
@@ -42,7 +42,7 @@ public class VisorThreadInfo extends VisorDataTransferObject {
private String name;
/** Thread ID. */
- private Long id;
+ private long id;
/** Thread state. */
private Thread.State state;
@@ -54,28 +54,28 @@ public class VisorThreadInfo extends VisorDataTransferObject {
private String lockName;
/** Lock owner thread ID. */
- private Long lockOwnerId;
+ private long lockOwnerId;
/** Lock owner name. */
private String lockOwnerName;
/** Thread executing native code. */
- private Boolean inNative;
+ private boolean inNative;
/** Thread is suspended. */
- private Boolean suspended;
+ private boolean suspended;
/** Waited count. */
- private Long waitedCnt;
+ private long waitedCnt;
/** Waited time. */
- private Long waitedTime;
+ private long waitedTime;
/** Blocked count. */
- private Long blockedCnt;
+ private long blockedCnt;
/** Blocked time. */
- private Long blockedTime;
+ private long blockedTime;
/** Stack trace. */
private List<StackTraceElement> stackTrace;
@@ -141,7 +141,7 @@ public class VisorThreadInfo extends VisorDataTransferObject {
/**
* @return Thread ID.
*/
- public Long getId() {
+ public long getId() {
return id;
}
@@ -169,7 +169,7 @@ public class VisorThreadInfo extends VisorDataTransferObject {
/**
* @return Lock owner thread ID.
*/
- public Long getLockOwnerId() {
+ public long getLockOwnerId() {
return lockOwnerId;
}
@@ -183,42 +183,42 @@ public class VisorThreadInfo extends VisorDataTransferObject {
/**
* @return Thread executing native code.
*/
- public Boolean isInNative() {
+ public boolean isInNative() {
return inNative;
}
/**
* @return Thread is suspended.
*/
- public Boolean isSuspended() {
+ public boolean isSuspended() {
return suspended;
}
/**
* @return Waited count.
*/
- public Long getWaitedCount() {
+ public long getWaitedCount() {
return waitedCnt;
}
/**
* @return Waited time.
*/
- public Long getWaitedTime() {
+ public long getWaitedTime() {
return waitedTime;
}
/**
* @return Blocked count.
*/
- public Long getBlockedCount() {
+ public long getBlockedCount() {
return blockedCnt;
}
/**
* @return Blocked time.
*/
- public Long getBlockedTime() {
+ public long getBlockedTime() {
return blockedTime;
}
@@ -246,18 +246,18 @@ public class VisorThreadInfo extends VisorDataTransferObject {
/** {@inheritDoc} */
@Override protected void writeExternalData(ObjectOutput out) throws IOException {
U.writeString(out, name);
- out.writeObject(id);
+ out.writeLong(id);
U.writeString(out, state.toString());
out.writeObject(lock);
U.writeString(out, lockName);
- out.writeObject(lockOwnerId);
+ out.writeLong(lockOwnerId);
U.writeString(out, lockOwnerName);
- out.writeObject(inNative);
- out.writeObject(suspended);
- out.writeObject(waitedCnt);
- out.writeObject(waitedTime);
- out.writeObject(blockedCnt);
- out.writeObject(blockedTime);
+ out.writeBoolean(inNative);
+ out.writeBoolean(suspended);
+ out.writeLong(waitedCnt);
+ out.writeLong(waitedTime);
+ out.writeLong(blockedCnt);
+ out.writeLong(blockedTime);
U.writeCollection(out, stackTrace);
U.writeCollection(out, locks);
U.writeCollection(out, lockedMonitors);
@@ -266,7 +266,7 @@ public class VisorThreadInfo extends VisorDataTransferObject {
/** {@inheritDoc} */
@Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
name = U.readString(in);
- id = (Long)in.readObject();
+ id = in.readLong();
String statePresentation = U.readString(in);
@@ -275,14 +275,14 @@ public class VisorThreadInfo extends VisorDataTransferObject {
lock = (VisorThreadLockInfo)in.readObject();
lockName = U.readString(in);
- lockOwnerId = (Long)in.readObject();
+ lockOwnerId = in.readLong();
lockOwnerName = U.readString(in);
- inNative = (Boolean)in.readObject();
- suspended = (Boolean)in.readObject();
- waitedCnt = (Long)in.readObject();
- waitedTime = (Long)in.readObject();
- blockedCnt = (Long)in.readObject();
- blockedTime = (Long)in.readObject();
+ inNative = in.readBoolean();
+ suspended = in.readBoolean();
+ waitedCnt = in.readLong();
+ waitedTime = in.readLong();
+ blockedCnt = in.readLong();
+ blockedTime = in.readLong();
stackTrace = U.readList(in);
locks = U.readList(in);
lockedMonitors = U.readList(in);
http://git-wip-us.apache.org/repos/asf/ignite/blob/6a435b17/modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadMonitorInfo.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadMonitorInfo.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadMonitorInfo.java
index 11e1141..e6171ed 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadMonitorInfo.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadMonitorInfo.java
@@ -33,7 +33,7 @@ public class VisorThreadMonitorInfo extends VisorThreadLockInfo {
private static final long serialVersionUID = 0L;
/** Stack depth. */
- private Integer stackDepth;
+ private int stackDepth;
/** Stack frame. */
private StackTraceElement stackFrame;
@@ -60,7 +60,7 @@ public class VisorThreadMonitorInfo extends VisorThreadLockInfo {
/**
* @return Stack depth.
*/
- public Integer getStackDepth() {
+ public int getStackDepth() {
return stackDepth;
}
@@ -83,7 +83,7 @@ public class VisorThreadMonitorInfo extends VisorThreadLockInfo {
super.writeExternalData(dtout);
}
- out.writeObject(stackDepth);
+ out.writeInt(stackDepth);
out.writeObject(stackFrame);
}
@@ -93,7 +93,7 @@ public class VisorThreadMonitorInfo extends VisorThreadLockInfo {
super.readExternalData(dtin.readByte(), dtin);
}
- stackDepth = (Integer)in.readObject();
+ stackDepth = in.readInt();
stackFrame = (StackTraceElement)in.readObject();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/6a435b17/modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorFileBlockArg.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorFileBlockArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorFileBlockArg.java
deleted file mode 100644
index babb630..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorFileBlockArg.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * 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.file;
-
-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;
-
-/**
- * Arguments for {@link VisorFileBlockTask}
- */
-public class VisorFileBlockArg extends VisorDataTransferObject {
- /** */
- private static final long serialVersionUID = 0L;
-
- /** Log file path. */
- private String path;
-
- /** Log file offset. */
- private long off;
-
- /** Block size. */
- private int blockSz;
-
- /** Log file last modified timestamp. */
- private long lastModified;
-
- /**
- * Default constructor.
- */
- public VisorFileBlockArg() {
- // No-op.
- }
-
- /**
- * @param path Log file path.
- * @param off Offset in file.
- * @param blockSz Block size.
- * @param lastModified Log file last modified timestamp.
- */
- public VisorFileBlockArg(String path, long off, int blockSz, long lastModified) {
- this.path = path;
- this.off = off;
- this.blockSz = blockSz;
- this.lastModified = lastModified;
- }
-
- /**
- * @return Log file path.
- */
- public String getPath() {
- return path;
- }
-
- /**
- * @return Log file offset.
- */
- public long getOffset() {
- return off;
- }
-
- /**
- * @return Block size
- */
- public int getBlockSize() {
- return blockSz;
- }
-
- /**
- * @return Log file last modified timestamp.
- */
- public long getLastModified() {
- return lastModified;
- }
-
- /** {@inheritDoc} */
- @Override protected void writeExternalData(ObjectOutput out) throws IOException {
- U.writeString(out, path);
- out.writeLong(off);
- out.writeInt(blockSz);
- out.writeLong(lastModified);
- }
-
- /** {@inheritDoc} */
- @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
- path = U.readString(in);
- off = in.readLong();
- blockSz = in.readInt();
- lastModified = in.readLong();
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return S.toString(VisorFileBlockArg.class, this);
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/6a435b17/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsFormatTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsFormatTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsFormatTask.java
index 3a9f683..0a75416 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsFormatTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsFormatTask.java
@@ -27,19 +27,19 @@ import org.apache.ignite.internal.visor.VisorOneNodeTask;
* Format IGFS instance.
*/
@GridInternal
-public class VisorIgfsFormatTask extends VisorOneNodeTask<String, Void> {
+public class VisorIgfsFormatTask extends VisorOneNodeTask<VisorIgfsFormatTaskArg, Void> {
/** */
private static final long serialVersionUID = 0L;
/** {@inheritDoc} */
- @Override protected VisorIgfsFormatJob job(String arg) {
+ @Override protected VisorIgfsFormatJob job(VisorIgfsFormatTaskArg arg) {
return new VisorIgfsFormatJob(arg, debug);
}
/**
* Job that format IGFS.
*/
- private static class VisorIgfsFormatJob extends VisorJob<String, Void> {
+ private static class VisorIgfsFormatJob extends VisorJob<VisorIgfsFormatTaskArg, Void> {
/** */
private static final long serialVersionUID = 0L;
@@ -47,17 +47,17 @@ public class VisorIgfsFormatTask extends VisorOneNodeTask<String, Void> {
* @param arg IGFS name to format.
* @param debug Debug flag.
*/
- private VisorIgfsFormatJob(String arg, boolean debug) {
+ private VisorIgfsFormatJob(VisorIgfsFormatTaskArg arg, boolean debug) {
super(arg, debug);
}
/** {@inheritDoc} */
- @Override protected Void run(String igfsName) {
+ @Override protected Void run(VisorIgfsFormatTaskArg arg) {
try {
- ignite.fileSystem(igfsName).clear();
+ ignite.fileSystem(arg.getIgfsName()).clear();
}
catch (IllegalArgumentException iae) {
- throw new IgniteException("Failed to format IGFS: " + igfsName, iae);
+ throw new IgniteException("Failed to format IGFS: " + arg.getIgfsName(), iae);
}
return null;
http://git-wip-us.apache.org/repos/asf/ignite/blob/6a435b17/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsFormatTaskArg.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsFormatTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsFormatTaskArg.java
new file mode 100644
index 0000000..b8450cf
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsFormatTaskArg.java
@@ -0,0 +1,72 @@
+/*
+ * 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.igfs;
+
+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;
+
+/**
+ * Argument for {@link VisorIgfsFormatTask}.
+ */
+public class VisorIgfsFormatTaskArg extends VisorDataTransferObject {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** IGFS name. */
+ private String igfsName;
+
+ /**
+ * Default constructor.
+ */
+ public VisorIgfsFormatTaskArg() {
+ // No-op.
+ }
+
+ /**
+ * @param igfsName IGFS name.
+ */
+ public VisorIgfsFormatTaskArg(String igfsName) {
+ this.igfsName = igfsName;
+ }
+
+ /**
+ * @return IGFS name.
+ */
+ public String getIgfsName() {
+ return igfsName;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ U.writeString(out, igfsName);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+ igfsName = U.readString(in);
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorIgfsFormatTaskArg.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/6a435b17/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerClearTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerClearTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerClearTask.java
index b8bfe9e..c730840 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerClearTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerClearTask.java
@@ -39,14 +39,19 @@ import static org.apache.ignite.internal.visor.util.VisorTaskUtils.resolveIgfsPr
* Remove all IGFS profiler logs.
*/
@GridInternal
-public class VisorIgfsProfilerClearTask extends VisorOneNodeTask<String, VisorIgfsProfilerClearTaskResult> {
+public class VisorIgfsProfilerClearTask extends VisorOneNodeTask<VisorIgfsProfilerClearTaskArg, VisorIgfsProfilerClearTaskResult> {
/** */
private static final long serialVersionUID = 0L;
+ /** {@inheritDoc} */
+ @Override protected VisorIgfsProfilerClearJob job(VisorIgfsProfilerClearTaskArg arg) {
+ return new VisorIgfsProfilerClearJob(arg, debug);
+ }
+
/**
* Job to clear profiler logs.
*/
- private static class VisorIgfsProfilerClearJob extends VisorJob<String, VisorIgfsProfilerClearTaskResult> {
+ private static class VisorIgfsProfilerClearJob extends VisorJob<VisorIgfsProfilerClearTaskArg, VisorIgfsProfilerClearTaskResult> {
/** */
private static final long serialVersionUID = 0L;
@@ -56,23 +61,23 @@ public class VisorIgfsProfilerClearTask extends VisorOneNodeTask<String, VisorIg
* @param arg Job argument.
* @param debug Debug flag.
*/
- private VisorIgfsProfilerClearJob(String arg, boolean debug) {
+ private VisorIgfsProfilerClearJob(VisorIgfsProfilerClearTaskArg arg, boolean debug) {
super(arg, debug);
}
/** {@inheritDoc} */
- @Override protected VisorIgfsProfilerClearTaskResult run(String arg) {
+ @Override protected VisorIgfsProfilerClearTaskResult run(VisorIgfsProfilerClearTaskArg arg) {
int deleted = 0;
int notDeleted = 0;
try {
- IgniteFileSystem igfs = ignite.fileSystem(arg);
+ IgniteFileSystem igfs = ignite.fileSystem(arg.getIgfsName());
Path logsDir = resolveIgfsProfilerLogsDir(igfs);
if (logsDir != null) {
PathMatcher matcher = FileSystems.getDefault().getPathMatcher(
- "glob:igfs-log-" + arg + "-*.csv");
+ "glob:igfs-log-" + arg.getIgfsName() + "-*.csv");
try (DirectoryStream<Path> dirStream = Files.newDirectoryStream(logsDir)) {
for (Path p : dirStream) {
@@ -99,7 +104,7 @@ public class VisorIgfsProfilerClearTask extends VisorOneNodeTask<String, VisorIg
}
}
catch (IOException | IllegalArgumentException e) {
- throw new IgniteException("Failed to clear profiler logs for IGFS: " + arg, e);
+ throw new IgniteException("Failed to clear profiler logs for IGFS: " + arg.getIgfsName(), e);
}
catch (IgniteCheckedException e) {
throw U.convertException(e);
@@ -113,9 +118,4 @@ public class VisorIgfsProfilerClearTask extends VisorOneNodeTask<String, VisorIg
return S.toString(VisorIgfsProfilerClearJob.class, this);
}
}
-
- /** {@inheritDoc} */
- @Override protected VisorIgfsProfilerClearJob job(String arg) {
- return new VisorIgfsProfilerClearJob(arg, debug);
- }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/6a435b17/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerClearTaskArg.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerClearTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerClearTaskArg.java
new file mode 100644
index 0000000..1afbb1c
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerClearTaskArg.java
@@ -0,0 +1,72 @@
+/*
+ * 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.igfs;
+
+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;
+
+/**
+ * Argument for {@link VisorIgfsProfilerClearTask}.
+ */
+public class VisorIgfsProfilerClearTaskArg extends VisorDataTransferObject {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** IGFS name. */
+ private String igfsName;
+
+ /**
+ * Default constructor.
+ */
+ public VisorIgfsProfilerClearTaskArg() {
+ // No-op.
+ }
+
+ /**
+ * @param igfsName IGFS name.
+ */
+ public VisorIgfsProfilerClearTaskArg(String igfsName) {
+ this.igfsName = igfsName;
+ }
+
+ /**
+ * @return IGFS name.
+ */
+ public String getIgfsName() {
+ return igfsName;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ U.writeString(out, igfsName);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+ igfsName = U.readString(in);
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorIgfsProfilerClearTaskArg.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/6a435b17/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerClearTaskResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerClearTaskResult.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerClearTaskResult.java
index 4eafe53..4e22f37 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerClearTaskResult.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerClearTaskResult.java
@@ -31,10 +31,10 @@ public class VisorIgfsProfilerClearTaskResult extends VisorDataTransferObject {
private static final long serialVersionUID = 0L;
/** Count of deleted files. */
- private Integer deleted;
+ private int deleted;
/** Count of not deleted files. */
- private Integer notDeleted;
+ private int notDeleted;
/**
* Default constructor.
@@ -47,7 +47,7 @@ public class VisorIgfsProfilerClearTaskResult extends VisorDataTransferObject {
* @param deleted Count of deleted files.
* @param notDeleted Count of not deleted files.
*/
- public VisorIgfsProfilerClearTaskResult(Integer deleted, Integer notDeleted) {
+ public VisorIgfsProfilerClearTaskResult(int deleted, int notDeleted) {
this.deleted = deleted;
this.notDeleted = notDeleted;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/6a435b17/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerTask.java
index 956458c..935a3da 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerTask.java
@@ -56,7 +56,7 @@ import static org.apache.ignite.internal.visor.util.VisorTaskUtils.resolveIgfsPr
* Task that parse hadoop profiler logs.
*/
@GridInternal
-public class VisorIgfsProfilerTask extends VisorOneNodeTask<String, List<VisorIgfsProfilerEntry>> {
+public class VisorIgfsProfilerTask extends VisorOneNodeTask<VisorIgfsProfilerTaskArg, List<VisorIgfsProfilerEntry>> {
/** */
private static final long serialVersionUID = 0L;
@@ -140,14 +140,14 @@ public class VisorIgfsProfilerTask extends VisorOneNodeTask<String, List<VisorIg
};
/** {@inheritDoc} */
- @Override protected VisorIgfsProfilerJob job(String arg) {
+ @Override protected VisorIgfsProfilerJob job(VisorIgfsProfilerTaskArg arg) {
return new VisorIgfsProfilerJob(arg, debug);
}
/**
* Job that do actual profiler work.
*/
- private static class VisorIgfsProfilerJob extends VisorJob<String, List<VisorIgfsProfilerEntry>> {
+ private static class VisorIgfsProfilerJob extends VisorJob<VisorIgfsProfilerTaskArg, List<VisorIgfsProfilerEntry>> {
/** */
private static final long serialVersionUID = 0L;
@@ -196,22 +196,24 @@ public class VisorIgfsProfilerTask extends VisorOneNodeTask<String, List<VisorIg
* @param arg IGFS name.
* @param debug Debug flag.
*/
- private VisorIgfsProfilerJob(String arg, boolean debug) {
+ private VisorIgfsProfilerJob(VisorIgfsProfilerTaskArg arg, boolean debug) {
super(arg, debug);
}
/** {@inheritDoc} */
- @Override protected List<VisorIgfsProfilerEntry> run(String arg) {
+ @Override protected List<VisorIgfsProfilerEntry> run(VisorIgfsProfilerTaskArg arg) {
+ String name = arg.getIgfsName();
+
try {
- Path logsDir = resolveIgfsProfilerLogsDir(ignite.fileSystem(arg));
+ Path logsDir = resolveIgfsProfilerLogsDir(ignite.fileSystem(name));
if (logsDir != null)
- return parse(logsDir, arg);
+ return parse(logsDir, name);
return Collections.emptyList();
}
catch (IOException | IllegalArgumentException e) {
- throw new IgniteException("Failed to parse profiler logs for IGFS: " + arg, e);
+ throw new IgniteException("Failed to parse profiler logs for IGFS: " + name, e);
}
catch (IgniteCheckedException e) {
throw U.convertException(e);
http://git-wip-us.apache.org/repos/asf/ignite/blob/6a435b17/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerTaskArg.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerTaskArg.java
new file mode 100644
index 0000000..7fe9935
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerTaskArg.java
@@ -0,0 +1,72 @@
+/*
+ * 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.igfs;
+
+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;
+
+/**
+ * Argument for {@link VisorIgfsProfilerTask}.
+ */
+public class VisorIgfsProfilerTaskArg extends VisorDataTransferObject {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** IGFS name. */
+ private String igfsName;
+
+ /**
+ * Default constructor.
+ */
+ public VisorIgfsProfilerTaskArg() {
+ // No-op.
+ }
+
+ /**
+ * @param igfsName IGFS name.
+ */
+ public VisorIgfsProfilerTaskArg(String igfsName) {
+ this.igfsName = igfsName;
+ }
+
+ /**
+ * @return IGFS name.
+ */
+ public String getIgfsName() {
+ return igfsName;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ U.writeString(out, igfsName);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+ igfsName = U.readString(in);
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorIgfsProfilerTaskArg.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/6a435b17/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsResetMetricsTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsResetMetricsTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsResetMetricsTask.java
index b10cce3..ee90edf 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsResetMetricsTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsResetMetricsTask.java
@@ -17,7 +17,6 @@
package org.apache.ignite.internal.visor.igfs;
-import java.util.Set;
import org.apache.ignite.IgniteException;
import org.apache.ignite.internal.processors.task.GridInternal;
import org.apache.ignite.internal.util.typedef.internal.S;
@@ -28,19 +27,19 @@ import org.apache.ignite.internal.visor.VisorOneNodeTask;
* Resets IGFS metrics.
*/
@GridInternal
-public class VisorIgfsResetMetricsTask extends VisorOneNodeTask<Set<String>, Void> {
+public class VisorIgfsResetMetricsTask extends VisorOneNodeTask<VisorIgfsResetMetricsTaskArg, Void> {
/** */
private static final long serialVersionUID = 0L;
/** {@inheritDoc} */
- @Override protected VisorIgfsResetMetricsJob job(Set<String> arg) {
+ @Override protected VisorIgfsResetMetricsJob job(VisorIgfsResetMetricsTaskArg arg) {
return new VisorIgfsResetMetricsJob(arg, debug);
}
/**
* Job that reset IGFS metrics.
*/
- private static class VisorIgfsResetMetricsJob extends VisorJob<Set<String>, Void> {
+ private static class VisorIgfsResetMetricsJob extends VisorJob<VisorIgfsResetMetricsTaskArg, Void> {
/** */
private static final long serialVersionUID = 0L;
@@ -48,13 +47,13 @@ public class VisorIgfsResetMetricsTask extends VisorOneNodeTask<Set<String>, Voi
* @param arg IGFS names.
* @param debug Debug flag.
*/
- private VisorIgfsResetMetricsJob(Set<String> arg, boolean debug) {
+ private VisorIgfsResetMetricsJob(VisorIgfsResetMetricsTaskArg arg, boolean debug) {
super(arg, debug);
}
/** {@inheritDoc} */
- @Override protected Void run(Set<String> igfsNames) {
- for (String igfsName : igfsNames)
+ @Override protected Void run(VisorIgfsResetMetricsTaskArg arg) {
+ for (String igfsName : arg.getIgfsNames())
try {
ignite.fileSystem(igfsName).resetMetrics();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/6a435b17/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsResetMetricsTaskArg.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsResetMetricsTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsResetMetricsTaskArg.java
new file mode 100644
index 0000000..033a05d
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsResetMetricsTaskArg.java
@@ -0,0 +1,73 @@
+/*
+ * 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.igfs;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.Set;
+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;
+
+/**
+ * Argument for {@link VisorIgfsResetMetricsTask}.
+ */
+public class VisorIgfsResetMetricsTaskArg extends VisorDataTransferObject {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** IGFS names. */
+ private Set<String> igfsNames;
+
+ /**
+ * Default constructor.
+ */
+ public VisorIgfsResetMetricsTaskArg() {
+ // No-op.
+ }
+
+ /**
+ * @param igfsNames IGFS names.
+ */
+ public VisorIgfsResetMetricsTaskArg(Set<String> igfsNames) {
+ this.igfsNames = igfsNames;
+ }
+
+ /**
+ * @return IGFS names.
+ */
+ public Set<String> getIgfsNames() {
+ return igfsNames;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ U.writeCollection(out, igfsNames);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+ igfsNames = U.readSet(in);
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorIgfsResetMetricsTaskArg.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/6a435b17/modules/core/src/main/java/org/apache/ignite/internal/visor/log/VisorLogSearchArg.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/log/VisorLogSearchArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/log/VisorLogSearchArg.java
deleted file mode 100644
index 2a6b79b..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/log/VisorLogSearchArg.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * 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.log;
-
-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;
-
-/**
- * Arguments for {@link VisorLogSearchTask}.
- */
-public class VisorLogSearchArg extends VisorDataTransferObject {
- /** */
- private static final long serialVersionUID = 0L;
-
- /** Searched string. */
- private String searchStr;
-
- /** Folder. */
- private String folder;
-
- /** File name search pattern. */
- private String filePtrn;
-
- /** Max number of results. */
- private int limit;
-
- /**
- * Default constructor.
- */
- public VisorLogSearchArg() {
- // No-op.
- }
-
- /**
- * @param searchStr Searched string.
- * @param folder Folder.
- * @param filePtrn File name search pattern.
- * @param limit Max number of results.
- */
- public VisorLogSearchArg(String searchStr, String folder, String filePtrn, int limit) {
- this.searchStr = searchStr;
- this.folder = folder;
- this.filePtrn = filePtrn;
- this.limit = limit;
- }
-
- /**
- * @return Searched string.
- */
- public String getSearchString() {
- return searchStr;
- }
-
- /**
- * @return Folder.
- */
- public String getFolder() {
- return folder;
- }
-
- /**
- * @return File name search pattern.
- */
- public String getFilePattern() {
- return filePtrn;
- }
-
- /**
- * @return Max number of results.
- */
- public int getLimit() {
- return limit;
- }
-
- /** {@inheritDoc} */
- @Override protected void writeExternalData(ObjectOutput out) throws IOException {
- U.writeString(out, searchStr);
- U.writeString(out, folder);
- U.writeString(out, filePtrn);
- out.writeInt(limit);
- }
-
- /** {@inheritDoc} */
- @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
- searchStr = U.readString(in);
- folder = U.readString(in);
- filePtrn = U.readString(in);
- limit = in.readInt();
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return S.toString(VisorLogSearchArg.class, this);
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/6a435b17/modules/core/src/main/java/org/apache/ignite/internal/visor/misc/VisorAckTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/misc/VisorAckTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/misc/VisorAckTask.java
index bad3f53..eaa036c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/misc/VisorAckTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/misc/VisorAckTask.java
@@ -29,12 +29,12 @@ import org.jetbrains.annotations.Nullable;
* Ack task to run on node.
*/
@GridInternal
-public class VisorAckTask extends VisorMultiNodeTask<String, Void, Void> {
+public class VisorAckTask extends VisorMultiNodeTask<VisorAckTaskArg, Void, Void> {
/** */
private static final long serialVersionUID = 0L;
/** {@inheritDoc} */
- @Override protected VisorAckJob job(String arg) {
+ @Override protected VisorAckJob job(VisorAckTaskArg arg) {
return new VisorAckJob(arg, debug);
}
@@ -46,7 +46,7 @@ public class VisorAckTask extends VisorMultiNodeTask<String, Void, Void> {
/**
* Ack job to run on node.
*/
- private static class VisorAckJob extends VisorJob<String, Void> {
+ private static class VisorAckJob extends VisorJob<VisorAckTaskArg, Void> {
/** */
private static final long serialVersionUID = 0L;
@@ -56,13 +56,13 @@ public class VisorAckTask extends VisorMultiNodeTask<String, Void, Void> {
* @param arg Message to ack in node console.
* @param debug Debug flag.
*/
- private VisorAckJob(String arg, boolean debug) {
+ private VisorAckJob(VisorAckTaskArg arg, boolean debug) {
super(arg, debug);
}
/** {@inheritDoc} */
- @Override protected Void run(String arg) {
- System.out.println("<visor>: ack: " + (arg == null ? ignite.localNode().id() : arg));
+ @Override protected Void run(VisorAckTaskArg arg) {
+ System.out.println("<visor>: ack: " + (arg.getMessage() == null ? ignite.localNode().id() : arg.getMessage()));
return null;
}
@@ -72,4 +72,4 @@ public class VisorAckTask extends VisorMultiNodeTask<String, Void, Void> {
return S.toString(VisorAckJob.class, this);
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/6a435b17/modules/core/src/main/java/org/apache/ignite/internal/visor/misc/VisorAckTaskArg.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/misc/VisorAckTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/misc/VisorAckTaskArg.java
new file mode 100644
index 0000000..93c4aef
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/misc/VisorAckTaskArg.java
@@ -0,0 +1,72 @@
+/*
+ * 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.misc;
+
+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;
+
+/**
+ * Arguments for {@link VisorAckTask}.
+ */
+public class VisorAckTaskArg extends VisorDataTransferObject {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Message to show. */
+ private String msg;
+
+ /**
+ * Default constructor.
+ */
+ public VisorAckTaskArg() {
+ // No-op.
+ }
+
+ /**
+ * @param msg Message to show.
+ */
+ public VisorAckTaskArg(String msg) {
+ this.msg = msg;
+ }
+
+ /**
+ * @return Cache name.
+ */
+ public String getMessage() {
+ return msg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ U.writeString(out, msg);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+ msg = U.readString(in);
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorAckTaskArg.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/6a435b17/modules/core/src/main/java/org/apache/ignite/internal/visor/misc/VisorChangeGridActiveStateTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/misc/VisorChangeGridActiveStateTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/misc/VisorChangeGridActiveStateTask.java
index 08a0067..bde4d6c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/misc/VisorChangeGridActiveStateTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/misc/VisorChangeGridActiveStateTask.java
@@ -26,19 +26,19 @@ import org.apache.ignite.internal.visor.VisorOneNodeTask;
* Task for changing grid active state.
*/
@GridInternal
-public class VisorChangeGridActiveStateTask extends VisorOneNodeTask<Boolean, Void> {
+public class VisorChangeGridActiveStateTask extends VisorOneNodeTask<VisorChangeGridActiveStateTaskArg, Void> {
/** */
private static final long serialVersionUID = 0L;
/** {@inheritDoc} */
- @Override protected VisorChangeGridActiveStateJob job(Boolean arg) {
+ @Override protected VisorChangeGridActiveStateJob job(VisorChangeGridActiveStateTaskArg arg) {
return new VisorChangeGridActiveStateJob(arg, debug);
}
/**
* Job for changing grid active state.
*/
- private static class VisorChangeGridActiveStateJob extends VisorJob<Boolean, Void> {
+ private static class VisorChangeGridActiveStateJob extends VisorJob<VisorChangeGridActiveStateTaskArg, Void> {
/** */
private static final long serialVersionUID = 0L;
@@ -46,13 +46,13 @@ public class VisorChangeGridActiveStateTask extends VisorOneNodeTask<Boolean, Vo
* @param arg New state of grid.
* @param debug Debug flag.
*/
- private VisorChangeGridActiveStateJob(Boolean arg, boolean debug) {
+ private VisorChangeGridActiveStateJob(VisorChangeGridActiveStateTaskArg arg, boolean debug) {
super(arg, debug);
}
/** {@inheritDoc} */
- @Override protected Void run(Boolean arg) {
- ignite.active(arg);
+ @Override protected Void run(VisorChangeGridActiveStateTaskArg arg) {
+ ignite.active(arg.isActive());
return null;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/6a435b17/modules/core/src/main/java/org/apache/ignite/internal/visor/misc/VisorChangeGridActiveStateTaskArg.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/misc/VisorChangeGridActiveStateTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/misc/VisorChangeGridActiveStateTaskArg.java
new file mode 100644
index 0000000..15e76fb
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/misc/VisorChangeGridActiveStateTaskArg.java
@@ -0,0 +1,71 @@
+/*
+ * 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.misc;
+
+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 {@link VisorChangeGridActiveStateTask}.
+ */
+public class VisorChangeGridActiveStateTaskArg extends VisorDataTransferObject {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** If True start activation process. If False start deactivation process. */
+ private boolean active;
+
+ /**
+ * Default constructor.
+ */
+ public VisorChangeGridActiveStateTaskArg() {
+ // No-op.
+ }
+
+ /**
+ * @param active If True start activation process. If False start deactivation process.
+ */
+ public VisorChangeGridActiveStateTaskArg(boolean active) {
+ this.active = active;
+ }
+
+ /**
+ * @return If True start activation process. If False start deactivation process.
+ */
+ public boolean isActive() {
+ return active;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ out.writeBoolean(active);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+ active = in.readBoolean();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorChangeGridActiveStateTaskArg.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/6a435b17/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorBasicConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorBasicConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorBasicConfiguration.java
index 0a3a8ea..56d000d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorBasicConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorBasicConfiguration.java
@@ -20,7 +20,6 @@ package org.apache.ignite.internal.visor.node;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
-import java.util.UUID;
import org.apache.ignite.configuration.DeploymentMode;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.IgniteEx;
@@ -59,9 +58,6 @@ public class VisorBasicConfiguration extends VisorDataTransferObject {
/** Local host value used. */
private String locHost;
- /** Node id. */
- private UUID nodeId;
-
/** Marshaller used. */
private String marsh;
@@ -113,9 +109,54 @@ public class VisorBasicConfiguration extends VisorDataTransferObject {
/** Whether update checker is enabled. */
private boolean updateNtf;
+ /** Active on start flag. */
+ private boolean activeOnStart;
+
+ /** Address resolver. */
+ private String addrRslvr;
+
+ /** Flag indicating whether cache sanity check is enabled. */
+ private boolean cacheSanityCheckEnabled;
+
+ /** User's class loader. */
+ private String clsLdr;
+
+ /** Consistent globally unique node ID which survives node restarts. */
+ private String consistentId;
+
+ /** Failure detection timeout. */
+ private Long failureDetectionTimeout;
+
+ /** Ignite work folder. */
+ private String igniteWorkDir;
+
+ /** */
+ private boolean lateAffAssignment;
+
+ /** Marshal local jobs. */
+ private boolean marshLocJobs;
+
/** Full metrics enabled flag. */
private long metricsUpdateFreq;
+ /** Failure detection timeout for client nodes. */
+ private Long clientFailureDetectionTimeout;
+
+ /** Message send retries delay. */
+ private int sndRetryCnt;
+
+ /** Interval between message send retries. */
+ private long sndRetryDelay;
+
+ /** Base port number for time server. */
+ private int timeSrvPortBase;
+
+ /** Port number range for time server. */
+ private int timeSrvPortRange;
+
+ /** Utility cache pool keep alive time. */
+ private long utilityCacheKeepAliveTime;
+
/**
* Default constructor.
*/
@@ -133,7 +174,6 @@ public class VisorBasicConfiguration extends VisorDataTransferObject {
igniteInstanceName = c.getIgniteInstanceName();
ggHome = getProperty(IGNITE_HOME, c.getIgniteHome());
locHost = getProperty(IGNITE_LOCAL_HOST, c.getLocalHost());
- nodeId = ignite.localNode().id();
marsh = compactClass(c.getMarshaller());
deployMode = c.getDeploymentMode();
clientMode = c.isClientMode();
@@ -151,7 +191,22 @@ public class VisorBasicConfiguration extends VisorDataTransferObject {
quiet = boolValue(IGNITE_QUIET, true);
successFile = getProperty(IGNITE_SUCCESS_FILE);
updateNtf = boolValue(IGNITE_UPDATE_NOTIFIER, true);
+ activeOnStart = c.isActiveOnStart();
+ addrRslvr = compactClass(c.getAddressResolver());
+ cacheSanityCheckEnabled = c.isCacheSanityCheckEnabled();
+ clsLdr = compactClass(c.getClassLoader());
+ consistentId = String.valueOf(c.getConsistentId());
+ failureDetectionTimeout = c.getFailureDetectionTimeout();
+ igniteWorkDir = c.getWorkDirectory();
+ lateAffAssignment = c.isLateAffinityAssignment();
+ marshLocJobs = c.isMarshalLocalJobs();
metricsUpdateFreq = c.getMetricsUpdateFrequency();
+ clientFailureDetectionTimeout = c.getClientFailureDetectionTimeout();
+ sndRetryCnt = c.getNetworkSendRetryCount();
+ sndRetryDelay = c.getNetworkSendRetryDelay();
+ timeSrvPortBase = c.getTimeServerPortBase();
+ timeSrvPortRange = c.getTimeServerPortRange();
+ utilityCacheKeepAliveTime = c.getUtilityCacheKeepAliveTime();
}
/**
@@ -176,13 +231,6 @@ public class VisorBasicConfiguration extends VisorDataTransferObject {
}
/**
- * @return Node id.
- */
- public UUID getNodeId() {
- return nodeId;
- }
-
- /**
* @return Marshaller used.
*/
public String getMarshaller() {
@@ -302,18 +350,124 @@ public class VisorBasicConfiguration extends VisorDataTransferObject {
}
/**
+ * @return Active on start flag.
+ */
+ public boolean isActiveOnStart() {
+ return activeOnStart;
+ }
+
+ /**
+ * @return Class name of address resolver instance.
+ */
+ public String getAddressResolver() {
+ return addrRslvr;
+ }
+
+ /**
+ * @return Flag indicating whether cache sanity check is enabled.
+ */
+ public boolean isCacheSanityCheckEnabled() {
+ return cacheSanityCheckEnabled;
+ }
+
+ /**
+ * @return User's class loader.
+ */
+ public String getClassLoader() {
+ return clsLdr;
+ }
+
+ /**
+ * Gets consistent globally unique node ID which survives node restarts.
+ *
+ * @return Node consistent ID.a
+ */
+ public String getConsistentId() {
+ return consistentId;
+ }
+
+ /**
+ * @return Failure detection timeout in milliseconds.
+ */
+ public Long getFailureDetectionTimeout() {
+ return failureDetectionTimeout;
+ }
+
+ /**
+ * @return Ignite work directory.
+ */
+ public String getWorkDirectory() {
+ return igniteWorkDir;
+ }
+
+ /**
+ * @return Late affinity assignment flag.
+ */
+ public boolean isLateAffinityAssignment() {
+ return lateAffAssignment;
+ }
+
+ /**
+ * @return {@code True} if local jobs should be marshalled.
+ */
+ public boolean isMarshalLocalJobs() {
+ return marshLocJobs;
+ }
+
+ /**
* @return Job metrics update frequency in milliseconds.
*/
public long getMetricsUpdateFrequency() {
return metricsUpdateFreq;
}
+ /**
+ * @return Failure detection timeout for client nodes in milliseconds.
+ */
+ public Long getClientFailureDetectionTimeout() {
+ return clientFailureDetectionTimeout;
+ }
+
+ /**
+ * @return Message send retries count.
+ */
+ public int getNetworkSendRetryCount() {
+ return sndRetryCnt;
+ }
+
+ /**
+ * @return Interval between message send retries.
+ */
+ public long getNetworkSendRetryDelay() {
+ return sndRetryDelay;
+ }
+
+ /**
+ * @return Base UPD port number for grid time server.
+ */
+ public int getTimeServerPortBase() {
+ return timeSrvPortBase;
+ }
+
+ /**
+ * @return Number of ports to try before server initialization fails.
+ */
+ public int getTimeServerPortRange() {
+ return timeSrvPortRange;
+ }
+
+ /**
+ * @return Thread pool keep alive time (in milliseconds) to be used in grid for utility cache messages.
+ */
+ public long getUtilityCacheKeepAliveTime() {
+ return utilityCacheKeepAliveTime;
+ }
+
/** {@inheritDoc} */
@Override protected void writeExternalData(ObjectOutput out) throws IOException {
U.writeString(out, igniteInstanceName);
U.writeString(out, ggHome);
U.writeString(out, locHost);
- U.writeUuid(out, nodeId);
U.writeString(out, marsh);
U.writeEnum(out, deployMode);
out.writeObject(clientMode);
@@ -331,7 +485,22 @@ public class VisorBasicConfiguration extends VisorDataTransferObject {
out.writeBoolean(quiet);
U.writeString(out, successFile);
out.writeBoolean(updateNtf);
+ out.writeBoolean(activeOnStart);
+ U.writeString(out, addrRslvr);
+ out.writeBoolean(cacheSanityCheckEnabled);
+ U.writeString(out, clsLdr);
+ U.writeString(out, consistentId);
+ out.writeObject(failureDetectionTimeout);
+ U.writeString(out, igniteWorkDir);
+ out.writeBoolean(lateAffAssignment);
+ out.writeBoolean(marshLocJobs);
out.writeLong(metricsUpdateFreq);
+ out.writeObject(clientFailureDetectionTimeout);
+ out.writeInt(sndRetryCnt);
+ out.writeLong(sndRetryDelay);
+ out.writeInt(timeSrvPortBase);
+ out.writeInt(timeSrvPortRange);
+ out.writeLong(utilityCacheKeepAliveTime);
}
/** {@inheritDoc} */
@@ -339,7 +508,6 @@ public class VisorBasicConfiguration extends VisorDataTransferObject {
igniteInstanceName = U.readString(in);
ggHome = U.readString(in);
locHost = U.readString(in);
- nodeId = U.readUuid(in);
marsh = U.readString(in);
deployMode = DeploymentMode.fromOrdinal(in.readByte());
clientMode = (Boolean)in.readObject();
@@ -357,7 +525,22 @@ public class VisorBasicConfiguration extends VisorDataTransferObject {
quiet = in.readBoolean();
successFile = U.readString(in);
updateNtf = in.readBoolean();
+ activeOnStart = in.readBoolean();
+ addrRslvr = U.readString(in);
+ cacheSanityCheckEnabled = in.readBoolean();
+ clsLdr = U.readString(in);
+ consistentId = U.readString(in);
+ failureDetectionTimeout = (Long)in.readObject();
+ igniteWorkDir = U.readString(in);
+ lateAffAssignment = in.readBoolean();
+ marshLocJobs = in.readBoolean();
metricsUpdateFreq = in.readLong();
+ clientFailureDetectionTimeout = (Long)in.readObject();
+ sndRetryCnt = in.readInt();
+ sndRetryDelay = in.readLong();
+ timeSrvPortBase = in.readInt();
+ timeSrvPortRange = in.readInt();
+ utilityCacheKeepAliveTime = in.readLong();
}
/** {@inheritDoc} */