Package com.asakusafw.bulkloader.exception

Examples of com.asakusafw.bulkloader.exception.BulkLoaderReRunnableException


            @Override
            protected ImportProtocolDecide createImportProtocolDecide() {
                return new ImportProtocolDecide() {
                    @Override
                    public void execute(ImportBean bean) throws BulkLoaderReRunnableException {
                        throw new BulkLoaderReRunnableException(ImporterTest.class, "TG-IMPORTER-11005", "A", "b");
                    }
                };
            }
        };
        int result = importer.execute(args);
View Full Code Here


            @Override
            protected TargetDataLock createTargetDataLock() {
                return new StubTargetDataLock() {
                    @Override
                    public boolean lock(ImportBean bean) throws BulkLoaderReRunnableException {
                        throw new BulkLoaderReRunnableException(ImporterTest.class, "TG-IMPORTER-11005", "A", "b");
                    }
                };
            }
        };
        int result = importer.execute(args);
View Full Code Here

                        } catch (InterruptedException e2) {
                            throw new BulkLoaderSystemException(e2, getClass(), "TG-IMPORTER-02002");
                        }
                    } else {
                        // リトライ不可の場合、異常終了する。
                        throw new BulkLoaderReRunnableException(e, getClass(), "TG-IMPORTER-02003");
                    }
                }
            }
        } catch (BulkLoaderSystemException e) {
            LOG.log(e);
View Full Code Here

        Map<String, String> tableLock;
        try {
            tableLock = getImportTableLock(conn, bean.getImportTargetTableList().iterator());
        } catch (BulkLoaderSystemException e) {
            // リトライする
            throw new BulkLoaderReRunnableException(e.getCause(), getClass(), "TG-IMPORTER-02004",
                    "ロック取得処理の排他制御に失敗",
                    "IMPORT_TABLE_LOCK");
        }

        // Import対象テーブル毎に処理し、指定に応じてロックフラグを立てる
        List<String> list = bean.getImportTargetTableList();
        for (String tableName : list) {
            ImportTargetTableBean targetTable = bean.getTargetTable(tableName);
            ImportTableLockType lockType = targetTable.getLockType();
            ImportTableLockedOperation operation = targetTable.getLockedOperation();
            String serchCondition = targetTable.getSearchCondition();

            LOG.info("TG-IMPORTER-02009",
                    tableName, lockType, operation, serchCondition);

            // 「ロックしない」かつ「ロック有無に関わらず処理対象とする」の場合、ロックフラグは立てずに終了する。
            if (ImportTableLockType.NONE.equals(lockType)
                    && ImportTableLockedOperation.FORCE.equals(operation)) {
                LOG.info("TG-IMPORTER-02011", tableName);
                continue;
            }

            // テーブルにロックフラグが立っていないかチェックする
            String targetSid = tableLock.get(tableName);
            if (targetSid != null && !targetSid.isEmpty()) {
                // 「行ロック」「処理対象から外す」の場合、ロックを取得しないことで当該テーブルを処理対象としない
                if (ImportTableLockType.RECORD.equals(lockType)
                        && ImportTableLockedOperation.OFF.equals(operation)) {
                    LOG.info("TG-IMPORTER-02012", tableName);
                    continue;
                } else {
                    // ロック済みの動作が「エラーとする」の場合、リトライを行う。
                    // テーブルにロックフラグが立っている場合、リトライする
                    throw new BulkLoaderReRunnableException(getClass(), "TG-IMPORTER-02004",
                            "ロック対象テーブルのテーブルロックが取得されている",
                            tableName);
                }
            }

            // ロック取得範囲に応じてロックフラグを立てる
            if (ImportTableLockType.TABLE.equals(lockType)) {
                // テーブルロックの場合
                // 対象テーブルのレコードにロックフラグが立っていないかチェック
                if (!checkRecordLock(conn, tableName)) {
                    // リトライする
                    throw new BulkLoaderReRunnableException(getClass(), "TG-IMPORTER-02004",
                            "ロック対象テーブルのレコードロックが取得されている",
                            tableName);
                } else {
                    // IMPORT_TABLE_LOCKにロックフラグを立てる
                    tableLock(conn, tableName, jobflowSid);
                    continue;
                }
            } else if (ImportTableLockType.RECORD.equals(lockType)) {
                // 行ロックの場合
                // ロック対象のロックを取得できなかった場合の動作に応じて処理を行う
                if (ImportTableLockedOperation.OFF.equals(operation)) {
                    // 処理対象から外す場合、ロックフラグが立っていないレコードのみロックフラグを立てる
                    recordLock(conn, tableName, serchCondition, jobflowSid);
                    continue;
                } else if (ImportTableLockedOperation.ERROR.equals(operation)) {
                    // エラーとする場合、対象レコードにロックフラグが立っていないかチェックする
                    if (!checkRecordLock(conn, tableName, serchCondition)) {
                        // リトライする
                        throw new BulkLoaderReRunnableException(getClass(), "TG-IMPORTER-02004",
                                "ロック対象テーブルのレコードロックが取得されている",
                                tableName);
                    } else {
                        // 対象レコードにロックフラグを立てる
                        recordLock(conn, tableName, serchCondition, jobflowSid);
                        continue;
                    }
                }
            } else if (ImportTableLockType.NONE.equals(lockType)) {
                // ロックを取得しない場合
                // ロック対象のロックを取得できなかった場合の動作に応じて処理を行う
                // ここに到達するのは「エラーとする」のみ
                // 対象レコードにロックフラグが立っていないかチェックする
                if (!checkRecordLock(conn, tableName, serchCondition)) {
                    // リトライする
                    throw new BulkLoaderReRunnableException(getClass(), "TG-IMPORTER-02004",
                            "ロック対象テーブルのレコードロックが取得されている",
                            tableName);
                } else {
                    // ロックフラグは立てずに終了する。
                    LOG.info("TG-IMPORTER-02013", tableName);
View Full Code Here

                assert tableInfo.getImportProtocol() != null;
                continue;
            }
            boolean locked = repository.tryLock(bean.getExecutionId(), tableInfo.getCacheId(), tableName);
            if (locked == false) {
                throw new BulkLoaderReRunnableException(getClass(), "TG-IMPORTER-11005",
                        tableName,
                        tableInfo.getCacheId());
            }
        }
    }
View Full Code Here

            LOG.info("TG-EXPORTER-04004", selectSql.toString());
            stmt = conn.prepareStatement(selectSql.toString());
            DBConnection.executeQuery(stmt, selectSql.toString(), new String[0]);

        } catch (SQLException e) {
            throw new BulkLoaderReRunnableException(
                    e,
                    this.getClass(),
                    "TG-EXPORTER-04003",
                    "IMPORT_TABLE_LOCKテーブルのロック取得に失敗");
        } finally {
View Full Code Here

TOP

Related Classes of com.asakusafw.bulkloader.exception.BulkLoaderReRunnableException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.