You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by GitBox <gi...@apache.org> on 2022/08/19 06:53:42 UTC

[GitHub] [incubator-seatunnel] hailin0 commented on a diff in pull request #2472: [Engine][ResourceManager] Resource manager interface draft

hailin0 commented on code in PR #2472:
URL: https://github.com/apache/incubator-seatunnel/pull/2472#discussion_r949858049


##########
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/resourcemanager/resource/SlotProfile.java:
##########
@@ -0,0 +1,69 @@
+/*
+ * 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.seatunnel.engine.server.resourcemanager.resource;
+
+import com.hazelcast.cluster.Address;
+
+public class SlotProfile {
+
+    private final Address worker;
+
+    private final int slotID;
+
+    private long ownerJobID;
+
+    private volatile boolean assigned;
+
+    private final ResourceProfile resourceProfile;
+
+    public SlotProfile(Address worker, int slotID, ResourceProfile resourceProfile) {
+        this.worker = worker;
+        this.slotID = slotID;
+        this.resourceProfile = resourceProfile;
+    }
+
+    public Address getWorker() {
+        return worker;
+    }
+
+    public int getSlotID() {
+        return slotID;
+    }
+
+    public ResourceProfile getResourceProfile() {
+        return resourceProfile;
+    }
+
+    public long getOwnerJobID() {
+        return ownerJobID;
+    }
+
+    public void assign(long jobID) {
+        if (assigned) {
+            // TODO custom exception
+            throw new UnsupportedOperationException();
+        } else {
+            ownerJobID = jobID;
+            assigned = true;
+        }
+    }
+
+    public void unassigned() {
+        assigned = false;
+    }

Review Comment:
   Is there multi-threaded access here?



-- 
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: commits-unsubscribe@seatunnel.apache.org

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