private void sleepBeforeRegistrationRetry() { long sleepTimeInMs = DateUtils.MILLIS_PER_SECOND * randomTimeSlot.getRandomValueSeededByExternalId(); log.warn("Could not register. Sleeping for {} ms before attempting again.", sleepTimeInMs); AppUtils.sleep(sleepTimeInMs); }
protected void copyToQueue(Data data) { long ts = System.currentTimeMillis(); while (!dataQueue.offer(data) && reading) { AppUtils.sleep(50); } context.incrementStat(System.currentTimeMillis() - ts, ChannelRouterContext.STAT_ENQUEUE_DATA_MS); }
public void waitForComplete(long timeout) { long ts = System.currentTimeMillis(); while (!isComplete() && System.currentTimeMillis() - ts < timeout) { AppUtils.sleep(50); } if (!isComplete()) { throw new InterruptedException(String.format( "Timed out after %sms", timeout)); } } }
public void aquireInfiniteLock(String action) { if (isClusteringEnabled()) { int tries = 600; Date futureTime = DateUtils.add(new Date(), Calendar.YEAR, 100); while (tries > 0) { if (!lock(action, new Date(), futureTime, Lock.STOPPED)) { AppUtils.sleep(50); tries--; } else { tries = 0; } } } }
error != null ? error.getMessage() : ""); if (i < numberOfStatusSendRetries - 1) { AppUtils.sleep(parameterService .getLong(ParameterConstants.DATA_LOADER_TIME_BETWEEN_ACK_RETRIES)); } else if (error instanceof RuntimeException) {
public void truncateTable(String tableName) { String quote = platform.getDdlBuilder().isDelimitedIdentifierModeOn() ? platform .getDatabaseInfo().getDelimiterToken() : ""; boolean success = false; int tryCount = 5; while (!success && tryCount > 0) { try { Table table = platform.getTableFromCache(tableName, false); if (table != null) { platform.getSqlTemplate().update( String.format("truncate table %s%s%s", quote, table.getName(), quote)); success = true; } else { throw new RuntimeException(String.format("Could not find %s to trunate", tableName)); } } catch (SqlException ex) { log.warn(ex.getMessage(), ex); AppUtils.sleep(5000); tryCount--; } } }
@Override public void truncateTable(String tableName) { String quote = platform.getDdlBuilder().isDelimitedIdentifierModeOn() ? platform .getDatabaseInfo().getDelimiterToken() : ""; boolean success = false; int tryCount = 5; while (!success && tryCount > 0) { try { Table table = platform.getTableFromCache(tableName, false); if (table != null) { platform.getSqlTemplate().update( String.format("delete from %s%s%s", quote, table.getName(), quote)); success = true; } else { throw new RuntimeException(String.format("Could not find %s to trunate", tableName)); } } catch (SqlException ex) { log.warn(ex.getMessage(), ex); AppUtils.sleep(5000); tryCount--; } } }
AppUtils.sleep(interval); } else { firstPass = false;
* new RandomTimeSlot(nodeCommunication.getNodeId(), 30).getRandomValueSeededByExternalId(); log.warn("Sleeping for {} ms before attempting to unlock the node communication record again", sleepTime); AppUtils.sleep(sleepTime); attempts++; };