All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.astonbitecode.j4rs.tests.MySecondTest Maven / Gradle / Ivy

There is a newer version: 0.21.0
Show newest version
package org.astonbitecode.j4rs.tests;

import org.astonbitecode.j4rs.api.invocation.NativeCallbackToRustChannelSupport;

import java.util.stream.IntStream;

public class MySecondTest extends NativeCallbackToRustChannelSupport {

    public static MyTest myTestFactory() {
        return new MyTest();
    }

    public void performCallback() {
        new Thread(() -> {
            doCallback("THIS IS FROM CALLBACK TO A CHANNEL...");
        }).start();
    }

    public void performTenCallbacks() {
        new Thread(() -> {
            IntStream.range(0, 10).forEach(i -> doCallback("THIS IS FROM CALLBACK TO A CHANNEL..." + i));
        }).start();
    }

    public void performCallbackFromTenThreads() {
        IntStream.range(0, 10).forEach(i -> performCallback());
    }

    public static void main(String[] args) {
        for (long i = 0; i < Long.MAX_VALUE; i++) {
            if (i % 100000 == 0) {
                System.out.println(i);
            }
            new MySecondTest();
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy