Exploring the run and call APIs

The compute grid's run() API works with IgniteRunnable. The IgniteRunnable extends Java's Runnable interface; the run() method is executed in the remote cluster. We are going to create a runnable and examine the run behavior. The following are the steps:

  1. Create a class, AdderRunnable, to add two numbers remotely. Implement the IgniteRunnable interface and create a constructor to pass two integers. In the run method, add the numbers and print it in console:
      class AdderRunnable implements IgniteRunnable {           private static final long serialVersionUID = 1L;           private final int first;           private final int second;           public AdderRunnable(int first, int second) {               super();               this.first = first;               this.second = second;           } @Override ...

Get Apache Ignite Quick Start Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.