arjunashok commented on code in PR #144:
URL: https://github.com/apache/cassandra-sidecar/pull/144#discussion_r1911489238


##########
server/src/main/java/org/apache/cassandra/sidecar/job/DecommissionJob.java:
##########
@@ -0,0 +1,78 @@
+/*
+ * 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.cassandra.sidecar.job;
+
+import java.util.UUID;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.cassandra.sidecar.common.data.OperationalJobStatus;
+import org.apache.cassandra.sidecar.common.server.StorageOperations;
+import 
org.apache.cassandra.sidecar.common.server.exceptions.OperationalJobException;
+
+/**
+ * Implementation of {@link OperationalJob} to perform node decommission 
operation.
+ */
+public class DecommissionJob extends OperationalJob
+{
+    private static final Logger LOGGER = 
LoggerFactory.getLogger(DecommissionJob.class);
+    private static final String operation = "decommission";
+    private final boolean isForce;
+    protected StorageOperations storageOperations;
+
+    public DecommissionJob(UUID jobId, StorageOperations storageOps, boolean 
isForce)
+    {
+        super(jobId);
+        this.storageOperations = storageOps;
+        this.isForce = isForce;
+    }
+
+    @Override
+    public boolean isRunningOnCassandra()
+    {
+        return storageOperations.isDecommissioning();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+
+    protected OperationalJobStatus executeInternal() throws 
OperationalJobException
+    {
+        LOGGER.info("Executing decommission operation. jobId={}", jobId);
+        return storageOperations.decommission(isForce);

Review Comment:
   Yep, not needed here. The `execute` method is the one that wraps all 
execution exceptions into `OperationalJobException`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org
For additional commands, e-mail: pr-h...@cassandra.apache.org

Reply via email to