Repository: ignite Updated Branches: refs/heads/ignite-3553 07f103018 -> abed23b26
Added in-out operation descriptors. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/0275af3b Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/0275af3b Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/0275af3b Branch: refs/heads/ignite-3553 Commit: 0275af3bec6ccf70e08d0b04ee5f719806f0e730 Parents: 07f1030 Author: vozerov-gridgain <[email protected]> Authored: Wed Jul 27 10:43:22 2016 +0300 Committer: vozerov-gridgain <[email protected]> Committed: Wed Jul 27 10:43:22 2016 +0300 ---------------------------------------------------------------------- .../client/IgfsClientClosureInOperation.java | 64 +++++++++++++++++ .../igfs/client/IgfsClientClosureManager.java | 29 +++++++- .../client/IgfsClientClosureOutOperation.java | 76 ++++++++++++++++++++ .../igfs/client/IgfsClientClosureResponse.java | 4 ++ 4 files changed, 172 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/0275af3b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientClosureInOperation.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientClosureInOperation.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientClosureInOperation.java new file mode 100644 index 0000000..13a34ed --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientClosureInOperation.java @@ -0,0 +1,64 @@ +/* + * 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.processors.igfs.client; + +import org.apache.ignite.internal.IgniteInternalFuture; +import org.apache.ignite.internal.util.typedef.internal.S; + +import java.util.UUID; + +/** + * IGFS client closure incoming opeartion descriptor. + */ +public class IgfsClientClosureInOperation { + /** Target node ID. */ + private final UUID nodeId; + + /** Target operation. */ + private final IgfsClientAbstractCallable target; + + /** + * Constructor. + * + * @param nodeId Target node ID. + * @param target Target operation. + */ + public IgfsClientClosureInOperation(UUID nodeId, IgfsClientAbstractCallable target) { + this.nodeId = nodeId; + this.target = target; + } + + /** + * @return Target node ID. + */ + public UUID nodeId() { + return nodeId; + } + + /** + * @return Target operation. + */ + public IgfsClientAbstractCallable target() { + return target; + } + + /** {@inheritDoc} */ + @Override public String toString() { + return S.toString(IgfsClientClosureInOperation.class, this); + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/0275af3b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientClosureManager.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientClosureManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientClosureManager.java index bdd5ed7..760a1b2 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientClosureManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientClosureManager.java @@ -28,6 +28,8 @@ import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.marshaller.Marshaller; import org.jetbrains.annotations.Nullable; +import java.util.UUID; +import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentLinkedDeque; /** @@ -37,6 +39,8 @@ public class IgfsClientClosureManager extends IgfsManager { /** Pending closures received when manager is not started yet. */ private final ConcurrentLinkedDeque startupClos = new ConcurrentLinkedDeque(); + private final Map<Long, Operation> ops = new ConcurrentHashMap<>(); + /** Marshaller. */ private final Marshaller marsh; @@ -106,7 +110,7 @@ public class IgfsClientClosureManager extends IgfsManager { * @param marsh Marshaller. * @return Response. */ - public IgfsClientClosureResponse createResponse(long msgId, @Nullable Object res, @Nullable Throwable resErr, + private IgfsClientClosureResponse createResponse(long msgId, @Nullable Object res, @Nullable Throwable resErr, Marshaller marsh) { try { @@ -131,8 +135,31 @@ public class IgfsClientClosureManager extends IgfsManager { } } + /** + * Handle node leave event. + * + * @param nodeId Node ID. + */ + private void onNodeLeft(UUID nodeId) { + // TODO + } + /** {@inheritDoc} */ @Override public String toString() { return S.toString(IgfsClientClosureManager.class, this); } + + /** + * Outgoing operation. + */ + private static class OutOperation { + /** Target node ID. */ + private final UUID nodeId; + + /** Target operation. */ + private final IgfsClientAbstractCallable target; + + /** Future, completed when operation is ready. */ + private final IgniteInternalFuture fut; + } } http://git-wip-us.apache.org/repos/asf/ignite/blob/0275af3b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientClosureOutOperation.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientClosureOutOperation.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientClosureOutOperation.java new file mode 100644 index 0000000..2eb15a6 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientClosureOutOperation.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.processors.igfs.client; + +import org.apache.ignite.internal.IgniteInternalFuture; +import org.apache.ignite.internal.util.typedef.internal.S; + +import java.util.UUID; + +/** + * IGFS client closure outgoing opeartion descriptor. + */ +public class IgfsClientClosureOutOperation { + /** Target node ID. */ + private final UUID nodeId; + + /** Target operation. */ + private final IgfsClientAbstractCallable target; + + /** Future completed when operation is ready. */ + private final IgniteInternalFuture fut; + + /** + * Constructor. + * + * @param nodeId Target node ID. + * @param target Target operation. + * @param fut Future completed when operation is ready. + */ + public IgfsClientClosureOutOperation(UUID nodeId, IgfsClientAbstractCallable target, IgniteInternalFuture fut) { + this.nodeId = nodeId; + this.target = target; + this.fut = fut; + } + + /** + * @return Target node ID. + */ + public UUID nodeId() { + return nodeId; + } + + /** + * @return Target operation. + */ + public IgfsClientAbstractCallable target() { + return target; + } + + /** + * @return Future completed when operation is ready. + */ + public IgniteInternalFuture future() { + return fut; + } + + /** {@inheritDoc} */ + @Override public String toString() { + return S.toString(IgfsClientClosureOutOperation.class, this); + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/0275af3b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientClosureResponse.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientClosureResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientClosureResponse.java index 7d0d0d7..40e2802 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientClosureResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientClosureResponse.java @@ -17,6 +17,8 @@ package org.apache.ignite.internal.processors.igfs.client; +import org.apache.ignite.internal.util.tostring.GridToStringExclude; +import org.apache.ignite.internal.util.tostring.GridToStringInclude; import org.apache.ignite.internal.util.typedef.internal.S; import org.apache.ignite.plugin.extensions.communication.Message; import org.apache.ignite.plugin.extensions.communication.MessageReader; @@ -36,9 +38,11 @@ public class IgfsClientClosureResponse implements Message { private IgfsClientClosureResponseType typ; /** Result. */ + @GridToStringInclude private Object res; /** Result bytes. */ + @GridToStringExclude private byte[] resBytes; /**
