object-shutdown-proxy

Create proxy for your java object to synchronously wait for all methods to finish calling.

License

License

Categories

Categories

Java Languages
GroupId

GroupId

com.dronjax.java
ArtifactId

ArtifactId

object-shutdown-proxy
Last Version

Last Version

1.0.1
Release Date

Release Date

Type

Type

jar
Description

Description

object-shutdown-proxy
Create proxy for your java object to synchronously wait for all methods to finish calling.
Project URL

Project URL

https://github.com/dronjax/java-object-shutdown-proxy
Source Code Management

Source Code Management

https://github.com/dronjax/java-object-shutdown-proxy

Download object-shutdown-proxy

How to add to project

<!-- https://jarcasting.com/artifacts/com.dronjax.java/object-shutdown-proxy/ -->
<dependency>
    <groupId>com.dronjax.java</groupId>
    <artifactId>object-shutdown-proxy</artifactId>
    <version>1.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.dronjax.java/object-shutdown-proxy/
implementation 'com.dronjax.java:object-shutdown-proxy:1.0.1'
// https://jarcasting.com/artifacts/com.dronjax.java/object-shutdown-proxy/
implementation ("com.dronjax.java:object-shutdown-proxy:1.0.1")
'com.dronjax.java:object-shutdown-proxy:jar:1.0.1'
<dependency org="com.dronjax.java" name="object-shutdown-proxy" rev="1.0.1">
  <artifact name="object-shutdown-proxy" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.dronjax.java', module='object-shutdown-proxy', version='1.0.1')
)
libraryDependencies += "com.dronjax.java" % "object-shutdown-proxy" % "1.0.1"
[com.dronjax.java/object-shutdown-proxy "1.0.1"]

Dependencies

runtime (2)

Group / Artifact Type Version
org.slf4j : slf4j-log4j12 jar 1.7.12
com.google.guava : guava jar 23.0

test (3)

Group / Artifact Type Version
org.testng : testng jar 6.14.3
org.mockito : mockito-core jar 1.10.19
org.apache.logging.log4j : log4j-slf4j18-impl jar 2.11.1

Project Modules

There are no modules declared in this project.

java-object-shutdown-proxy

Create proxy for your java object to synchronously wait for all methods to finish calling.

Background

For some services development, you might need to wait for a service to shutdown properly before doing some other process.

This library is to help with that, you can create a proxy of any java object and it will create a shutdown handler to give you control whether you want to wait for a service to shutdown or not.

Usage

To use it, you just need to construct ObjectShutdownProxyComponent and pass the service and the contract you want to return.

You can also selectively mark the method you want to wait during shutdown using CountForObjectShutdown annotation.

Example:

  // other codes
  final ObjectShutdownProxyComponent objectShutdownProxyComponent =
    ObjectShutdownProxyComponent.coverAllPublicClassMethod(
      constructService(),
      SomeService.class
    );
  final SomeService someService = objectShutdownProxyComponent.getProxiedService();
  final ShutdownHandler shutdownHandler = objectShutdownProxyComponent.getShutdownHandler();
  // other codes

You can utilize ShutdownHandler to wait for object shutdown.

License

Please see the LICENSE and comply before using.

Versions

Version
1.0.1
1.0.0