Package com.fathomdb

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


    }

    @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

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

TOP

Related Classes of com.fathomdb.TimeSpan

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.