Java Code Examples for org.joda.time.Duration#standardHours()
The following examples show how to use
org.joda.time.Duration#standardHours() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SegmentIntervalUtils.java From incubator-pinot with Apache License 2.0 | 6 votes |
/** * Converts push frequency into duration. For invalid or less than 'hourly' push frequency, treats it as 'daily'. */ public static Duration convertToDuration(String pushFrequency) { if ("hourly".equalsIgnoreCase(pushFrequency)) { return Duration.standardHours(1L); } if ("daily".equalsIgnoreCase(pushFrequency)) { return Duration.standardDays(1L); } if ("weekly".equalsIgnoreCase(pushFrequency)) { return Duration.standardDays(7L); } if ("monthly".equalsIgnoreCase(pushFrequency)) { return Duration.standardDays(30L); } return Duration.standardDays(1L); }
Example 2
Source File: TempDataCompressor.java From hawkular-metrics with Apache License 2.0 | 6 votes |
@Override public Completable call(JobDetails jobDetails) { Duration runtimeBlockSize = Duration.standardHours(2); Trigger trigger = jobDetails.getTrigger(); DateTime timeSliceInclusive = new DateTime(trigger.getTriggerTime(), DateTimeZone.UTC).minus(runtimeBlockSize); // Rewind to previous timeslice DateTime timeSliceStart = DateTimeService.getTimeSlice(timeSliceInclusive, runtimeBlockSize); long startOfSlice = timeSliceStart.getMillis(); Stopwatch stopwatch = Stopwatch.createStarted(); logger.infof("Starting to process temp table for starting time of %s", timeSliceStart.toString()); // TODO Optimization - new worker per token - use parallelism in Cassandra (with configured parallelism) return metricsService.compressBlock(startOfSlice, pageSize, maxReadConcurrency) .doOnError(t -> logger.errorf("Compression job failed: %s", t.getMessage())) .doOnCompleted(() -> { stopwatch.stop(); logger.info("Finished processing data in " + stopwatch.elapsed(TimeUnit.MILLISECONDS) + " ms"); }); }
Example 3
Source File: DisplayDataTest.java From beam with Apache License 2.0 | 5 votes |
@Test public void testStringFormatting() throws IOException { final Instant now = Instant.now(); final Duration oneHour = Duration.standardHours(1); HasDisplayData component = new HasDisplayData() { @Override public void populateDisplayData(DisplayData.Builder builder) { builder .add(DisplayData.item("string", "foobar")) .add(DisplayData.item("integer", 123)) .add(DisplayData.item("float", 2.34)) .add(DisplayData.item("boolean", true)) .add(DisplayData.item("java_class", DisplayDataTest.class)) .add(DisplayData.item("timestamp", now)) .add(DisplayData.item("duration", oneHour)); } }; DisplayData data = DisplayData.from(component); assertThat(data, hasDisplayItem("string", "foobar")); assertThat(data, hasDisplayItem("integer", 123)); assertThat(data, hasDisplayItem("float", 2.34)); assertThat(data, hasDisplayItem("boolean", true)); assertThat(data, hasDisplayItem("java_class", DisplayDataTest.class)); assertThat(data, hasDisplayItem("timestamp", now)); assertThat(data, hasDisplayItem("duration", oneHour)); }
Example 4
Source File: TriggerStateMachinesTest.java From beam with Apache License 2.0 | 5 votes |
@Test public void testStateMachineForAfterProcessingTime() { Duration minutes = Duration.standardMinutes(94); Duration hours = Duration.standardHours(13); RunnerApi.Trigger trigger = RunnerApi.Trigger.newBuilder() .setAfterProcessingTime( RunnerApi.Trigger.AfterProcessingTime.newBuilder() .addTimestampTransforms( RunnerApi.TimestampTransform.newBuilder() .setDelay( RunnerApi.TimestampTransform.Delay.newBuilder() .setDelayMillis(minutes.getMillis()))) .addTimestampTransforms( RunnerApi.TimestampTransform.newBuilder() .setAlignTo( RunnerApi.TimestampTransform.AlignTo.newBuilder() .setPeriod(hours.getMillis())))) .build(); AfterDelayFromFirstElementStateMachine machine = (AfterDelayFromFirstElementStateMachine) TriggerStateMachines.stateMachineForTrigger(trigger); assertThat(machine.getTimeDomain(), equalTo(TimeDomain.PROCESSING_TIME)); }
Example 5
Source File: SlidingWindows.java From beam with Apache License 2.0 | 5 votes |
static Duration getDefaultPeriod(Duration size) { if (size.isLongerThan(Duration.standardHours(1))) { return Duration.standardHours(1); } if (size.isLongerThan(Duration.standardMinutes(1))) { return Duration.standardMinutes(1); } if (size.isLongerThan(Duration.standardSeconds(1))) { return Duration.standardSeconds(1); } return Duration.millis(1); }
Example 6
Source File: SyncRegistrarsSheetActionTest.java From nomulus with Apache License 2.0 | 5 votes |
@Before public void setUp() { action = new SyncRegistrarsSheetAction(); action.response = response; action.syncRegistrarsSheet = syncRegistrarsSheet; action.timeout = Duration.standardHours(1); action.lockHandler = new FakeLockHandler(true); }
Example 7
Source File: WhoisHttpActionTest.java From nomulus with Apache License 2.0 | 5 votes |
private WhoisHttpAction newWhoisHttpAction(String pathInfo) { WhoisHttpAction whoisAction = new WhoisHttpAction(); whoisAction.clock = clock; whoisAction.expires = Duration.standardHours(1); whoisAction.requestPath = WhoisHttpAction.PATH + pathInfo; whoisAction.response = response; whoisAction.whoisReader = new WhoisReader(new WhoisCommandFactory(), "Please contact registrar"); whoisAction.whoisMetrics = new WhoisMetrics(); whoisAction.metricBuilder = WhoisMetric.builderForRequest(clock); whoisAction.disclaimer = "Doodle Disclaimer\nI exist so that carriage return\nin disclaimer can be tested."; return whoisAction; }
Example 8
Source File: RdeStagingActionTest.java From nomulus with Apache License 2.0 | 5 votes |
@Before public void setup() { inject.setStaticField(Ofy.class, "clock", clock); action = new RdeStagingAction(); action.clock = clock; action.mrRunner = makeDefaultRunner(); action.lenient = false; action.reducerFactory = new RdeStagingReducer.Factory(); action.reducerFactory.taskQueueUtils = new TaskQueueUtils(new Retrier(new SystemSleeper(), 1)); action.reducerFactory.lockHandler = new FakeLockHandler(true); action.reducerFactory.gcsBufferSize = 0; action.reducerFactory.bucket = "rde-bucket"; action.reducerFactory.lockTimeout = Duration.standardHours(1); action.reducerFactory.stagingKeyBytes = PgpHelper.convertPublicKeyToBytes(encryptKey); action.pendingDepositChecker = new PendingDepositChecker(); action.pendingDepositChecker.brdaDayOfWeek = DateTimeConstants.TUESDAY; action.pendingDepositChecker.brdaInterval = Duration.standardDays(7); action.pendingDepositChecker.clock = clock; action.pendingDepositChecker.rdeInterval = Duration.standardDays(1); action.response = response; action.transactionCooldown = Duration.ZERO; action.directory = Optional.empty(); action.modeStrings = ImmutableSet.of(); action.tlds = ImmutableSet.of(); action.watermarks = ImmutableSet.of(); action.revision = Optional.empty(); }
Example 9
Source File: Configuration.java From jerseyoauth2 with MIT License | 4 votes |
@Override public Duration getTokenLifetime() { return Duration.standardHours(1); }
Example 10
Source File: Configuration.java From jerseyoauth2 with MIT License | 4 votes |
@Override public Duration getTokenLifetime() { return Duration.standardHours(1); }
Example 11
Source File: AllowAllFilter.java From airpal with Apache License 2.0 | 4 votes |
@Override protected AuthenticationToken createToken(ServletRequest request, ServletResponse response) throws Exception { log.info("createToken called"); return new AllowAllToken(request.getRemoteHost(), true, "anonymous", ImmutableSet.of("all"), "default", Duration.standardHours(1), "default"); }
Example 12
Source File: RegistryConfig.java From nomulus with Apache License 2.0 | 4 votes |
/** * Maximum amount of time for syncing a spreadsheet, before killing. * * @see google.registry.export.sheet.SyncRegistrarsSheetAction */ @Provides @Config("sheetLockTimeout") public static Duration provideSheetLockTimeout() { return Duration.standardHours(1); }
Example 13
Source File: RegistryConfig.java From nomulus with Apache License 2.0 | 4 votes |
/** * Maximum amount of time generating an escrow deposit for a TLD could take, before killing. * * @see google.registry.rde.RdeStagingReducer */ @Provides @Config("rdeStagingLockTimeout") public static Duration provideRdeStagingLockTimeout() { return Duration.standardHours(2); }
Example 14
Source File: RegistryConfig.java From nomulus with Apache License 2.0 | 4 votes |
/** * Returns the default time to live for DNS DS records. * * @see google.registry.dns.writer.clouddns.CloudDnsWriter */ @Provides @Config("dnsDefaultDsTtl") public static Duration provideDnsDefaultDsTtl() { return Duration.standardHours(1); }
Example 15
Source File: RegistryConfig.java From nomulus with Apache License 2.0 | 4 votes |
/** * Returns the default time to live for DNS NS records. * * @see google.registry.dns.writer.clouddns.CloudDnsWriter */ @Provides @Config("dnsDefaultNsTtl") public static Duration provideDnsDefaultNsTtl() { return Duration.standardHours(3); }
Example 16
Source File: RegistryConfig.java From nomulus with Apache License 2.0 | 4 votes |
/** * Returns the default time to live for DNS A and AAAA records. * * @see google.registry.dns.writer.clouddns.CloudDnsWriter */ @Provides @Config("dnsDefaultATtl") public static Duration provideDnsDefaultATtl() { return Duration.standardHours(1); }
Example 17
Source File: RegistryConfig.java From nomulus with Apache License 2.0 | 2 votes |
/** * Minimum amount of time to wait between consecutive SFTP uploads on a single TLD. * * <p>This value was communicated to us by the escrow provider. * * @see google.registry.rde.RdeStagingReducer */ @Provides @Config("rdeUploadSftpCooldown") public static Duration provideRdeUploadSftpCooldown() { return Duration.standardHours(2); }