Java Code Examples for java.util.concurrent.CountedCompleter#tryComplete()
The following examples show how to use
java.util.concurrent.CountedCompleter#tryComplete() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ArraysParallelSortHelpers.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
public final void compute() { CountedCompleter<?> s = this; char[] a = this.a, w = this.w; // localize all params int b = this.base, n = this.size, wb = this.wbase, g = this.gran; while (n > g) { int h = n >>> 1, q = h >>> 1, u = h + q; // quartiles Relay fc = new Relay(new Merger(s, w, a, wb, h, wb+h, n-h, b, g)); Relay rc = new Relay(new Merger(fc, a, w, b+h, q, b+u, n-u, wb+h, g)); new Sorter(rc, a, w, b+u, n-u, wb+u, g).fork(); new Sorter(rc, a, w, b+h, q, wb+h, g).fork();; Relay bc = new Relay(new Merger(fc, a, w, b, q, b+q, h-q, wb, g)); new Sorter(bc, a, w, b+q, h-q, wb+q, g).fork(); s = new EmptyCompleter(bc); n = q; } DualPivotQuicksort.sort(a, b, b + n - 1, w, wb, n); s.tryComplete(); }
Example 2
Source File: ArraysParallelSortHelpers.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
public final void compute() { CountedCompleter<?> s = this; char[] a = this.a, w = this.w; // localize all params int b = this.base, n = this.size, wb = this.wbase, g = this.gran; while (n > g) { int h = n >>> 1, q = h >>> 1, u = h + q; // quartiles Relay fc = new Relay(new Merger(s, w, a, wb, h, wb+h, n-h, b, g)); Relay rc = new Relay(new Merger(fc, a, w, b+h, q, b+u, n-u, wb+h, g)); new Sorter(rc, a, w, b+u, n-u, wb+u, g).fork(); new Sorter(rc, a, w, b+h, q, wb+h, g).fork();; Relay bc = new Relay(new Merger(fc, a, w, b, q, b+q, h-q, wb, g)); new Sorter(bc, a, w, b+q, h-q, wb+q, g).fork(); s = new EmptyCompleter(bc); n = q; } DualPivotQuicksort.sort(a, b, b + n - 1, w, wb, n); s.tryComplete(); }
Example 3
Source File: ArraysParallelSortHelpers.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
public final void compute() { CountedCompleter<?> s = this; float[] a = this.a, w = this.w; // localize all params int b = this.base, n = this.size, wb = this.wbase, g = this.gran; while (n > g) { int h = n >>> 1, q = h >>> 1, u = h + q; // quartiles Relay fc = new Relay(new Merger(s, w, a, wb, h, wb+h, n-h, b, g)); Relay rc = new Relay(new Merger(fc, a, w, b+h, q, b+u, n-u, wb+h, g)); new Sorter(rc, a, w, b+u, n-u, wb+u, g).fork(); new Sorter(rc, a, w, b+h, q, wb+h, g).fork();; Relay bc = new Relay(new Merger(fc, a, w, b, q, b+q, h-q, wb, g)); new Sorter(bc, a, w, b+q, h-q, wb+q, g).fork(); s = new EmptyCompleter(bc); n = q; } DualPivotQuicksort.sort(a, b, b + n - 1, w, wb, n); s.tryComplete(); }
Example 4
Source File: ArraysParallelSortHelpers.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
public final void compute() { CountedCompleter<?> s = this; int[] a = this.a, w = this.w; // localize all params int b = this.base, n = this.size, wb = this.wbase, g = this.gran; while (n > g) { int h = n >>> 1, q = h >>> 1, u = h + q; // quartiles Relay fc = new Relay(new Merger(s, w, a, wb, h, wb+h, n-h, b, g)); Relay rc = new Relay(new Merger(fc, a, w, b+h, q, b+u, n-u, wb+h, g)); new Sorter(rc, a, w, b+u, n-u, wb+u, g).fork(); new Sorter(rc, a, w, b+h, q, wb+h, g).fork();; Relay bc = new Relay(new Merger(fc, a, w, b, q, b+q, h-q, wb, g)); new Sorter(bc, a, w, b+q, h-q, wb+q, g).fork(); s = new EmptyCompleter(bc); n = q; } DualPivotQuicksort.sort(a, b, b + n - 1, w, wb, n); s.tryComplete(); }
Example 5
Source File: ArraysParallelSortHelpers.java From JDKSourceCode1.8 with MIT License | 6 votes |
public final void compute() { CountedCompleter<?> s = this; int[] a = this.a, w = this.w; // localize all params int b = this.base, n = this.size, wb = this.wbase, g = this.gran; while (n > g) { int h = n >>> 1, q = h >>> 1, u = h + q; // quartiles Relay fc = new Relay(new Merger(s, w, a, wb, h, wb+h, n-h, b, g)); Relay rc = new Relay(new Merger(fc, a, w, b+h, q, b+u, n-u, wb+h, g)); new Sorter(rc, a, w, b+u, n-u, wb+u, g).fork(); new Sorter(rc, a, w, b+h, q, wb+h, g).fork();; Relay bc = new Relay(new Merger(fc, a, w, b, q, b+q, h-q, wb, g)); new Sorter(bc, a, w, b+q, h-q, wb+q, g).fork(); s = new EmptyCompleter(bc); n = q; } DualPivotQuicksort.sort(a, b, b + n - 1, w, wb, n); s.tryComplete(); }
Example 6
Source File: ArraysParallelSortHelpers.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
public final void compute() { CountedCompleter<?> s = this; char[] a = this.a, w = this.w; // localize all params int b = this.base, n = this.size, wb = this.wbase, g = this.gran; while (n > g) { int h = n >>> 1, q = h >>> 1, u = h + q; // quartiles Relay fc = new Relay(new Merger(s, w, a, wb, h, wb+h, n-h, b, g)); Relay rc = new Relay(new Merger(fc, a, w, b+h, q, b+u, n-u, wb+h, g)); new Sorter(rc, a, w, b+u, n-u, wb+u, g).fork(); new Sorter(rc, a, w, b+h, q, wb+h, g).fork();; Relay bc = new Relay(new Merger(fc, a, w, b, q, b+q, h-q, wb, g)); new Sorter(bc, a, w, b+q, h-q, wb+q, g).fork(); s = new EmptyCompleter(bc); n = q; } DualPivotQuicksort.sort(a, b, b + n - 1, w, wb, n); s.tryComplete(); }
Example 7
Source File: ArraysParallelSortHelpers.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
public final void compute() { CountedCompleter<?> s = this; float[] a = this.a, w = this.w; // localize all params int b = this.base, n = this.size, wb = this.wbase, g = this.gran; while (n > g) { int h = n >>> 1, q = h >>> 1, u = h + q; // quartiles Relay fc = new Relay(new Merger(s, w, a, wb, h, wb+h, n-h, b, g)); Relay rc = new Relay(new Merger(fc, a, w, b+h, q, b+u, n-u, wb+h, g)); new Sorter(rc, a, w, b+u, n-u, wb+u, g).fork(); new Sorter(rc, a, w, b+h, q, wb+h, g).fork();; Relay bc = new Relay(new Merger(fc, a, w, b, q, b+q, h-q, wb, g)); new Sorter(bc, a, w, b+q, h-q, wb+q, g).fork(); s = new EmptyCompleter(bc); n = q; } DualPivotQuicksort.sort(a, b, b + n - 1, w, wb, n); s.tryComplete(); }
Example 8
Source File: ArraysParallelSortHelpers.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
public final void compute() { CountedCompleter<?> s = this; float[] a = this.a, w = this.w; // localize all params int b = this.base, n = this.size, wb = this.wbase, g = this.gran; while (n > g) { int h = n >>> 1, q = h >>> 1, u = h + q; // quartiles Relay fc = new Relay(new Merger(s, w, a, wb, h, wb+h, n-h, b, g)); Relay rc = new Relay(new Merger(fc, a, w, b+h, q, b+u, n-u, wb+h, g)); new Sorter(rc, a, w, b+u, n-u, wb+u, g).fork(); new Sorter(rc, a, w, b+h, q, wb+h, g).fork();; Relay bc = new Relay(new Merger(fc, a, w, b, q, b+q, h-q, wb, g)); new Sorter(bc, a, w, b+q, h-q, wb+q, g).fork(); s = new EmptyCompleter(bc); n = q; } DualPivotQuicksort.sort(a, b, b + n - 1, w, wb, n); s.tryComplete(); }
Example 9
Source File: ArraysParallelSortHelpers.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
public final void compute() { CountedCompleter<?> s = this; long[] a = this.a, w = this.w; // localize all params int b = this.base, n = this.size, wb = this.wbase, g = this.gran; while (n > g) { int h = n >>> 1, q = h >>> 1, u = h + q; // quartiles Relay fc = new Relay(new Merger(s, w, a, wb, h, wb+h, n-h, b, g)); Relay rc = new Relay(new Merger(fc, a, w, b+h, q, b+u, n-u, wb+h, g)); new Sorter(rc, a, w, b+u, n-u, wb+u, g).fork(); new Sorter(rc, a, w, b+h, q, wb+h, g).fork();; Relay bc = new Relay(new Merger(fc, a, w, b, q, b+q, h-q, wb, g)); new Sorter(bc, a, w, b+q, h-q, wb+q, g).fork(); s = new EmptyCompleter(bc); n = q; } DualPivotQuicksort.sort(a, b, b + n - 1, w, wb, n); s.tryComplete(); }
Example 10
Source File: ArraysParallelSortHelpers.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
public final void compute() { CountedCompleter<?> s = this; float[] a = this.a, w = this.w; // localize all params int b = this.base, n = this.size, wb = this.wbase, g = this.gran; while (n > g) { int h = n >>> 1, q = h >>> 1, u = h + q; // quartiles Relay fc = new Relay(new Merger(s, w, a, wb, h, wb+h, n-h, b, g)); Relay rc = new Relay(new Merger(fc, a, w, b+h, q, b+u, n-u, wb+h, g)); new Sorter(rc, a, w, b+u, n-u, wb+u, g).fork(); new Sorter(rc, a, w, b+h, q, wb+h, g).fork();; Relay bc = new Relay(new Merger(fc, a, w, b, q, b+q, h-q, wb, g)); new Sorter(bc, a, w, b+q, h-q, wb+q, g).fork(); s = new EmptyCompleter(bc); n = q; } DualPivotQuicksort.sort(a, b, b + n - 1, w, wb, n); s.tryComplete(); }
Example 11
Source File: ArraysParallelSortHelpers.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
public final void compute() { CountedCompleter<?> s = this; char[] a = this.a, w = this.w; // localize all params int b = this.base, n = this.size, wb = this.wbase, g = this.gran; while (n > g) { int h = n >>> 1, q = h >>> 1, u = h + q; // quartiles Relay fc = new Relay(new Merger(s, w, a, wb, h, wb+h, n-h, b, g)); Relay rc = new Relay(new Merger(fc, a, w, b+h, q, b+u, n-u, wb+h, g)); new Sorter(rc, a, w, b+u, n-u, wb+u, g).fork(); new Sorter(rc, a, w, b+h, q, wb+h, g).fork();; Relay bc = new Relay(new Merger(fc, a, w, b, q, b+q, h-q, wb, g)); new Sorter(bc, a, w, b+q, h-q, wb+q, g).fork(); s = new EmptyCompleter(bc); n = q; } DualPivotQuicksort.sort(a, b, b + n - 1, w, wb, n); s.tryComplete(); }
Example 12
Source File: ArraysParallelSortHelpers.java From JDKSourceCode1.8 with MIT License | 6 votes |
public final void compute() { CountedCompleter<?> s = this; char[] a = this.a, w = this.w; // localize all params int b = this.base, n = this.size, wb = this.wbase, g = this.gran; while (n > g) { int h = n >>> 1, q = h >>> 1, u = h + q; // quartiles Relay fc = new Relay(new Merger(s, w, a, wb, h, wb+h, n-h, b, g)); Relay rc = new Relay(new Merger(fc, a, w, b+h, q, b+u, n-u, wb+h, g)); new Sorter(rc, a, w, b+u, n-u, wb+u, g).fork(); new Sorter(rc, a, w, b+h, q, wb+h, g).fork();; Relay bc = new Relay(new Merger(fc, a, w, b, q, b+q, h-q, wb, g)); new Sorter(bc, a, w, b+q, h-q, wb+q, g).fork(); s = new EmptyCompleter(bc); n = q; } DualPivotQuicksort.sort(a, b, b + n - 1, w, wb, n); s.tryComplete(); }
Example 13
Source File: ArraysParallelSortHelpers.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
public final void compute() { CountedCompleter<?> s = this; float[] a = this.a, w = this.w; // localize all params int b = this.base, n = this.size, wb = this.wbase, g = this.gran; while (n > g) { int h = n >>> 1, q = h >>> 1, u = h + q; // quartiles Relay fc = new Relay(new Merger(s, w, a, wb, h, wb+h, n-h, b, g)); Relay rc = new Relay(new Merger(fc, a, w, b+h, q, b+u, n-u, wb+h, g)); new Sorter(rc, a, w, b+u, n-u, wb+u, g).fork(); new Sorter(rc, a, w, b+h, q, wb+h, g).fork();; Relay bc = new Relay(new Merger(fc, a, w, b, q, b+q, h-q, wb, g)); new Sorter(bc, a, w, b+q, h-q, wb+q, g).fork(); s = new EmptyCompleter(bc); n = q; } DualPivotQuicksort.sort(a, b, b + n - 1, w, wb, n); s.tryComplete(); }
Example 14
Source File: ArraysParallelSortHelpers.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
public final void compute() { CountedCompleter<?> s = this; short[] a = this.a, w = this.w; // localize all params int b = this.base, n = this.size, wb = this.wbase, g = this.gran; while (n > g) { int h = n >>> 1, q = h >>> 1, u = h + q; // quartiles Relay fc = new Relay(new Merger(s, w, a, wb, h, wb+h, n-h, b, g)); Relay rc = new Relay(new Merger(fc, a, w, b+h, q, b+u, n-u, wb+h, g)); new Sorter(rc, a, w, b+u, n-u, wb+u, g).fork(); new Sorter(rc, a, w, b+h, q, wb+h, g).fork();; Relay bc = new Relay(new Merger(fc, a, w, b, q, b+q, h-q, wb, g)); new Sorter(bc, a, w, b+q, h-q, wb+q, g).fork(); s = new EmptyCompleter(bc); n = q; } DualPivotQuicksort.sort(a, b, b + n - 1, w, wb, n); s.tryComplete(); }
Example 15
Source File: ArraysParallelSortHelpers.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
public final void compute() { CountedCompleter<?> s = this; byte[] a = this.a, w = this.w; // localize all params int b = this.base, n = this.size, wb = this.wbase, g = this.gran; while (n > g) { int h = n >>> 1, q = h >>> 1, u = h + q; // quartiles Relay fc = new Relay(new Merger(s, w, a, wb, h, wb+h, n-h, b, g)); Relay rc = new Relay(new Merger(fc, a, w, b+h, q, b+u, n-u, wb+h, g)); new Sorter(rc, a, w, b+u, n-u, wb+u, g).fork(); new Sorter(rc, a, w, b+h, q, wb+h, g).fork();; Relay bc = new Relay(new Merger(fc, a, w, b, q, b+q, h-q, wb, g)); new Sorter(bc, a, w, b+q, h-q, wb+q, g).fork(); s = new EmptyCompleter(bc); n = q; } DualPivotQuicksort.sort(a, b, b + n - 1); s.tryComplete(); }
Example 16
Source File: ArraysParallelSortHelpers.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
public final void compute() { CountedCompleter<?> s = this; double[] a = this.a, w = this.w; // localize all params int b = this.base, n = this.size, wb = this.wbase, g = this.gran; while (n > g) { int h = n >>> 1, q = h >>> 1, u = h + q; // quartiles Relay fc = new Relay(new Merger(s, w, a, wb, h, wb+h, n-h, b, g)); Relay rc = new Relay(new Merger(fc, a, w, b+h, q, b+u, n-u, wb+h, g)); new Sorter(rc, a, w, b+u, n-u, wb+u, g).fork(); new Sorter(rc, a, w, b+h, q, wb+h, g).fork();; Relay bc = new Relay(new Merger(fc, a, w, b, q, b+q, h-q, wb, g)); new Sorter(bc, a, w, b+q, h-q, wb+q, g).fork(); s = new EmptyCompleter(bc); n = q; } DualPivotQuicksort.sort(a, b, b + n - 1, w, wb, n); s.tryComplete(); }
Example 17
Source File: ArraysParallelSortHelpers.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
public final void compute() { CountedCompleter<?> s = this; byte[] a = this.a, w = this.w; // localize all params int b = this.base, n = this.size, wb = this.wbase, g = this.gran; while (n > g) { int h = n >>> 1, q = h >>> 1, u = h + q; // quartiles Relay fc = new Relay(new Merger(s, w, a, wb, h, wb+h, n-h, b, g)); Relay rc = new Relay(new Merger(fc, a, w, b+h, q, b+u, n-u, wb+h, g)); new Sorter(rc, a, w, b+u, n-u, wb+u, g).fork(); new Sorter(rc, a, w, b+h, q, wb+h, g).fork();; Relay bc = new Relay(new Merger(fc, a, w, b, q, b+q, h-q, wb, g)); new Sorter(bc, a, w, b+q, h-q, wb+q, g).fork(); s = new EmptyCompleter(bc); n = q; } DualPivotQuicksort.sort(a, b, b + n - 1); s.tryComplete(); }
Example 18
Source File: ArraysParallelSortHelpers.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
public final void compute() { CountedCompleter<?> s = this; float[] a = this.a, w = this.w; // localize all params int b = this.base, n = this.size, wb = this.wbase, g = this.gran; while (n > g) { int h = n >>> 1, q = h >>> 1, u = h + q; // quartiles Relay fc = new Relay(new Merger(s, w, a, wb, h, wb+h, n-h, b, g)); Relay rc = new Relay(new Merger(fc, a, w, b+h, q, b+u, n-u, wb+h, g)); new Sorter(rc, a, w, b+u, n-u, wb+u, g).fork(); new Sorter(rc, a, w, b+h, q, wb+h, g).fork();; Relay bc = new Relay(new Merger(fc, a, w, b, q, b+q, h-q, wb, g)); new Sorter(bc, a, w, b+q, h-q, wb+q, g).fork(); s = new EmptyCompleter(bc); n = q; } DualPivotQuicksort.sort(a, b, b + n - 1, w, wb, n); s.tryComplete(); }
Example 19
Source File: ArraysParallelSortHelpers.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
public final void compute() { CountedCompleter<?> s = this; int[] a = this.a, w = this.w; // localize all params int b = this.base, n = this.size, wb = this.wbase, g = this.gran; while (n > g) { int h = n >>> 1, q = h >>> 1, u = h + q; // quartiles Relay fc = new Relay(new Merger(s, w, a, wb, h, wb+h, n-h, b, g)); Relay rc = new Relay(new Merger(fc, a, w, b+h, q, b+u, n-u, wb+h, g)); new Sorter(rc, a, w, b+u, n-u, wb+u, g).fork(); new Sorter(rc, a, w, b+h, q, wb+h, g).fork();; Relay bc = new Relay(new Merger(fc, a, w, b, q, b+q, h-q, wb, g)); new Sorter(bc, a, w, b+q, h-q, wb+q, g).fork(); s = new EmptyCompleter(bc); n = q; } DualPivotQuicksort.sort(a, b, b + n - 1, w, wb, n); s.tryComplete(); }
Example 20
Source File: ForkJoinPool8Test.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public final void compute() { CountedCompleter p; CCF f = this; int n = number; while (n >= 2) { new RCCF(f, n - 2).fork(); f = new LCCF(f, --n); } f.number = n; f.onCompletion(f); if ((p = f.getCompleter()) != null) p.tryComplete(); else f.quietlyComplete(); }