-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make OperationInitializer non-static (#4919)
This patch makes the OperationInitializer part of the ExecutionContext, allowing consumers to specify a preferred instance. ThreadInitializationFactory is also changed to be built in Dagger instead of only by configuration. Combined, these changes make it easier to reason about startup, requiring that dependencies are declared explicitly rather than implicitly referenced and used. It is likely that some of the work done here should be refactored further into some JobScheduler factory or assisted injection, but OperationInitializer is still referenced directly by InitialFilterExecution, so this would require more refactoring. Ideally, OperationInitializer.NON_PARALLELIZABLE would be used instead of the OperationInitializerThreadPool's threadlocal, but some services restore the user's own exec context - this is a shortcoming of the patch, and possibly should be resolved before merging. Downstream users will need to consider if they want to capture the OperationInitializer when they create new exec contexts - generally this will be desired. Partial #4040
- Loading branch information
Showing
46 changed files
with
390 additions
and
197 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
54 changes: 10 additions & 44 deletions
54
Util/src/main/java/io/deephaven/util/thread/ThreadInitializationFactory.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
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
engine/context/src/main/java/io/deephaven/engine/context/PoisonedOperationInitializer.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 @@ | ||
package io.deephaven.engine.context; | ||
|
||
import io.deephaven.engine.updategraph.OperationInitializer; | ||
import io.deephaven.util.ExecutionContextRegistrationException; | ||
|
||
import java.util.concurrent.Future; | ||
|
||
public class PoisonedOperationInitializer implements OperationInitializer { | ||
|
||
public static final PoisonedOperationInitializer INSTANCE = new PoisonedOperationInitializer(); | ||
|
||
private <T> T fail() { | ||
throw ExecutionContextRegistrationException.onFailedComponentAccess("OperationInitializer"); | ||
} | ||
|
||
@Override | ||
public boolean canParallelize() { | ||
return fail(); | ||
} | ||
|
||
@Override | ||
public Future<?> submit(Runnable runnable) { | ||
return fail(); | ||
} | ||
|
||
@Override | ||
public int parallelismFactor() { | ||
return fail(); | ||
} | ||
} |
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
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
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
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
Oops, something went wrong.