Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id A2C0A200C5B for ; Thu, 27 Apr 2017 17:02:41 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id A16B6160BA7; Thu, 27 Apr 2017 15:02:41 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 72C3D160BB2 for ; Thu, 27 Apr 2017 17:02:38 +0200 (CEST) Received: (qmail 22521 invoked by uid 500); 27 Apr 2017 15:02:37 -0000 Mailing-List: contact commits-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list commits@ignite.apache.org Received: (qmail 22403 invoked by uid 99); 27 Apr 2017 15:02:36 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 27 Apr 2017 15:02:36 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 47578E04B1; Thu, 27 Apr 2017 15:02:36 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sboikov@apache.org To: commits@ignite.apache.org Date: Thu, 27 Apr 2017 15:02:39 -0000 Message-Id: In-Reply-To: <5f51fd9b11424d99a60609be60c128b9@git.apache.org> References: <5f51fd9b11424d99a60609be60c128b9@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [04/28] ignite git commit: IGNITE-4988 Rework Visor task arguments. Code cleanup for ignite-2.0. archived-at: Thu, 27 Apr 2017 15:02:41 -0000 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 { +public class VisorCacheStopTask extends VisorOneNodeTask { /** */ 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 { + private static class VisorCacheStopJob extends VisorJob { /** */ private static final long serialVersionUID = 0L; @@ -49,14 +49,19 @@ public class VisorCacheStopTask extends VisorOneNodeTask { * @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 { 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 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>, Void, Void> { +public class VisorComputeCancelSessionsTask extends VisorMultiNodeTask { /** */ private static final long serialVersionUID = 0L; /** {@inheritDoc} */ - @Override protected VisorComputeCancelSessionsJob job(Map> arg) { + @Override protected VisorComputeCancelSessionsJob job(VisorComputeCancelSessionsTaskArg arg) { return new VisorComputeCancelSessionsJob(arg, debug); } @@ -53,7 +52,7 @@ public class VisorComputeCancelSessionsTask extends VisorMultiNodeTask>, Void> { + private static class VisorComputeCancelSessionsJob extends VisorJob { /** */ private static final long serialVersionUID = 0L; @@ -61,13 +60,13 @@ public class VisorComputeCancelSessionsTask extends VisorMultiNodeTask> arg, boolean debug) { + private VisorComputeCancelSessionsJob(VisorComputeCancelSessionsTaskArg arg, boolean debug) { super(arg, debug); } /** {@inheritDoc} */ - @Override protected Void run(Map> arg) { - Set sesIds = arg.get(ignite.localNode().id()); + @Override protected Void run(VisorComputeCancelSessionsTaskArg arg) { + Set 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> sesIds; + + /** + * Default constructor. + */ + public VisorComputeCancelSessionsTaskArg() { + // No-op. + } + + /** + * @param sesIds Session IDs to cancel. + */ + public VisorComputeCancelSessionsTaskArg(Map> sesIds) { + this.sesIds = sesIds; + } + + /** + * @return Session IDs to cancel. + */ + public Map> 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 { /** */ private static final int JOB_ARG_IDX = 3; + /** Array with additional length in arguments for specific nested types */ + private static final Map 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 { * 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 res = cls == Collection.class ? new ArrayList<>() : new HashSet<>(); + Collection 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 { 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 { Map 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 { } 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 { 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 { 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 { 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 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 { +public class VisorIgfsFormatTask extends VisorOneNodeTask { /** */ 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 { + private static class VisorIgfsFormatJob extends VisorJob { /** */ private static final long serialVersionUID = 0L; @@ -47,17 +47,17 @@ public class VisorIgfsFormatTask extends VisorOneNodeTask { * @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 { +public class VisorIgfsProfilerClearTask extends VisorOneNodeTask { /** */ 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 { + private static class VisorIgfsProfilerClearJob extends VisorJob { /** */ private static final long serialVersionUID = 0L; @@ -56,23 +61,23 @@ public class VisorIgfsProfilerClearTask extends VisorOneNodeTask dirStream = Files.newDirectoryStream(logsDir)) { for (Path p : dirStream) { @@ -99,7 +104,7 @@ public class VisorIgfsProfilerClearTask extends VisorOneNodeTask> { +public class VisorIgfsProfilerTask extends VisorOneNodeTask> { /** */ private static final long serialVersionUID = 0L; @@ -140,14 +140,14 @@ public class VisorIgfsProfilerTask extends VisorOneNodeTask> { + private static class VisorIgfsProfilerJob extends VisorJob> { /** */ private static final long serialVersionUID = 0L; @@ -196,22 +196,24 @@ public class VisorIgfsProfilerTask extends VisorOneNodeTask run(String arg) { + @Override protected List 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, Void> { +public class VisorIgfsResetMetricsTask extends VisorOneNodeTask { /** */ private static final long serialVersionUID = 0L; /** {@inheritDoc} */ - @Override protected VisorIgfsResetMetricsJob job(Set arg) { + @Override protected VisorIgfsResetMetricsJob job(VisorIgfsResetMetricsTaskArg arg) { return new VisorIgfsResetMetricsJob(arg, debug); } /** * Job that reset IGFS metrics. */ - private static class VisorIgfsResetMetricsJob extends VisorJob, Void> { + private static class VisorIgfsResetMetricsJob extends VisorJob { /** */ private static final long serialVersionUID = 0L; @@ -48,13 +47,13 @@ public class VisorIgfsResetMetricsTask extends VisorOneNodeTask, Voi * @param arg IGFS names. * @param debug Debug flag. */ - private VisorIgfsResetMetricsJob(Set arg, boolean debug) { + private VisorIgfsResetMetricsJob(VisorIgfsResetMetricsTaskArg arg, boolean debug) { super(arg, debug); } /** {@inheritDoc} */ - @Override protected Void run(Set 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 igfsNames; + + /** + * Default constructor. + */ + public VisorIgfsResetMetricsTaskArg() { + // No-op. + } + + /** + * @param igfsNames IGFS names. + */ + public VisorIgfsResetMetricsTaskArg(Set igfsNames) { + this.igfsNames = igfsNames; + } + + /** + * @return IGFS names. + */ + public Set 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 { +public class VisorAckTask extends VisorMultiNodeTask { /** */ 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 { /** * Ack job to run on node. */ - private static class VisorAckJob extends VisorJob { + private static class VisorAckJob extends VisorJob { /** */ private static final long serialVersionUID = 0L; @@ -56,13 +56,13 @@ public class VisorAckTask extends VisorMultiNodeTask { * @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(": ack: " + (arg == null ? ignite.localNode().id() : arg)); + @Override protected Void run(VisorAckTaskArg arg) { + System.out.println(": ack: " + (arg.getMessage() == null ? ignite.localNode().id() : arg.getMessage())); return null; } @@ -72,4 +72,4 @@ public class VisorAckTask extends VisorMultiNodeTask { 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 { +public class VisorChangeGridActiveStateTask extends VisorOneNodeTask { /** */ 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 { + private static class VisorChangeGridActiveStateJob extends VisorJob { /** */ private static final long serialVersionUID = 0L; @@ -46,13 +46,13 @@ public class VisorChangeGridActiveStateTask extends VisorOneNodeTask