提交 1333b155 编写于 作者: R robm

Merge

...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
* under the License. * under the License.
*/ */
/* /*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
*/ */
/* /*
* $Id: DOMURIDereferencer.java 1231033 2012-01-13 12:12:12Z coheigea $ * $Id: DOMURIDereferencer.java 1231033 2012-01-13 12:12:12Z coheigea $
...@@ -111,7 +111,8 @@ public class DOMURIDereferencer implements URIDereferencer { ...@@ -111,7 +111,8 @@ public class DOMURIDereferencer implements URIDereferencer {
try { try {
ResourceResolver apacheResolver = ResourceResolver apacheResolver =
ResourceResolver.getInstance(uriAttr, baseURI, secVal); ResourceResolver.getInstance(uriAttr, baseURI, secVal);
XMLSignatureInput in = apacheResolver.resolve(uriAttr, baseURI); XMLSignatureInput in = apacheResolver.resolve(uriAttr,
baseURI, secVal);
if (in.isOctetStream()) { if (in.isOctetStream()) {
return new ApacheOctetStreamData(in); return new ApacheOctetStreamData(in);
} else { } else {
......
/* /*
* Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -118,6 +118,9 @@ public class DGCAckHandler { ...@@ -118,6 +118,9 @@ public class DGCAckHandler {
if (objList != null && task == null) { if (objList != null && task == null) {
task = scheduler.schedule(new Runnable() { task = scheduler.schedule(new Runnable() {
public void run() { public void run() {
if (id != null) {
idTable.remove(id);
}
release(); release();
} }
}, dgcAckTimeout, TimeUnit.MILLISECONDS); }, dgcAckTimeout, TimeUnit.MILLISECONDS);
......
...@@ -669,7 +669,7 @@ public class XBaseWindow { ...@@ -669,7 +669,7 @@ public class XBaseWindow {
XToolkit.awtLock(); XToolkit.awtLock();
try { try {
XAtom xa = XAtom.get(XAtom.XA_WM_CLASS); XAtom xa = XAtom.get(XAtom.XA_WM_CLASS);
xa.setProperty8(getWindow(), cl[0] + '\0' + cl[1]); xa.setProperty8(getWindow(), cl[0] + '\0' + cl[1] + '\0');
} finally { } finally {
XToolkit.awtUnlock(); XToolkit.awtUnlock();
} }
......
...@@ -170,6 +170,9 @@ public class Locks { ...@@ -170,6 +170,9 @@ public class Locks {
private static CheckerThread checker; private static CheckerThread checker;
static class WaitingThread extends Thread { static class WaitingThread extends Thread {
private final Phaser p; private final Phaser p;
volatile boolean waiting = false;
public WaitingThread(Phaser p) { public WaitingThread(Phaser p) {
super("WaitingThread"); super("WaitingThread");
this.p = p; this.p = p;
...@@ -180,7 +183,9 @@ public class Locks { ...@@ -180,7 +183,9 @@ public class Locks {
log("WaitingThread about to wait on objC"); log("WaitingThread about to wait on objC");
try { try {
// Signal checker thread, about to wait on objC. // Signal checker thread, about to wait on objC.
waiting = false;
p.arriveAndAwaitAdvance(); // Phase 1 (waiting) p.arriveAndAwaitAdvance(); // Phase 1 (waiting)
waiting = true;
objC.wait(); objC.wait();
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); e.printStackTrace();
...@@ -199,7 +204,9 @@ public class Locks { ...@@ -199,7 +204,9 @@ public class Locks {
synchronized(objC) { synchronized(objC) {
try { try {
// signal checker thread, about to wait on objC // signal checker thread, about to wait on objC
waiting = false;
p.arriveAndAwaitAdvance(); // Phase 3 (waiting) p.arriveAndAwaitAdvance(); // Phase 3 (waiting)
waiting = true;
objC.wait(); objC.wait();
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); e.printStackTrace();
...@@ -208,25 +215,35 @@ public class Locks { ...@@ -208,25 +215,35 @@ public class Locks {
} }
log("WaitingThread about to exit waiting on objC 2"); log("WaitingThread about to exit waiting on objC 2");
} }
public void waitForWaiting() {
p.arriveAndAwaitAdvance();
while (!waiting) {
goSleep(10);
} }
static class CheckerThread extends Thread { waitForState(State.WAITING);
private final Phaser p;
public CheckerThread(Phaser p) {
super("CheckerThread");
this.p = p;
} }
private void waitForState(Thread.State state) { public void waitForBlocked() {
p.arriveAndAwaitAdvance(); p.arriveAndAwaitAdvance();
waitForState(State.BLOCKED);
}
private void waitForState(Thread.State state) {
while (!waiter.isInterrupted() && waiter.getState() != state) { while (!waiter.isInterrupted() && waiter.getState() != state) {
goSleep(10); Thread.yield();
} }
} }
}
static class CheckerThread extends Thread {
public CheckerThread() {
super("CheckerThread");
}
public void run() { public void run() {
synchronized (ready) { synchronized (ready) {
// wait until WaitingThread about to wait for objC // wait until WaitingThread about to wait for objC
waitForState(Thread.State.WAITING); // Phase 1 (waiting) waiter.waitForWaiting(); // Phase 1 (waiting)
checkBlockedObject(waiter, objC, null, Thread.State.WAITING); checkBlockedObject(waiter, objC, null, Thread.State.WAITING);
synchronized (objC) { synchronized (objC) {
...@@ -235,13 +252,13 @@ public class Locks { ...@@ -235,13 +252,13 @@ public class Locks {
// wait for waiter thread to about to enter // wait for waiter thread to about to enter
// synchronized object ready. // synchronized object ready.
waitForState(Thread.State.BLOCKED); // Phase 2 (waiting) waiter.waitForBlocked(); // Phase 2 (waiting)
checkBlockedObject(waiter, ready, this, Thread.State.BLOCKED); checkBlockedObject(waiter, ready, this, Thread.State.BLOCKED);
} }
// wait for signal from waiting thread that it is about // wait for signal from waiting thread that it is about
// wait for objC. // wait for objC.
waitForState(Thread.State.WAITING); // Phase 3 (waiting) waiter.waitForWaiting(); // Phase 3 (waiting)
synchronized(objC) { synchronized(objC) {
checkBlockedObject(waiter, objC, Thread.currentThread(), Thread.State.WAITING); checkBlockedObject(waiter, objC, Thread.currentThread(), Thread.State.WAITING);
objC.notify(); objC.notify();
...@@ -289,7 +306,7 @@ public class Locks { ...@@ -289,7 +306,7 @@ public class Locks {
waiter = new WaitingThread(p); waiter = new WaitingThread(p);
waiter.start(); waiter.start();
checker = new CheckerThread(p); checker = new CheckerThread();
checker.start(); checker.start();
try { try {
......
/* /*
* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
*/ */
/* @test /* @test
* @bug 4017232 * @bug 4017232 8046339
* @summary If, after returning a reference to a remote object in the current * @summary If, after returning a reference to a remote object in the current
* VM (which gets implicitly converted to a remote stub), the client fails to * VM (which gets implicitly converted to a remote stub), the client fails to
* both send a DGC dirty call and to send a "DGC acknowledgment", the RMI * both send a DGC dirty call and to send a "DGC acknowledgment", the RMI
...@@ -36,10 +36,14 @@ ...@@ -36,10 +36,14 @@
import java.io.*; import java.io.*;
import java.net.*; import java.net.*;
import java.lang.reflect.Field;
import java.lang.ref.*; import java.lang.ref.*;
import java.rmi.*; import java.rmi.*;
import java.rmi.server.*; import java.rmi.server.*;
import java.util.Map;
import sun.rmi.transport.DGCAckHandler;
interface ReturnRemote extends Remote { interface ReturnRemote extends Remote {
Object returnRemote() throws RemoteException; Object returnRemote() throws RemoteException;
...@@ -48,6 +52,7 @@ interface ReturnRemote extends Remote { ...@@ -48,6 +52,7 @@ interface ReturnRemote extends Remote {
public class DGCAckFailure implements ReturnRemote { public class DGCAckFailure implements ReturnRemote {
private static final long TIMEOUT = 20000; private static final long TIMEOUT = 20000;
private static final long ACK_TIMEOUT = TIMEOUT / 2;
public Object returnRemote() { public Object returnRemote() {
return new Wrapper(this); return new Wrapper(this);
...@@ -55,7 +60,8 @@ public class DGCAckFailure implements ReturnRemote { ...@@ -55,7 +60,8 @@ public class DGCAckFailure implements ReturnRemote {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
System.setProperty("sun.rmi.dgc.ackTimeout", "10000"); System.setProperty("sun.rmi.dgc.ackTimeout",
Long.toString(ACK_TIMEOUT));
/* /*
* Set a socket factory that has a hook for shutting down all client * Set a socket factory that has a hook for shutting down all client
...@@ -93,12 +99,31 @@ public class DGCAckFailure implements ReturnRemote { ...@@ -93,12 +99,31 @@ public class DGCAckFailure implements ReturnRemote {
break; break;
} }
} }
if (ref == weakRef) { if (ref != weakRef) {
System.err.println("TEST PASSED");
} else {
throw new RuntimeException("TEST FAILED: " + throw new RuntimeException("TEST FAILED: " +
"timed out, remote object not garbage collected"); "timed out, remote object not garbage collected");
} }
// 8046339
// All DGCAckHandlers must be properly released after timeout
Thread.sleep(ACK_TIMEOUT + 100);
try {
Field field =
DGCAckHandler.class.getDeclaredField("idTable");
field.setAccessible(true);
Object obj = field.get(null);
Map<?,?> idTable = (Map<?,?>)obj;
if (!idTable.isEmpty()) {
throw new RuntimeException("TEST FAILED: " +
"DGCAckHandler.idTable isn't empty");
}
} catch (ReflectiveOperationException roe) {
throw new RuntimeException(roe);
}
System.err.println("TEST PASSED");
} finally { } finally {
try { try {
UnicastRemoteObject.unexportObject((Remote) weakRef.get(), UnicastRemoteObject.unexportObject((Remote) weakRef.get(),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册