congrats Icon
New! Announcing our next generation AI code completions
Read here
Tabnine Logo
Command
Code IndexAdd Tabnine to your IDE (free)

How to use
Command
in
net.sergeych.farcall

Best Java code snippets using net.sergeych.farcall.Command (Showing top 10 results out of 315)

origin: UniversaBlockchain/universa

  @Override
  public Object onCommand(Command command) throws Exception {
    if (command.is("ping")) {
      return "pong";
    } else if (command.is("echoargs")) {
      HashMap<String, Object> res = new HashMap<>();
      res.put("simple", command.getParams());
      res.put("key", command.getKeyParams());
      return res;
    }
    throw new IllegalArgumentException("unknown command: " + command.getName());
  }
});
origin: UniversaBlockchain/universa

private void doCall(Map<String, Object> input, int serial) {
  try {
    Object result = target.onCommand(new Command(input));
    sendToRemote("ref", serial, "result", result);
  } catch (RemoteException e) {
    sendErrorNoExceptions(serial, e.getRemoteErrorClass(), e.getRemoteErrorText());
  } catch (Exception e) {
    sendErrorNoExceptions(serial, e.getClass().getSimpleName(), e.getMessage());
  }
}
origin: UniversaBlockchain/universa

private Object decryptBlock(Command command) throws EncryptionError {
  try {
    synchronized (remoteSessionKey) {
      Bytes ciphertext = command.getParam(0);
      if (ciphertext == null) {
        throw new IllegalStateException("missing block data");
      }
      Binder plain = Boss.unpack(remoteSessionKey.etaDecrypt(ciphertext.toArray()));
      inputQueue.put(plain);
    }
  } catch (SymmetricKey.AuthenticationFailed authenticationFailed) {
    throw new EncryptionError("authentication failed on bitrusted block");
  } catch (InterruptedException e) {
    Thread.interrupted();
  } catch (Exception e) {
    log.wtf("failed to process block", e);
    e.printStackTrace();
  }
  return null;
}
origin: UniversaBlockchain/universa

  /**
   * The handshake and transport command processing
   *
   * @param command
   *
   * @return
   *
   * @throws Exception
   */
  @Override
  public Object onCommand(Command command) throws Exception {
//        log.d(toString()+" cmd "+command.getName());
    switch (command.getName()) {
      case "hello":
        return onHello(Binder.from(command.getKeyParams()));
      case "block":
        return decryptBlock(command);
    }
    return null;
  }

origin: UniversaBlockchain/universa

if (command.getName().equals("fast")) {
  counts[0]++;
  Thread.sleep(1);
  return "fast done";
} else if (command.getName().equals("slow")) {
  Thread.sleep(3);
  counts[1]++;
origin: UniversaBlockchain/universa

if (command.getName().equals("fast")) {
  counts[0]++;
  return "fast done";
} else if (command.getName().equals("slow")) {
  Thread.sleep(3);
  counts[1]++;
origin: UniversaBlockchain/universa

Farcall f = new Farcall(bc);
f.start(cmd -> {
  switch (cmd.getName()) {
    case "ping":
      return "pong";
origin: UniversaBlockchain/universa

if (command.getName().equals("fast")) {
  counts[0]++;
  return "fast done";
} else if (command.getName().equals("slow")) {
  Thread.sleep(3);
  counts[1]++;
origin: UniversaBlockchain/universa

if (command.getName().equals("fast")) {
  counts[0]++;
  return "fast done";
} else if (command.getName().equals("slow")) {
  Thread.sleep(3);
  counts[1]++;
  return "slow done";
} else if (command.getName().equals("stop")) {
  sca.close();
  System.out.println("closed!");
origin: UniversaBlockchain/universa

a.asyncCommands();
a.start(command -> {
  switch (command.getName()) {
    case "wait":
      synchronized (lock) {
net.sergeych.farcallCommand

Javadoc

Farcall command representation. Each farcall command consist of name and optional parameters array and/or hash.

Most used methods

  • getName
  • getKeyParams
  • <init>
  • getParam
  • getParams
  • is
    Check the command name

Popular in Java

  • Start an intent from android
  • getSupportFragmentManager (FragmentActivity)
  • getSystemService (Context)
  • onCreateOptionsMenu (Activity)
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • System (java.lang)
    Provides access to system-related information and resources including standard input and output. Ena
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • StringTokenizer (java.util)
    Breaks a string into tokens; new code should probably use String#split.> // Legacy code: StringTo
  • Pattern (java.util.regex)
    Patterns are compiled regular expressions. In many cases, convenience methods such as String#matches
  • 14 Best Plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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