programming-examples/java/SquareKaro.java

23 lines
723 B
Java
Raw Normal View History

2019-11-18 13:43:20 +01:00
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
public class SquareKaro
{
public static void main(String[] args)
{
BlockingQueue<Integer> number = new LinkedBlockingQueue<>();
BlockingQueue<SquareResult> result = new LinkedBlockingQueue<>();
Squarer mysquarer = new Squarer(number, result);
mysquarer.start();
try
{
System.out.println("Hey another process, give me square of => 54");
number.put(54);
System.out.println(result.take());
}
catch(Exception e)
{
e.printStackTrace();
}
}
}