Skip to content

The DGAppStartup library provides a straightforward, performant way to initialize components at application startup. Both library developers and app developers can use DGAppStartup to streamline startup sequences and explicitly set the order of initialization.

Notifications You must be signed in to change notification settings

Caij/DGAppStartup

Repository files navigation

DGAppStartup

The DGAppStartup library provides a straightforward, performant way to initialize components at application startup. Both library developers and app developers can use DGAppStartup to streamline startup sequences and explicitly set the order of initialization.

At the same time, the DGAppStartup support async await and sync await. And topological ordering is used to ensure the initialization order of dependent components.

Dependency

Then, add the library to your module build.gradle

dependencies {
    implementation 'io.github.caij:DGAppStartup:1.2.1'
}

For example

Config config = new Config();
config.isStrictMode = BuildConfig.DEBUG;
new DGAppStartup.Builder()
        .add(new MainTaskA())
        .add(new MainTaskB())
        .add(new MainTaskC())
        .add(new TaskD())
        .add(new TaskE())
        .setConfig(config)
        .addTaskListener(new MonitorTaskListener(Tag.TAG, true))
        .setExecutorService(ThreadManager.getInstance().WORK_EXECUTOR)
        .addOnProjectExecuteListener(new OnProjectListener() {
            @Override
            public void onProjectStart() {

            }

            @Override
            public void onProjectFinish() {

            }

            @Override
            public void onStageFinish() {

            }
        })
        .create()
        .start();

Related Articles

框架篇DGAppStartup

License

Copyright 2021 Caij

Licensed 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.

About

The DGAppStartup library provides a straightforward, performant way to initialize components at application startup. Both library developers and app developers can use DGAppStartup to streamline startup sequences and explicitly set the order of initialization.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages