List of usage examples for org.joda.time Duration standardDays
public static Duration standardDays(long days)
From source file:google.registry.config.ConfigModule.java
License:Open Source License
/** * Amount of time between RDE deposits./*www .jav a 2 s . c o m*/ * * @see google.registry.rde.PendingDepositChecker * @see google.registry.rde.RdeReportAction * @see google.registry.rde.RdeUploadAction */ @Provides @Config("rdeInterval") public static Duration provideRdeInterval() { return Duration.standardDays(1); }
From source file:google.registry.config.ConfigModule.java
License:Open Source License
/** * Amount of time public HTTP proxies are permitted to cache our WHOIS responses. * * @see google.registry.whois.WhoisHttpServer *//* w w w. jav a 2 s .co m*/ @Provides @Config("whoisHttpExpires") public static Duration provideWhoisHttpExpires() { return Duration.standardDays(1); }
From source file:google.registry.config.RegistryConfig.java
License:Open Source License
/** * Returns the length of time before commit logs should be deleted from datastore. * * <p>The only reason you'll want to retain this commit logs in datastore is for performing * point-in-time restoration queries for subsystems like RDE. * * @see google.registry.backup.DeleteOldCommitLogsAction * @see google.registry.model.translators.CommitLogRevisionsTranslatorFactory *//*from w ww. ja v a 2 s . c o m*/ public static Duration getCommitLogDatastoreRetention() { return Duration.standardDays(30); }
From source file:google.registry.config.RegistryConfig.java
License:Open Source License
/** Returns the amount of time a singleton should be cached in persist mode, before expiring. */ public static Duration getSingletonCachePersistDuration() { switch (RegistryEnvironment.get()) { case UNITTEST: return Duration.ZERO; default:/*from w w w. j a va 2 s . c om*/ return Duration.standardDays(365); } }
From source file:io.druid.server.log.FileRequestLogger.java
License:Apache License
@LifecycleStart public void start() { try {//from ww w . j a va2 s . c o m baseDir.mkdirs(); MutableDateTime mutableDateTime = new DateTime().toMutableDateTime(); mutableDateTime.setMillisOfDay(0); currentDay = mutableDateTime.toDateTime(); fileWriter = new OutputStreamWriter( new FileOutputStream(new File(baseDir, currentDay.toString("yyyy-MM-dd'.log'")), true), Charsets.UTF_8); long nextDay = currentDay.plusDays(1).getMillis(); Duration delay = new Duration(nextDay - new DateTime().getMillis()); ScheduledExecutors.scheduleWithFixedDelay(exec, delay, Duration.standardDays(1), new Callable<ScheduledExecutors.Signal>() { @Override public ScheduledExecutors.Signal call() { currentDay = currentDay.plusDays(1); try { synchronized (lock) { CloseQuietly.close(fileWriter); fileWriter = new OutputStreamWriter( new FileOutputStream(new File(baseDir, currentDay.toString()), true), Charsets.UTF_8); } } catch (Exception e) { Throwables.propagate(e); } return ScheduledExecutors.Signal.REPEAT; } }); } catch (IOException e) { Throwables.propagate(e); } }
From source file:io.v.moments.ux.MainActivity.java
License:Open Source License
@Override public void onSensorChanged(SensorEvent event) { float gX = event.values[0] / SensorManager.GRAVITY_EARTH; float gY = event.values[1] / SensorManager.GRAVITY_EARTH; float gZ = event.values[2] / SensorManager.GRAVITY_EARTH; double gForce = Math.sqrt(gX * gX + gY * gY + gZ * gZ); if (gForce < SHAKE_THRESHOLD) { return;//w w w . j a v a2s . com } final long now = System.currentTimeMillis(); if (now - mShakeTimestamp < SHAKE_EVENT_MS) { return; } mShakeTimestamp = now; final EditText invitee = new EditText(this); invitee.setInputType(InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS); AlertDialog.Builder builder = new AlertDialog.Builder(this) .setTitle(getString(R.string.invite_remote_inspector)).setView(invitee) .setPositiveButton(getString(R.string.invite_remote_inspector_positive_button), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Intent intent = new Intent(Intent.ACTION_SEND); String to = invitee.getText().toString(); intent.setType("message/rfc822"); intent.putExtra(Intent.EXTRA_EMAIL, new String[] { to }); intent.putExtra(Intent.EXTRA_SUBJECT, "Please help me debug"); try { intent.putExtra(Intent.EXTRA_TEXT, mV23Manager.inviteInspector(to, Duration.standardDays(1))); mRemoteInspectionEnabled = true; } catch (Exception e) { toast(e.toString()); return; } if (intent.resolveActivity(getPackageManager()) != null) { startActivity(intent); } else { toast(getString(R.string.invite_remote_inspector_failed)); } } }) .setNegativeButton(getString(R.string.invite_remote_inspector_negative_button), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); if (mRemoteInspectionEnabled) { builder.setNeutralButton(getString(R.string.invite_remote_inspector_neutral_button), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // This doesn't take effect till the next time the activity is created // (invited users will still be able to connect till then). mRemoteInspectionEnabled = false; } }); } builder.show(); }
From source file:io.v.todos.persistence.syncbase.SyncbasePersistence.java
License:Open Source License
@Override public String debugDetails() { synchronized (sSyncbaseMutex) { if (sRemoteInspectors == null) { return "Syncbase has not been initialized"; }/* w w w.ja va 2 s.com*/ final String timestamp = DateTimeFormat.forPattern("yyyy-MM-dd").print(new DateTime()); try { return sRemoteInspectors.invite("invited-on-" + timestamp, Duration.standardDays(1)); } catch (VException e) { return "Unable to setup remote inspection: " + e; } } }
From source file:kr.debop4j.timeperiod.tools.Durations.java
License:Apache License
/** * Days duration./* w w w . j a va2 s. c o m*/ * * @param days the days * @return the duration */ public static Duration days(int days) { return (days == 0) ? Zero : Duration.standardDays(days); }
From source file:net.craigstars.dao.impl.UserSessionDataDaoImpl.java
License:MIT License
/** * Purge all the records that are older than (now - days) *///w w w. j a va 2 s .co m public void purgeOlderThan(int days) { Criteria crit = getSession().createCriteria(getPersistentClass()); DateTime daysAgo = new DateTime(); daysAgo = daysAgo.minus(Duration.standardDays(days)); crit.add(Restrictions.le("createDate", daysAgo)); for (Object obj : crit.list()) { getSession().delete(obj); } }
From source file:org.apache.beam.learning.katas.triggers.earlytriggers.Task.java
License:Apache License
static PCollection<Long> applyTransform(PCollection<String> events) { return events .apply(Window.<String>into(FixedWindows.of(Duration.standardDays(1))) .triggering(AfterWatermark.pastEndOfWindow() .withEarlyFirings(AfterProcessingTime.pastFirstElementInPane())) .withAllowedLateness(Duration.ZERO).discardingFiredPanes()) .apply(Combine.globally(Count.<String>combineFn()).withoutDefaults()); }