Examples of TimeSpan


Examples of com.fathomdb.TimeSpan

    return httpProxyEnvironment;
  }

  private String chooseProxy(OpsTarget target, List<String> proxies) {
    String bestProxy = null;
    TimeSpan bestTime = null;
    for (String proxy : proxies) {
      // {
      // // We choose the fastest proxy that gives us a 200 response
      // String url = proxy + "acng-report.html";
      // CurlRequest request = new CurlRequest(url);
      // request.setTimeout(5);
      // try {
      // CurlResult result = request.executeRequest(target);
      // if (result.getHttpResult() != 200) {
      // log.info("Unexpected response code while testing proxy: " + proxy + ".  Code=" + result.getHttpResult());
      // continue;
      // }
      // TimeSpan timeTotal = result.getTimeTotal();
      // if (bestTime == null || timeTotal.isLessThan(bestTime)) {
      // bestProxy = proxy;
      // bestTime = timeTotal;
      // }
      // } catch (ProcessExecutionException e) {
      // log.info("Error while testing proxy: " + proxy, e);
      // }
      // }

      {
        // We choose the fastest proxy that gives us a 200 response
        String url = "http://ftp.debian.org/debian/dists/stable/Release.gpg";
        CurlRequest request = new CurlRequest(url);
        request.proxy = proxy;
        request.timeout = TimeSpan.FIVE_SECONDS;
        try {
          CurlResult result = request.executeRequest(target);
          if (result.getHttpResult() != 200) {
            log.info("Unexpected response code while testing proxy: " + proxy + ".  Code="
                + result.getHttpResult());
            continue;
          }
          TimeSpan timeTotal = result.getTimeTotal();
          if (bestTime == null || timeTotal.isLessThan(bestTime)) {
            bestProxy = proxy;
            bestTime = timeTotal;
          }
        } catch (OpsException e) {
          log.info("Error while testing proxy: " + proxy, e);
View Full Code Here

Examples of com.fathomdb.TimeSpan

        log.warn("Job finished with FAILED");

        // boolean isDone = false; // We will retry
        activeJob.setState(JobState.FAILED);

        TimeSpan retry = null;

        HasRetryInfo retryInfo = ExceptionHelpers.findRetryInfo(e);
        if (retryInfo != null) {
          retry = retryInfo.getRetry();
        }
View Full Code Here

Examples of com.fathomdb.TimeSpan

      return map;
    }
  }

  public static ZookeeperResponse sendCommand(InetSocketAddress socketAddress, String command) throws IOException {
    TimeSpan connectionTimeout = TimeSpan.TEN_SECONDS;

    Socket s = new Socket();
    s.setTcpNoDelay(true);
    s.setSoTimeout((int) connectionTimeout.getTotalMilliseconds());

    s.connect(socketAddress);

    s.getOutputStream().write(command.getBytes());
    s.getOutputStream().flush();
View Full Code Here

Examples of com.fathomdb.TimeSpan

  public CuratorFramework buildZk(List<String> dnsNames) throws OpsException {
    String connectionString = Joiner.on(",").join(dnsNames);

    Builder builder = CuratorFrameworkFactory.builder();
    builder.connectString(connectionString);
    TimeSpan retryInterval = TimeSpan.FIVE_SECONDS;
    RetryPolicy retryPolicy = new RetryOneTime((int) retryInterval.getTotalMilliseconds());
    builder.retryPolicy(retryPolicy);

    CuratorFramework curatorFramework;
    try {
      curatorFramework = builder.build();
View Full Code Here

Examples of com.fathomdb.TimeSpan

    }

    @Override
    public int parseArguments(Parameters params) throws CmdLineException {
        String s = params.getParameter(0);
        TimeSpan value;
        try {
            value = TimeSpan.parse(s);
        } catch (Exception e) {
            if (option.isArgument()) {
                throw new CmdLineException(owner, Messages.ILLEGAL_OPERAND.format(option.toString(), s));
View Full Code Here

Examples of com.fathomdb.TimeSpan

public abstract class ScheduledTask {

    private static final Logger log = LoggerFactory.getLogger(ScheduledTask.class);

    public void schedule(TaskScheduler scheduler) {
        TimeSpan initialDelay = getInitialDelay();
        TimeSpan interval = getInterval();

        scheduler.scheduleWithFixedDelay(new Runnable() {
            @Override
            public void run() {
                try {
                    log.info("Running scheduled task: {}", getKey());
                    ScheduledTask.this.run();
                } catch (Exception e) {
                    log.error("Error running scheduled task: " + getKey(), e);
                }
            }
        }, initialDelay.getTotalMilliseconds(), interval.getTotalMilliseconds(), TimeUnit.MILLISECONDS);
    }
View Full Code Here

Examples of com.nykredit.kundeservice.util.TimeSpan

    int type = Integer.parseInt(stateDataSplit[1]);
   
    int startTimeDouble = Integer.parseInt(stateDataSplit[2]);
    int endTimeDouble = Integer.parseInt(stateDataSplit[3]);
   
    this.span = new TimeSpan(new TimeOfDay(startTimeDouble),
                      new TimeOfDay(endTimeDouble));
   
    this.type = ExceptionInWorkDay.getExceptionType(type, group);
  }
View Full Code Here

Examples of com.odiago.flumebase.lang.TimeSpan

    long lowerBoundMillis = -1L * lowerBound.longValue() * mPrevScale.getMultiplier();

    Number upperBound = (Number) mAfterSize.eval(inWrapper);
    long upperBoundMillis = upperBound.longValue() * mAfterScale.getMultiplier();

    return new TimeSpan(lowerBoundMillis, upperBoundMillis, true);
  }
View Full Code Here

Examples of com.saasovation.collaboration.domain.model.calendar.TimeSpan

                calendar.scheduleCalendarEntry(
                    this.calendarIdentityService(),
                    aDescription,
                    aLocation,
                    this.collaboratorService().ownerFrom(tenant, anOwnerId),
                    new TimeSpan(aTimeSpanBegins, aTimeSpanEnds),
                    new Repetition(RepeatType.valueOf(aRepeatType), aRepeatEndsOnDate),
                    new Alarm(AlarmUnitsType.valueOf(anAlarmType), anAlarmUnits),
                    this.inviteesFrom(tenant, aParticipantsToInvite));

        this.calendarEntryRepository().save(calendarEntry);
View Full Code Here

Examples of com.sonymobile.tools.gerrit.gerritevents.watchdog.WatchTimeExceptionData.TimeSpan

            int[] daysAsInt = data.getDaysOfWeek();
            List<TimeSpan> exceptionTimes = new LinkedList<TimeSpan>();
            for (TimeSpan s : data.getTimesOfDay()) {
                Time newFromTime = new Time(s.getFrom().getHour(), s.getFrom().getMinute());
                Time newToTime = new Time(s.getTo().getHour(), s.getTo().getMinute());
                exceptionTimes.add(new TimeSpan(newFromTime, newToTime));
            }
            return new WatchTimeExceptionData(daysAsInt, exceptionTimes);
        } else {
            return null;
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.