congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
WorkerInfo.setLastContactSec
Code IndexAdd Tabnine to your IDE (free)

How to use
setLastContactSec
method
in
alluxio.wire.WorkerInfo

Best Java code snippets using alluxio.wire.WorkerInfo.setLastContactSec (Showing top 7 results out of 315)

origin: Alluxio/alluxio

private static int compareLostWorkersWithTimes(int time1, int time2) {
 WorkerInfo.LastContactSecComparator comparator =
   new WorkerInfo.LastContactSecComparator();
 WorkerInfo worker1 = createRandom();
 WorkerInfo worker2 = createRandom();
 worker1.setLastContactSec(time1);
 worker2.setLastContactSec(time2);
 return comparator.compare(worker1, worker2);
}
origin: Alluxio/alluxio

/**
 * @return generated {@link WorkerInfo} for this worker
 */
public synchronized WorkerInfo generateClientWorkerInfo() {
 return new WorkerInfo().setId(mId).setAddress(mWorkerAddress).setLastContactSec(
   (int) ((CommonUtils.getCurrentMs() - mLastUpdatedTimeMs) / Constants.SECOND_MS))
   .setState("In Service").setStartTimeMs(mStartTimeMs);
}
origin: Alluxio/alluxio

 public static WorkerInfo createRandom() {
  WorkerInfo result = new WorkerInfo();
  Random random = new Random();

  long id = random.nextLong();
  WorkerNetAddress address = WorkerNetAddressTest.createRandom();
  int lastContactSec = random.nextInt();
  long capacityBytes = random.nextLong();
  long usedBytes = random.nextLong();
  long startTimeMs = random.nextLong();
  Map<String, Long> capacityBytesOnTiers = new HashMap<>();
  capacityBytesOnTiers.put("MEM", capacityBytes);
  Map<String, Long> usedBytesOnTiers = new HashMap<>();
  usedBytesOnTiers.put("MEM", usedBytes);
  String state = random.nextInt(1) == 1 ? "In Service" : "Out of Service";

  result.setId(id);
  result.setAddress(address);
  result.setLastContactSec(lastContactSec);
  result.setCapacityBytes(capacityBytes);
  result.setUsedBytes(usedBytes);
  result.setStartTimeMs(startTimeMs);
  result.setState(state);
  result.setCapacityBytesOnTiers(capacityBytesOnTiers);
  result.setUsedBytesOnTiers(usedBytesOnTiers);
  return result;
 }
}
origin: Alluxio/alluxio

 break;
case LAST_CONTACT_SEC:
 info.setLastContactSec(
   (int) ((CommonUtils.getCurrentMs() - mLastUpdatedTimeMs) / Constants.SECOND_MS));
 break;
origin: Alluxio/alluxio

/**
 * Converts a proto type to a wire type.
 *
 * @param workerInfo the proto type to convert
 * @return the converted wire type
 */
public static WorkerInfo fromProto(alluxio.grpc.WorkerInfo workerInfo) {
 return new WorkerInfo().setAddress(fromProto(workerInfo.getAddress()))
   .setCapacityBytes(workerInfo.getCapacityBytes())
   .setCapacityBytesOnTiers(workerInfo.getCapacityBytesOnTiers()).setId(workerInfo.getId())
   .setLastContactSec(workerInfo.getLastContactSec())
   .setStartTimeMs(workerInfo.getStartTimeMs()).setState(workerInfo.getState())
   .setUsedBytes(workerInfo.getUsedBytes())
   .setUsedBytesOnTiers(workerInfo.getUsedBytesOnTiersMap());
}
origin: org.alluxio/alluxio-core-server-master

 break;
case LAST_CONTACT_SEC:
 info.setLastContactSec(
   (int) ((CommonUtils.getCurrentMs() - mLastUpdatedTimeMs) / Constants.SECOND_MS));
 break;
origin: org.alluxio/alluxio-core-common

/**
 * Creates a new instance of {@link WorkerInfo} from a thrift representation.
 *
 * @param workerInfo the thrift representation of a worker information
 * @return the instance
 */
public static WorkerInfo fromThrift(alluxio.thrift.WorkerInfo workerInfo) {
 return new WorkerInfo()
   .setAddress(WorkerNetAddress.fromThrift(workerInfo.getAddress()))
   .setCapacityBytes(workerInfo.getCapacityBytes())
   .setCapacityBytesOnTiers(workerInfo.getCapacityBytesOnTiers())
   .setId(workerInfo.getId())
   .setLastContactSec(workerInfo.getLastContactSec())
   .setStartTimeMs(workerInfo.getStartTimeMs())
   .setState(workerInfo.getState())
   .setUsedBytes(workerInfo.getUsedBytes())
   .setUsedBytesOnTiers(workerInfo.getUsedBytesOnTiers());
}
alluxio.wireWorkerInfosetLastContactSec

Popular methods of WorkerInfo

  • getAddress
  • getCapacityBytes
  • getUsedBytes
  • <init>
    Creates a new instance of WorkerInfo.
  • getId
  • setAddress
  • getLastContactSec
  • setId
  • getStartTimeMs
  • getState
  • setStartTimeMs
  • setState
  • setStartTimeMs,
  • setState,
  • getCapacityBytesOnTiers,
  • getUsedBytesOnTiers,
  • setCapacityBytes,
  • setCapacityBytesOnTiers,
  • setUsedBytes,
  • setUsedBytesOnTiers,
  • toThrift

Popular in Java

  • Parsing JSON documents to java classes using gson
  • findViewById (Activity)
  • getExternalFilesDir (Context)
  • getResourceAsStream (ClassLoader)
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • DecimalFormat (java.text)
    A concrete subclass of NumberFormat that formats decimal numbers. It has a variety of features desig
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • Enumeration (java.util)
    A legacy iteration interface.New code should use Iterator instead. Iterator replaces the enumeration
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • Executors (java.util.concurrent)
    Factory and utility methods for Executor, ExecutorService, ScheduledExecutorService, ThreadFactory,
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now