List of usage examples for org.joda.time Instant Instant
public Instant(Object instant)
From source file:InstantTypeAdapter.java
License:Apache License
@Override public Instant read(JsonReader in) throws IOException { if (in.peek() == JsonToken.NULL) { in.nextNull();/*from w ww . j a v a2 s . c om*/ return null; } return new Instant(in.nextString()); }
From source file:candlelight.joda.converters.JodaInstantConverter.java
License:Apache License
public Instant convertToEntityAttribute(Date date) { return new Instant(date); }
From source file:com.cloudera.api.ApiUtils.java
License:Apache License
public static String printDate(Date date) { return DATE_TIME_PRINTER.print(new Instant(date)); }
From source file:com.cloudera.api.ApiUtils.java
License:Apache License
/** * Calculate the fromDate.// w w w . jav a 2 s.co m * If the fromString is not provided, then the fromDate calculated * from the toDate and the window. * @param fromString A string representation of the from date. * @param toDate The to date for this period * @param window The duration of this period * @return the Date object that corresponds to the from date */ public static Date getFromDate(String fromString, Date toDate, Duration window) { Date fromDate = null; if (fromString != null) { fromDate = newDateFromString(fromString); Preconditions.checkArgument(fromDate.getTime() < toDate.getTime(), "Invalid period specified: 'to' must be later than 'from'."); } else { Instant fromInstant = new Instant(toDate.getTime()).minus(window); fromDate = new Date(fromInstant.getMillis()); } return fromDate; }
From source file:com.cloudera.nav.plugin.examples.stetson.CustomLineageCreator.java
License:Apache License
protected StetsonExecution createExecution() { StetsonExecution exec = new StetsonExecution(plugin.getNamespace()); exec.setPigExecution(getPigExecutionId()); exec.setName("Stetson Execution"); exec.setDescription("I am a custom operation instance"); exec.setLink("http://hasthelargehadroncolliderdestroyedtheworldyet.com/"); exec.setStarted(Instant.now()); exec.setEnded((new Instant(Instant.now().toDate().getTime() + 10000))); return exec;//from w w w. j a v a 2 s . c o m }
From source file:com.cloudera.nav.plugin.examples.stetson2.CustomLineageCreator2.java
License:Apache License
@Override protected StetsonExecution2 createExecution() { StetsonExecution2 exec = new StetsonExecution2(plugin.getNamespace()); exec.setPigExecution(getPigExecutionId()); exec.setName("Stetson Execution"); exec.setDescription("I am a custom operation instance"); exec.setLink("http://hasthelargehadroncolliderdestroyedtheworldyet.com/"); exec.setStarted(Instant.now()); exec.setEnded((new Instant(Instant.now().toDate().getTime() + 10000))); // Extend the previous stetson example by linking it to inputs and outputs String inputName = "StetsonInput"; // Stetson's name for the input dataset String outputName = "StetsonOutput"; // Stetson's name for the output data exec.addInput(inputName, getHdfsEntityId(getInputPath())); exec.addOutput(outputName, getHdfsEntityId(getOutputPath())); return exec;/*from w w w. j a v a2 s .c o m*/ }
From source file:com.cloudera.nav.sdk.examples.lineage.CustomLineageCreator.java
License:Apache License
protected StetsonExecution createExecution() { StetsonExecution exec = new StetsonExecution(plugin.getNamespace()); exec.setPigExecution(getPigExecutionId()); exec.setName("Stetson Execution"); exec.setDescription("I am a custom operation instance"); exec.setLink("http://hasthelargehadroncolliderdestroyedtheworldyet.com/"); exec.setIndex(10);/*w w w .ja v a 2 s . c o m*/ exec.setSteward("chang"); exec.setStarted(Instant.now()); exec.setEnded((new Instant(Instant.now().toDate().getTime() + 10000))); return exec; }
From source file:com.cloudera.nav.sdk.examples.lineage2.CustomLineageCreator2.java
License:Apache License
@Override protected StetsonExecution2 createExecution() { StetsonExecution2 exec = new StetsonExecution2(plugin.getNamespace()); exec.setPigExecution(getPigExecutionId()); exec.setName("Stetson Execution"); exec.setDescription("I am an \n F \n B \n I \n agent."); exec.setLink("http://hasthelargehadroncolliderdestroyedtheworldyet.com/"); exec.setStarted(Instant.now()); exec.setEnded((new Instant(Instant.now().toDate().getTime() + 10000))); // Extend the previous stetson example by linking it to inputs and outputs String inputName = "StetsonInput"; // Stetson's name for the input dataset String outputName = "StetsonOutput"; // Stetson's name for the output data exec.addInput(inputName, getHdfsEntityId(getInputPath())); exec.addOutput(outputName, getHdfsEntityId(getOutputPath())); return exec;//from w ww . j av a 2s. c o m }
From source file:com.cloudera.nav.sdk.examples.managed.CustomLineageCreator.java
License:Apache License
protected StetsonExecution createExecution() { StetsonExecution exec = new StetsonExecution(plugin.getNamespace()); exec.setPigExecution(getPigExecutionId()); exec.setName("Stetson Execution"); exec.setDescription("I am a custom operation instance"); exec.setLink("http://hasthelargehadroncolliderdestroyedtheworldyet.com/"); exec.setIndex(10);/*from w w w. j av a2 s .c o m*/ exec.setStarted(Instant.now()); exec.setEnded((new Instant(Instant.now().toDate().getTime() + 10000))); return exec; }
From source file:com.comcast.viper.flume2storm.connection.receptor.KryoNetEventReceptor.java
License:Apache License
/** * @param connectionParams//from w w w . j av a 2 s . c om * Connection parameters to the {@link KryoNetEventSender} * @param kryoNetParams * Generic parameters of the {@link KryoNetEventReceptor} */ public KryoNetEventReceptor(final KryoNetConnectionParameters connectionParams, KryoNetParameters kryoNetParams) { Preconditions.checkNotNull(connectionParams); this.kryoNetParameters = kryoNetParams; this.connectionParams = connectionParams; stats = new EventReceptorStats(connectionParams.getId()); listeners = new AtomicReference<>(ImmutableList.copyOf(new ArrayList<EventReceptorListener>())); events = new ConcurrentLinkedQueue<F2SEvent>(); keepRunning = new AtomicBoolean(false); nextConnectionTime = new AtomicReference<Instant>(new Instant(0)); }