IOExitProperties.java interface
IOExitProperties.java
/* * Licensed Materials - Property of IBM * * "Restricted Materials of IBM" * * 5724-H72 * * Copyright IBM Corp. 2011, 2020. All Rights Reserved. * * disclosure restricted by GSA ADP Schedule Contract with * IBM Corp. */ package com.ibm.wmqfte.exitroutine.api; /** * Properties that determine how WMQFTE treats an {@link IOExitPath} for certain * aspects of I/O. For example, whether to use intermediate files. */ public class IOExitProperties { private boolean rereadSourceOnRestart = true; private boolean rechecksumSourceOnRestart = true; private boolean rechecksumDestinationOnRestart = true; private boolean useIntermediateFileAtDestination = true; private boolean requiresSingleThreadedChannelIO = false; /** * Determines whether the I/O exit implementation expects the resource to be * re-read from the start if a transfer is restarted. * * @return {@code true} if, on restart, the I/O exit expects the source * resource to be opened at the beginning and re-read from the * beginning (the {@link IOExitPath#openForRead(long)} method is * always invoked with 0L as an argument). {@code false} if, on * restart, the I/O exit expects the source to be opened at the * offset that the source agent intends to start reading from (the * {@link IOExitPath#openForRead(long)} method can be invoked with a * non-zero value as its argument). */ public boolean getRereadSourceOnRestart() { return rereadSourceOnRestart; } /** * Sets the value to determine whether the I/O exit implementation expects * the resource to be re-read from the beginning if a transfer is restarted. * <p> * The default is {@code true}. The I/O exit should call this method when * required to change this value. * * @param rereadSourceOnRestart * {@code true} if, on restart, the I/O exit expects the source * resource to be opened at the beginning and re-read from the * beginning (the {@link IOExitPath#openForRead(long)} method * is always invoked with 0L as an argument). {@code false} * if, on restart, the I/O exit expects the source to be opened * at the offset that the source agent intends to start reading * from (the {@link IOExitPath#openForRead(long)} method can be * invoked with a non-zero value as its argument). */ public void setRereadSourceOnRestart(boolean rereadSourceOnRestart) { this.rereadSourceOnRestart = rereadSourceOnRestart; } /** * Determines whether the I/O exit implementation requires the source * resource to be re-checksummed if the transfer is restarted. * Re-checksumming takes place only if the * {@link #getRereadSourceOnRestart()} method returns {@code true}. * * @return {@code true} if, on restart, the I/O exit expects the already- * transferred portion of the source to be re-checksummed for * inconsistencies. Use this option in environments * where the source could be changed during a restart. {@code * false} if, on restart, the I/O exit does not require the * already-transferred portion of the source to be re-checksummed. */ public boolean getRechecksumSourceOnRestart() { return rechecksumSourceOnRestart; } /** * Sets the value to determine whether the I/O exit implementation requires * the source resource to be re-checksummed if the transfer is restarted. * Re-checksumming takes place only if the * {@link #getRereadSourceOnRestart()} method returns {@code true}. * <p> * The default is {@code true}. The I/O exit should call this method when * required to change this value. * * @param rechecksumSourceOnRestart * {@code true} if, on restart, the I/O exit expects the already * transferred portion of the source to be re-checksummed * for inconsistencies. Use this option in environments * where the source could be changed during a restart. * {@code false} if, on restart, the I/O exit does not * require the already-transferred portion of the source to be * re-checksummed. */ public void setRechecksumSourceOnRestart(boolean rechecksumSourceOnRestart) { this.rechecksumSourceOnRestart = rechecksumSourceOnRestart; } /** * Determines whether the I/O exit implementation requires the destination * resource to be re-checksummed if the transfer is restarted. * * @return {@code true} if, on restart, the I/O exit expects the already * transferred portion of the destination to be re-checksummed to * check for inconsistencies. This option should be used in * environments where the destination could have been changed while * a restart is occurring. {@code false} if, on restart, the I/O exit * does not require the already transferred portion of the * destination to be re-checksummed. */ public boolean getRechecksumDestinationOnRestart() { return rechecksumDestinationOnRestart; } /** * Sets the value to determine whether the I/O exit implementation requires * the destination resource to be re-checksummed if the transfer is * restarted. * <p> * The default is {@code true}. The I/O exit should call this method when * required to change this value. * * @param rechecksumDestinationOnRestart * {@code true} if, on restart, the I/O exit expects the already- * transferred portion of the destination to be re-checksummed * for inconsistencies. Use this option in environments * where the destination could have been changed during a * restart. {@code false} if, on restart, the I/O exit does not * require the already-transferred portion of the destination * to be re-checksummed. */ public void setRechecksumDestinationOnRestart( boolean rechecksumDestinationOnRestart) { this.rechecksumDestinationOnRestart = rechecksumDestinationOnRestart; } /** * Determines whether the I/O exit implementation requires the use of an * intermediate file when writing the data at the destination. The * intermediate file mechanism is typically used to prevent an incomplete * destination resource from being processed. * * @return {@code true} if data should be written to an intermediate file at * the destination and then renamed (to the requested destination * path name as specified in the transfer request) after the transfer is * complete. {@code false} if data should be written directly to the * requested destination path name without the use of an * intermediate file. */ public boolean getUseIntermediateFileAtDestination() { return useIntermediateFileAtDestination; } /** * Sets the value to determine whether the I/O exit implementation requires * the use of an intermediate file when writing the data at the destination. * The intermediate file mechanism is typically used to prevent an * incomplete destination resource from being processed. * * <p> * The default is {@code true}. The I/O exit should call this method when * required to change this value. * * @param useIntermediateFileAtDestination * {@code true} if data should be written to an intermediate file * at the destination and then renamed (to the requested * destination path name as specified in the transfer request) after * the transfer is complete. {@code false} if data should be written * directly to the requested destination path name without the * use of an intermediate file */ public void setUseIntermediateFileAtDestination( boolean useIntermediateFileAtDestination) { this.useIntermediateFileAtDestination = useIntermediateFileAtDestination; } /** * Determines whether the I/O exit implementation requires * {@link IOExitChannel} instances to be accessed by a single thread only. * * @return {@code true} if {@link IOExitChannel} instances are to be * accessed by a single thread only. */ public boolean requiresSingleThreadedChannelIO() { return requiresSingleThreadedChannelIO; } /** * Sets the value to determine whether the I/O exit implementation requires * channel operations for a particular instance to be accessed by a * single thread only. * <p> * For certain I/O implementations it is necessary that resource path * operations such as open, read, write, and close are invoked only from a * single execution {@link Thread}. When set {@code true}, WMQFTE ensures * that the following are invoked on a single thread: * <ul> * <li>{@link IOExitResourcePath#openForRead(long) method and all methods of * the returned {@link IOExitChannel} instance.</li> * <li>{@link IOExitResourcePath#openForWrite(boolean)) method and all * methods of the returned {@link IOExitChannel} instance.</li> * </ul> * <p> * This has a slight performance impact, hence enable single-threaded channel * I/O only when absolutely necessary. * <p> * The default is {@code false}. The I/O exit should call this method when * required to change this value. * * @param requiresSingleThreadedChannelIO * {@code true} if {@link IOExitChannel} instances are to be * accessed by a single thread only. */ public void setRequiresSingleThreadedChannelIO(boolean requiresSingleThreadedChannelIO) { this.requiresSingleThreadedChannelIO = requiresSingleThreadedChannelIO; } }