1 /*
2  * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * This code is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License version 2 only, as
7  * published by the Free Software Foundation.
8  *
9  * This code is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12  * version 2 for more details (a copy is included in the LICENSE file that
13  * accompanied this code).
14  *
15  * You should have received a copy of the GNU General Public License version
16  * 2 along with this work; if not, write to the Free Software Foundation,
17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18  *
19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20  * or visit www.oracle.com if you need additional information or have any
21  * questions.
22  */
23 package nsk.jvmti.scenarios.hotswap.HS202.hs202t001;
24 public class MyObject extends Object {
25         private String name="NO NAME";
26         private int age=100;
27         private boolean updated = true;
28         private String phone="PHONE NUMBER ";
29         private boolean stop=false;
30 
toString()31         public String toString() {
32                 return ("[ name="+name+", age="+age+",phone="+phone+"]");
33         }
34 
hasCode()35         public int hasCode() {
36                 return name.hashCode();
37         }
38 
addAge(int i)39         public synchronized  void addAge(int i) throws InterruptedException {
40                 wait(100);
41                 age+=i;
42                 updated =true;
43                 notifyAll();
44         }
45 
getAge()46         public synchronized int getAge() throws InterruptedException  {
47                 wait(100);
48                 updated = false;
49                 return age;
50         }
isStopped()51         public synchronized boolean isStopped() {
52                 return stop;
53         }
stop(boolean bool)54         public synchronized void stop(boolean bool) {
55                 stop =bool;
56         }
isUpdated()57         public boolean isUpdated() {
58                 return updated;
59         }
leaveMonitor()60         public void leaveMonitor() {
61                 //notifyAll();
62         }
63 
64 }
65