forked from eclipse-hawkbit/hawkbit
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce parallel rollout processing (eclipse-hawkbit#2248)
* Introduce parallel rollout processing Signed-off-by: Denislav Prinov <[email protected]> * Moving the ThreadPoolTaskExecutor initialization in RolloutScheduler. Changing to previous default behaviour when the thread pool size is <=1 Signed-off-by: Denislav Prinov <[email protected]> * Refactoring Signed-off-by: Denislav Prinov <[email protected]> * Refactoring based on review comments Signed-off-by: Denislav Prinov <[email protected]> * License header fix Signed-off-by: Denislav Prinov <[email protected]> --------- Signed-off-by: Denislav Prinov <[email protected]>
- Loading branch information
1 parent
46caed1
commit 2d90737
Showing
3 changed files
with
89 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
...ory-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/rollout/BlockWhenFullPolicy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/** | ||
* Copyright (c) 2025 Contributors to the Eclipse Foundation | ||
* | ||
* This program and the accompanying materials are made | ||
* available under the terms of the Eclipse Public License 2.0 | ||
* which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*/ | ||
|
||
package org.eclipse.hawkbit.repository.jpa.rollout; | ||
|
||
import java.util.concurrent.RejectedExecutionException; | ||
import java.util.concurrent.RejectedExecutionHandler; | ||
import java.util.concurrent.ThreadPoolExecutor; | ||
|
||
public class BlockWhenFullPolicy implements RejectedExecutionHandler { | ||
@Override | ||
public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) { | ||
try { | ||
// Because queueCapacity=0 => SynchronousQueue | ||
// This put(...) call blocks if both threads are busy, | ||
// until a thread is free | ||
executor.getQueue().put(r); | ||
} catch (InterruptedException e) { | ||
Thread.currentThread().interrupt(); | ||
throw new RejectedExecutionException("Interrupted while waiting to queue task", e); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters