У меня есть класс TimeTask со ссылкой на другой класс. Теперь, когда я создаю ссылку на другой класс c; выполняется только блок stati c этого класса, а основной метод класса задач таймера не выполняется;
Возможно, я делаю какую-то ошибку ссылки, как в классе IbftUtil. java Я пытался сделать вещи одиночными, вводя этот блок c.
, пожалуйста, помогите.
IbftUtil. java
static {
try {
/******************** Read Properties file.. ***************/
LOGGER.println( LOG + " Loading properties file.." );
InputStream inputStream = new FileInputStream( new File( FMS_PROPERTY_FILE ) );
fmsProperties = new Properties();
fmsProperties.load( inputStream );
LOGGER.println( LOG + " Properties Loaded Successfully" );
inputStream.close();
LOGGER.println( LOG + " Reading properties values.. " );
// Timer attributes..
delayTime = Long.parseLong( fmsProperties.getProperty ( IBFT_DELAY_TIME ) );
executionTime = Long.parseLong( fmsProperties.getProperty ( IBFT_EXECUTION_TIME ) );
LOGGER.println( LOG + " IBFT DELAY & EXECUTION TIME = " + getDelayTime() + "," + getExecutionTime());
// Key-store and certificate ..
ibftReceiverCertificate = fmsProperties.getProperty( IBFT_RECEIVER_CERTIFICATE );
ibftSenderKeyStore = fmsProperties.getProperty( IBFT_SENDER_KEY_STORE );
ibftKeyStoreAlias = fmsProperties.getProperty( IBFT_KEY_STORE_ALIAS );
// Key store credentials..
ibftKeyStoreKey = fmsProperties.getProperty( IBFT_KEY_STORE_KEY );
ibftKeyStorePath = fmsProperties.getProperty( IBFT_KEY_STORE_PASS );
// Copy file path..
ibftPaymentFiles = fmsProperties.getProperty( IBFT_PAYMENT_FILES );
LOGGER.println( LOG + " Properties values read successfully!.. " );
/******************** Database Connection.. ********************/
LOGGER.println( LOG + " Connecting to Database" );
connection = DatabaseConnection.getDatabaseConnection().getConnection( FMS_POST_SOURCE );
connection.setAutoCommit( false );
LOGGER.println( LOG + " FMS Database Connected.." );
} catch ( Exception e ) {
LOGGER.println( LOG + " Exception in Singleton block " + e );
}
}
TimerTask. java
class IbftFileTimerTask extends TimerTask implements IConstants {
// Variables to hold to values returned from queries..
private String fundBankId = EMPTY_STRING;
private String fundId = EMPTY_STRING;
private String fundBankAccountNo = EMPTY_STRING;
private String productType = EMPTY_STRING;
private String ibftDirectoryName = EMPTY_STRING;
private String bankShortName = EMPTY_STRING;
private String ibftCallingView = EMPTY_STRING;
private String ibftFileName = EMPTY_STRING;
private String amcShortName = EMPTY_STRING;
private String cnicOrNtn = EMPTY_STRING;
private String paymentRecordId = EMPTY_STRING;
private String ibftDirectoryPath = EMPTY_STRING;
// Variable for Hard-coded product type..
private String fileProductType = EMPTY_STRING;
// ArrayList for holding paymentRecords Processed..
private ArrayList<String> paymentRecordIdList = null;
// File Sequence counter for appending in file name..
private int fileSequence = 0;
// Class Object for Utility Class..
private static IbftUtil util = new IbftUtil();
/**
* *******************************************************************************
* EPM FILE ENCRYPTION - SCHEDULER
* *******************************************************************************
*/
public void run() {
LOGGER.println( LOG + " Time = " + util.getSystemDate() );
LOGGER.println( LOG + " IBFT Payment Files timer starts.." );
try {
executor();
}
catch (Exception e) {
LOGGER.println( LOG + " Exception=" + e.getMessage() );
}
LOGGER.println( LOG + " IBFT Payment Files timer Ends.." );
}
@SuppressWarnings("static-access")
public static void main ( String[] args ) throws SQLException {
LOGGER.println( LOG + " ---- IBFT TIMER TASK ---- " );
// Instantiate Timer Object
Timer time = new Timer();
// Class object
IbftUtil util = new IbftUtil();
// Instantiate EPMTimerTask class
IbftFileTimerTask ibft = new IbftFileTimerTask();
// Create Repetitively task for every 2 minutes
time.schedule( ibft, util.delayTime, util.executionTime );
}