/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4911721
* @author Shanliang JIANG
* @run clean DiffHBTest
* @run build DiffHBTest
* @run main DiffHBTest
*/
import javax.management.*;
/**
* This test registeres an unique listener with two different handbacks,
* it expects to receive a same notification two times.
*/
public class DiffHBTest {
if (s != null) {
} else {
}
}
}
} else {
throw new RuntimeException(errors);
}
}
try {
server =
} catch (Exception e) {
// not support
return null;
}
for (int i=0; i<5; i++) {
long remainingTime = waitingTime;
try {
synchronized(dummyListener) {
}
return dummyListener.errorInfo;
}
}
} finally {
//System.out.println("Unregister: "+i);
}
}
return null;
}
public boolean done = false;
if (!(n instanceof MBeanServerNotification)) {
failed("Received an unexpected notification: "+n);
return;
}
failed("Unkown handback: "+o);
return;
}
// what we need
return;
}
synchronized(this) {
received++;
receivedNotif = msn;
receivedHB = o;
return;
}
if (received > 2) {
return;
}
// second time
if (receivedHB.equals(o)) {
failed("Got same handback twice: "+o);
failed("Unknown handback: "+o);
} else if (receivedNotif.getSequenceNumber() !=
msn.getSequenceNumber()) {
failed("expected to receive:\n"
+"\n but got\n"+msn);
}
// passed
done = true;
this.notify();
}
}
done = true;
this.notify();
}
}
}