Example usage for org.springframework.batch.core.scope.context JobContext registerDestructionCallback

List of usage examples for org.springframework.batch.core.scope.context JobContext registerDestructionCallback

Introduction

In this page you can find the example usage for org.springframework.batch.core.scope.context JobContext registerDestructionCallback.

Prototype

public void registerDestructionCallback(String name, Runnable callback) 

Source Link

Document

Allow clients to register callbacks for clean up on close.

Usage

From source file:org.springframework.batch.core.scope.JobScope.java

/**
 * @see Scope#registerDestructionCallback(String, Runnable)
 *//* ww  w  .  j a  v  a  2 s  .c om*/
@Override
public void registerDestructionCallback(String name, Runnable callback) {
    JobContext context = getContext();
    if (logger.isDebugEnabled()) {
        logger.debug(
                String.format("Registered destruction callback in scope=%s, name=%s", this.getName(), name));
    }
    context.registerDestructionCallback(name, callback);
}