congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
TransactionRuntimeException
Code IndexAdd Tabnine to your IDE (free)

How to use
TransactionRuntimeException
in
org.dromara.raincat.common.exception

Best Java code snippets using org.dromara.raincat.common.exception.TransactionRuntimeException (Showing top 16 results out of 315)

origin: yu199195/Raincat

public static void notNull(Object obj) {
  if (obj == null) {
    throw new TransactionRuntimeException("argument invalid,Please check");
  }
}
origin: yu199195/Raincat

public static void checkConditionArgument(boolean condition, String message) {
  if (!condition) {
    throw new TransactionRuntimeException(message);
  }
}
origin: yu199195/Raincat

public static void notNull(Object obj, String message) {
  if (obj == null) {
    throw new TransactionRuntimeException(message);
  }
}
origin: yu199195/Raincat

public BlockTask getTask(final String key) {
  try {
    return LOADING_CACHE.get(key);
  } catch (ExecutionException e) {
    throw new TransactionRuntimeException(e.getCause());
  }
}
origin: yu199195/Raincat

private void makeDir() {
  if (!initialized) {
    synchronized (FileTransactionRecoverRepository.class) {
      if (!initialized) {
        File rootPathFile = new File(filePath);
        if (!rootPathFile.exists()) {
          boolean result = rootPathFile.mkdir();
          if (!result) {
            throw new TransactionRuntimeException("cannot create root path, the path to create is:" + filePath);
          }
          initialized = true;
        } else if (!rootPathFile.isDirectory()) {
          throw new TransactionRuntimeException("rootPath is not directory");
        }
      }
    }
  }
}
origin: yu199195/Raincat

private int executeUpdate(final String sql, final Object... params) {
  try {
    try (Connection connection = dataSource.getConnection();
       PreparedStatement ps = connection.prepareStatement(sql)) {
      if (params != null) {
        for (int i = 0; i < params.length; i++) {
          ps.setObject(i + 1, params[i]);
        }
      }
      return ps.executeUpdate();
    }
  } catch (SQLException e) {
    LOGGER.error("executeUpdate->" + e.getMessage());
    throw new TransactionRuntimeException(e);
  }
}
origin: yu199195/Raincat

private void start(final TxConfig txConfig) {
  if (!checkDataConfig(txConfig)) {
    throw new TransactionRuntimeException("please check you config!");
  }
  txTransactionInitialize.init(txConfig);
}
origin: yu199195/Raincat

private void stop() {
  try {
    if (null != bossGroup) {
      bossGroup.shutdownGracefully().await();
    }
    if (null != workerGroup) {
      workerGroup.shutdownGracefully().await();
    }
    if (null != servletExecutor) {
      servletExecutor.shutdownGracefully().await();
    }
  } catch (InterruptedException e) {
    throw new TransactionRuntimeException(" Netty  Container stop interrupted", e);
  }
}
origin: yu199195/Raincat

@Override
public void initialization(final TxConfig txConfig) {
  try {
    loadSpi(txConfig);
    nettyClientService.start(txConfig);
    txCompensationService.start(txConfig);
  } catch (Exception e) {
    throw new TransactionRuntimeException("tx transaction ex:{}:" + e.getMessage());
  }
  new RaincatLogo().logo();
}
origin: yu199195/Raincat

@Override
public void init(final String appName, final TxConfig txConfig) {
  setRootPath(RepositoryPathUtils.buildZookeeperPath(appName));
  try {
    connect(txConfig.getTxZookeeperConfig());
  } catch (Exception e) {
    LogUtil.error(LOGGER, "zookeeper init exception please check you config:{}", e::getMessage);
    throw new TransactionRuntimeException(e.getMessage());
  }
}
origin: yu199195/Raincat

@Override
public int update(final TransactionRecover transactionRecover) throws TransactionRuntimeException {
  String sql = "update " + tableName
      + " set last_time = ?,version =version+ 1,retried_count =retried_count+1 where id = ? and version=? ";
  if (CompensationOperationTypeEnum.TASK_EXECUTE.getCode() == transactionRecover.getOperation()) {
    sql = "update " + tableName
        + " set last_time = ?,complete_flag = ? where id = ?";
    executeUpdate(sql, new Date(), CommonConstant.TX_TRANSACTION_COMPLETE_FLAG_OK, transactionRecover.getId());
    return ROWS;
  }
  int success = executeUpdate(sql, new Date(), transactionRecover.getId(), transactionRecover.getVersion());
  if (success <= 0) {
    throw new TransactionRuntimeException(UPDATE_EX);
  }
  return success;
}
origin: yu199195/Raincat

@Override
public Boolean updateRetry(final String id, final Integer retry, final String applicationName) {
  if (StringUtils.isBlank(id)
      || StringUtils.isBlank(applicationName)
      || Objects.isNull(retry)) {
    return Boolean.FALSE;
  }
  final String mongoTableName = RepositoryPathUtils.buildMongoTableName(applicationName);
  Query query = new Query();
  query.addCriteria(new Criteria("transId").is(id));
  Update update = new Update();
  update.set("lastTime", DateUtils.getCurrentDateTime());
  update.set("retriedCount", retry);
  final WriteResult writeResult = mongoTemplate.updateFirst(query, update,
      MongoAdapter.class, mongoTableName);
  if (writeResult.getN() <= 0) {
    throw new TransactionRuntimeException("更新数据异常!");
  }
  return Boolean.TRUE;
}
origin: yu199195/Raincat

@Override
public int update(final TransactionRecover transactionRecover) throws TransactionRuntimeException {
  if (CompensationOperationTypeEnum.TASK_EXECUTE.getCode() == transactionRecover.getOperation()) {
    TransactionRecover recover = findById(transactionRecover.getId());
    recover.setCompleteFlag(CommonConstant.TX_TRANSACTION_COMPLETE_FLAG_OK);
    writeFile(recover);
    return ROWS;
  }
  transactionRecover.setLastTime(new Date());
  transactionRecover.setVersion(transactionRecover.getVersion() + 1);
  transactionRecover.setRetriedCount(transactionRecover.getRetriedCount() + 1);
  try {
    writeFile(transactionRecover);
  } catch (Exception e) {
    throw new TransactionRuntimeException(UPDATE_EX);
  }
  return ROWS;
}
origin: yu199195/Raincat

throw new TransactionRuntimeException("TxManager connection ex!");
origin: yu199195/Raincat

@Override
public int update(final TransactionRecover transactionRecover) throws TransactionRuntimeException {
  try {
    final String redisKey = RedisHelper.buildRecoverKey(keyName, transactionRecover.getId());
    if (CompensationOperationTypeEnum.TASK_EXECUTE.getCode() == transactionRecover.getOperation()) {
      TransactionRecover recover = findById(transactionRecover.getId());
      recover.setCompleteFlag(CommonConstant.TX_TRANSACTION_COMPLETE_FLAG_OK);
      jedisClient.set(redisKey, TransactionRecoverUtils.convert(recover, objectSerializer));
      return ROWS;
    }
    transactionRecover.setVersion(transactionRecover.getVersion() + 1);
    transactionRecover.setLastTime(new Date());
    transactionRecover.setRetriedCount(transactionRecover.getRetriedCount() + 1);
    jedisClient.set(redisKey, TransactionRecoverUtils.convert(transactionRecover, objectSerializer));
    return ROWS;
  } catch (Exception e) {
    throw new TransactionRuntimeException(e);
  }
}
origin: yu199195/Raincat

@Override
public int update(final TransactionRecover transactionRecover) throws TransactionRuntimeException {
  Query query = new Query();
  query.addCriteria(new Criteria("transId").is(transactionRecover.getId()));
  Update update = new Update();
  if (CompensationOperationTypeEnum.TASK_EXECUTE.getCode() == transactionRecover.getOperation()) {
    update.set("completeFlag",CommonConstant.TX_TRANSACTION_COMPLETE_FLAG_OK);
  } else if (CompensationOperationTypeEnum.COMPENSATION.getCode() == transactionRecover.getOperation()) {
    update.set("lastTime", new Date());
    update.set("retriedCount", transactionRecover.getRetriedCount() + 1);
    update.set("version", transactionRecover.getVersion() + 1);
  }
  final WriteResult writeResult = template.updateFirst(query, update, MongoAdapter.class, collectionName);
  if (writeResult.getN() <= 0) {
    throw new TransactionRuntimeException(UPDATE_EX);
  }
  return ROWS;
}
org.dromara.raincat.common.exceptionTransactionRuntimeException

Javadoc

TransactionRuntimeException.

Most used methods

  • <init>

Popular in Java

  • Reactive rest calls using spring rest template
  • getSharedPreferences (Context)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • putExtra (Intent)
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • FileWriter (java.io)
    A specialized Writer that writes to a file in the file system. All write requests made by calling me
  • PrintStream (java.io)
    Fake signature of an existing Java class.
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • Stack (java.util)
    Stack is a Last-In/First-Out(LIFO) data structure which represents a stack of objects. It enables u
  • Logger (org.apache.log4j)
    This is the central class in the log4j package. Most logging operations, except configuration, are d
  • Top 17 PhpStorm Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now