Package redis.clients.jedis
Class ResourceLifecycleManager
- java.lang.Object
-
- redis.clients.jedis.ResourceLifecycleManager
-
public class ResourceLifecycleManager extends java.lang.ObjectManages the lifecycle of Jedis resources including connection tracking, cleanup scheduling, and resource monitoring.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classResourceLifecycleManager.ManagedResourceResource wrapper that provides additional lifecycle information.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidforceCleanupAll()Force cleanup of all tracked resources.static ResourceLifecycleManagergetInstance()intgetTrackedResourceCount()Get the number of currently tracked resources.booleanisShutdown()Check if the lifecycle manager is shutdown.java.lang.StringregisterResource(java.lang.AutoCloseable resource)Register a resource for lifecycle tracking.voidscheduleCleanup(java.lang.AutoCloseable resource, long delaySeconds)Schedule a resource for delayed cleanup.voidshutdown()Shutdown the lifecycle manager and cleanup all resources.voidunregisterResource(java.lang.String resourceId)Unregister a resource from lifecycle tracking.
-
-
-
Method Detail
-
getInstance
public static ResourceLifecycleManager getInstance()
-
registerResource
public java.lang.String registerResource(java.lang.AutoCloseable resource)
Register a resource for lifecycle tracking.- Parameters:
resource- the resource to track- Returns:
- unique resource ID
-
unregisterResource
public void unregisterResource(java.lang.String resourceId)
Unregister a resource from lifecycle tracking.- Parameters:
resourceId- the resource ID to unregister
-
scheduleCleanup
public void scheduleCleanup(java.lang.AutoCloseable resource, long delaySeconds)Schedule a resource for delayed cleanup.- Parameters:
resource- the resource to cleanupdelaySeconds- delay before cleanup in seconds
-
getTrackedResourceCount
public int getTrackedResourceCount()
Get the number of currently tracked resources.- Returns:
- number of tracked resources
-
forceCleanupAll
public void forceCleanupAll()
Force cleanup of all tracked resources. This should only be used in emergency situations.
-
shutdown
public void shutdown()
Shutdown the lifecycle manager and cleanup all resources.
-
isShutdown
public boolean isShutdown()
Check if the lifecycle manager is shutdown.- Returns:
- true if shutdown
-
-