Example usage for org.apache.commons.lang.time DateUtils MILLIS_PER_SECOND

List of usage examples for org.apache.commons.lang.time DateUtils MILLIS_PER_SECOND

Introduction

In this page you can find the example usage for org.apache.commons.lang.time DateUtils MILLIS_PER_SECOND.

Prototype

long MILLIS_PER_SECOND

To view the source code for org.apache.commons.lang.time DateUtils MILLIS_PER_SECOND.

Click Source Link

Document

Number of milliseconds in a standard second.

Usage

From source file:edu.kit.dama.transfer.client.impl.GUIUploadClient.java

/**
 * The main entry point/*from w w  w. ja v  a 2s .c om*/
 *
 * @param args The command line argument array
 */
public static void main(String[] args) {
    int result = 0;
    AbstractFile.setCheckLevel(AbstractFile.CHECK_LEVEL.COARSE);
    GUIUploadClient client;
    try {
        client = new GUIUploadClient(args);
        Thread.currentThread().setUncaughtExceptionHandler(client);
        client.setVisible();
        while (client.isVisible()) {
            try {
                Thread.sleep(DateUtils.MILLIS_PER_SECOND);
            } catch (InterruptedException ie) {
            }
        }
    } catch (TransferClientInstatiationException ie) {
        LOGGER.error("Failed to instantiate GUI client", ie);
        result = 1;
    } catch (CommandLineHelpOnlyException choe) {
        result = 0;
    }
    System.exit(result);
}

From source file:edu.kit.dama.transfer.client.impl.GUIDownloadClient.java

/**
 * The main entry point//w w  w.  j  a v a 2  s  . c  o  m
 *
 * @param args The command line argument array
 */
public static void main(String[] args) {

    int result = 0;
    GUIDownloadClient client;
    try {
        client = new GUIDownloadClient(args);
        Thread.currentThread().setUncaughtExceptionHandler(client);
        client.setVisible();
        while (client.isVisible()) {
            try {
                Thread.sleep(DateUtils.MILLIS_PER_SECOND);
            } catch (InterruptedException ie) {
            }
        }
    } catch (TransferClientInstatiationException ie) {
        LOGGER.error("Failed to instantiate GUI client", ie);
        result = 1;
    } catch (CommandLineHelpOnlyException choe) {
        result = 0;
    }
    System.exit(result);
}

From source file:edu.kit.dama.transfer.client.impl.CLUploadClient.java

/**
 * Main entry point.//  w  w  w  . j  ava  2  s  .c o  m
 *
 * @param args Command line arguments.
 */
public static void main(String[] args) {
    int result = 0;
    CLUploadClient client;
    try {
        client = new CLUploadClient(args);
        Thread.currentThread().setUncaughtExceptionHandler(client);
        client.performUpload();
        while (client.getTransferClient().isTransferRunning()) {
            try {
                Thread.sleep(DateUtils.MILLIS_PER_SECOND);
            } catch (InterruptedException ie) {
            }
        }
    } catch (TransferClientInstatiationException ie) {
        LOGGER.error("Failed to create instance of command line client", ie);
        result = 1;
    } catch (CommandLineHelpOnlyException choe) {
        result = 0;
    }
    System.exit(result);
}

From source file:edu.kit.dama.transfer.client.impl.CLDownloadClient.java

/**
 * Main entry point.//from  w  w  w  .  j  av  a 2  s.c  o  m
 *
 * @param args Command line arguments.
 */
public static void main(String[] args) {
    int result = 0;
    CLDownloadClient client;
    try {
        client = new CLDownloadClient(args);
        Thread.currentThread().setUncaughtExceptionHandler(client);
        client.performDownload();
        while (client.getTransferClient().isTransferRunning()) {
            try {
                Thread.sleep(DateUtils.MILLIS_PER_SECOND);
            } catch (InterruptedException ie) {
            }
        }
    } catch (TransferClientInstatiationException ie) {
        LOGGER.error("Failed to create instance of command line client", ie);
        result = 1;
    } catch (CommandLineHelpOnlyException choe) {
        result = 0;
    }
    System.exit(result);
}

From source file:com.pureinfo.force.util.TimerUtilTest.java

public void testScheduleFrom() throws InterruptedException {
    TimerUtil.scheduleFrom("11:20", DateUtils.MILLIS_PER_SECOND, new TimerTask() {
        private int i = 0;

        public void run() {
            System.out.println(i++);
            // if (i == 5) timer.cancel();
        }/*  w w  w  .  j a va2s . c o  m*/
    });
    Thread.sleep(10000);
}

From source file:mitm.common.util.DateTimeUtils.java

public static long millisecondsToSeconds(long milliseconds) {
    return (long) (milliseconds / DateUtils.MILLIS_PER_SECOND);
}

From source file:mitm.common.util.KeyedBarrierTest.java

private static Future<?> execute(final KeyedBarrier<String, Object> barrier, final String key,
        final Callable<Object> callable) {
    return execute(barrier, key, callable, DateUtils.MILLIS_PER_SECOND * 60);
}

From source file:mitm.common.sms.SMSGatewayImplTest.java

@BeforeClass
public static void setUpBeforeClass() throws InstantiationException, IllegalAccessException,
        ClassNotFoundException, DatabaseException, SMSGatewayException {
    PropertyConfigurator.configure("conf/log4j.properties");

    sessionSource = new StandardHibernateSessionSourceImpl(hibernateConfig);

    HibernateUtils.recreateTables(sessionSource.getHibernateConfiguration());

    SessionManager sessionManager = new SessionManagerImpl(sessionSource);

    gateway = new SMSGatewayImpl(transport, new SMSExpiredListenerImpl(), sessionManager);

    gateway.setExpirationTime(DateUtils.MILLIS_PER_SECOND * 5);

    // UpdateInterval must be 0 for this test
    gateway.setUpdateInterval(0);//ww w .  ja v a2  s.c  o  m

    gateway.start();
}

From source file:mitm.common.util.KeyedBarrier.java

public KeyedBarrier() {
    this(DateUtils.MILLIS_PER_SECOND * 10);
}

From source file:mitm.common.util.DateTimeUtils.java

public static long diffSeconds(Date date1, Date date2) {
    return (date1.getTime() - date2.getTime()) / DateUtils.MILLIS_PER_SECOND;
}