Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/krkarma777/javacoroutines
A Java library to implement coroutine-like functionality with @Suspend annotation, inspired by Kotlin's suspend functions.
https://github.com/krkarma777/javacoroutines
annotation-based-library asynchronous concurrency coroutines java kotlin-inspired non-blocking
Last synced: 3 days ago
JSON representation
A Java library to implement coroutine-like functionality with @Suspend annotation, inspired by Kotlin's suspend functions.
- Host: GitHub
- URL: https://github.com/krkarma777/javacoroutines
- Owner: krkarma777
- License: mit
- Created: 2024-06-13T14:58:01.000Z (7 months ago)
- Default Branch: master
- Last Pushed: 2024-06-15T04:36:20.000Z (7 months ago)
- Last Synced: 2024-11-09T16:24:09.177Z (about 2 months ago)
- Topics: annotation-based-library, asynchronous, concurrency, coroutines, java, kotlin-inspired, non-blocking
- Language: Java
- Homepage:
- Size: 80.1 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# JavaCoroutines
**JavaCoroutines** is a Java library that introduces coroutine-like functionality using the `@Suspend` annotation, inspired by Kotlin's `suspend` functions. This library allows you to write asynchronous and non-blocking code in Java with a similar approach to Kotlin coroutines.
## Features
- Simple `@Suspend` annotation to mark coroutine methods.
- Coroutine manager to handle coroutine execution and state management.
- Lightweight and easy to integrate into existing Java projects.## Getting Started
### Installation
Add the following dependency to your `build.gradle` file:
```gradle
dependencies {
implementation 'com.coroutines:java-coroutines:1.0-SNAPSHOT'
}
```### Usage
To use JavaCoroutines, simply annotate your methods with `@Suspend` and manage coroutines using the provided coroutine manager. Here is a basic example:
```java
import com.coroutines.Suspend;public class Example {
@Suspend
public void asyncMethod() {
// Your asynchronous code here
}public static void main(String[] args) {
Example example = new Example();
CoroutineManager manager = new CoroutineManager();
manager.run(example::asyncMethod);
}
}
```## Contributing
We welcome contributions of all kinds, including code, documentation, bug reports, and feature requests. Please read our [Contributing Guide](CONTRIBUTING.md) for more information.
## License
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.