JRE-690 Recent bundled JDK VCS Log UI slowdowns
Removed flush threshold logic, it is not so useful after latest optimizations
(cherry picked from commit 9b80de4)
diff --git a/src/share/classes/sun/java2d/opengl/OGLRenderQueue.java b/src/share/classes/sun/java2d/opengl/OGLRenderQueue.java
index 9287e10..369707a 100644
--- a/src/share/classes/sun/java2d/opengl/OGLRenderQueue.java
+++ b/src/share/classes/sun/java2d/opengl/OGLRenderQueue.java
@@ -118,11 +118,10 @@
return (Thread.currentThread() == getInstance().flusher);
}
- @Override
- public void flushNow(boolean sync) {
+ public void flushNow() {
// assert lock.isHeldByCurrentThread();
try {
- flusher.flushNow(sync);
+ flusher.flushNow();
} catch (Exception e) {
System.err.println("exception in flushNow:");
e.printStackTrace();
@@ -158,8 +157,6 @@
private boolean needsFlush;
private Runnable task;
private Error error;
- private final long FLUSH_THRESHOLD = 4;
- private final long DEFAULT_FLUSH_COUNT = 100/FLUSH_THRESHOLD;
public QueueFlusher(ThreadGroup threadGroup) {
super(threadGroup, "Java2D Queue Flusher");
@@ -169,13 +166,9 @@
}
public synchronized void flushNow() {
- flushNow(true);
- }
-
- public synchronized void flushNow(boolean sync) {
// wake up the flusher
needsFlush = true;
- if (!sync) return;
+ notify();
// wait for flush to complete
while (needsFlush) {
@@ -199,27 +192,24 @@
public synchronized void run() {
boolean timedOut = false;
while (true) {
- int count = 0;
while (!needsFlush) {
try {
timedOut = false;
/*
- * Wait FLUSH_THRESHOLD ms then check if needsFlush is set by
- * flushNow() call or we waited DEFAULT_FLUSH_COUNT times.
- * If so, flush the queue.
+ * Wait until we're woken up with a flushNow() call,
+ * or the timeout period elapses (so that we can
+ * flush the queue periodically).
*/
- wait(FLUSH_THRESHOLD);
+ wait(100);
/*
* We will automatically flush the queue if the
* following conditions apply:
- * - the wait() timed out DEFAULT_FLUSH_COUNT times
+ * - the wait() timed out
* - we can lock the queue (without blocking)
* - there is something in the queue to flush
* Otherwise, just continue (we'll flush eventually).
*/
- if (!needsFlush && count >= DEFAULT_FLUSH_COUNT &&
- (timedOut = tryLock()))
- {
+ if (!needsFlush && (timedOut = tryLock())) {
if (buf.position() > 0) {
needsFlush = true;
} else {
@@ -228,7 +218,6 @@
}
} catch (InterruptedException e) {
}
- count++;
}
try {
// reset the throwable state
diff --git a/src/share/classes/sun/java2d/pipe/RenderQueue.java b/src/share/classes/sun/java2d/pipe/RenderQueue.java
index f9b955a..d11bb22 100644
--- a/src/share/classes/sun/java2d/pipe/RenderQueue.java
+++ b/src/share/classes/sun/java2d/pipe/RenderQueue.java
@@ -201,18 +201,7 @@
* This method will block until the entire buffer has been flushed. The
* queue lock must be acquired before calling this method.
*/
- public void flushNow() {
- flushNow(true);
- }
-
- /**
- * Schedule to process each operation currently pending on the buffer.
- * This method will block until the entire buffer has been flushed. The
- * queue lock must be acquired before calling this method.
- * @param sync true, process the operations immediately
- */
- public abstract void flushNow(boolean sync);
-
+ public abstract void flushNow();
/**
* Immediately processes each operation currently pending on the buffer,
diff --git a/src/windows/classes/sun/java2d/d3d/D3DRenderQueue.java b/src/windows/classes/sun/java2d/d3d/D3DRenderQueue.java
index 46c6002..1d6b42f 100644
--- a/src/windows/classes/sun/java2d/d3d/D3DRenderQueue.java
+++ b/src/windows/classes/sun/java2d/d3d/D3DRenderQueue.java
@@ -132,7 +132,7 @@
}
}
- public void flushNow(boolean sync) {
+ public void flushNow() {
// assert lock.isHeldByCurrentThread();
flushBuffer(null);
}