[ https://issues.apache.org/jira/browse/FLINK-8087?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16290541#comment-16290541 ]
ASF GitHub Bot commented on FLINK-8087: --------------------------------------- Github user tillrohrmann commented on a diff in the pull request: https://github.com/apache/flink/pull/5088#discussion_r156880342 --- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/instance/AllocatedSlot.java --- @@ -144,6 +144,78 @@ public TaskManagerGateway getTaskManagerGateway() { return taskManagerGateway; } + /** + * Triggers the release of the logical slot. + */ + public void triggerLogicalSlotRelease() { + final LogicalSlot logicalSlot = logicalSlotReference.get(); + + if (logicalSlot != null) { + logicalSlot.releaseSlot(); + } + } + + /** + * Releases the logical slot. + * + * @return true if the logical slot could be released, false otherwise. + */ + public boolean releaseLogicalSlot() { + final LogicalSlot logicalSlot = logicalSlotReference.get(); + + if (logicalSlot != null) { + if (logicalSlot instanceof Slot) { + final Slot slot = (Slot) logicalSlot; + if (slot.markReleased()) { + logicalSlotReference.set(null); + return true; + } + } else { + throw new RuntimeException("Unsupported logical slot type encounterd " + logicalSlot.getClass()); --- End diff -- Good catch. Will correct it. > Decouple Slot from SlotPool > --------------------------- > > Key: FLINK-8087 > URL: https://issues.apache.org/jira/browse/FLINK-8087 > Project: Flink > Issue Type: Improvement > Components: Distributed Coordination > Affects Versions: 1.5.0 > Reporter: Till Rohrmann > Assignee: Till Rohrmann > Labels: flip-6 > > In order to let the {{SlotPool}} return a a different {{LogicalSlot}} > implementation than {{SimpleSlot}} we should not store the {{Slot}} inside of > the {{SlotPool}}. Moreover, we should introduce a abstraction for the > {{AllocatedSlot}} which contains the information required by the > {{SimpleSlot}}. That way we decouple the {{SimpleSlot}} from the > {{AllocatedSlot}}. -- This message was sent by Atlassian JIRA (v6.4.14#64029)