/*
* 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.
*/
/*
*/
implements Test {
}
// hold the target if not already held
}
return "Message received: " + msg;
}
try {
//export "Foo"
+ "/Foo", foo);
try {
//export "Bar" after leases have been expired.
+ "/Bar", bar);
} catch (Exception e) {
throw new RemoteException(e.getMessage());
}
} catch (Exception e) {
e.printStackTrace();
} finally {
}
}
t.start();
return t;
}
}
public void run() {
try {
// give dgc dirty calls time to finish.
timeOut));
} catch (Exception e) {
e.printStackTrace();
}
}
}
static class LockTargetCheckLeases
}
try {
("sun.rmi.transport.ObjectTable");
/* get the Target that corresponds to toLock from the
* ObjectTable
*/
objTableGetTarget.setAccessible(true);
// make sure the lease on this object has expired.
// stop other threads from using the target for toLock.
synchronized (lockTarget) {
}
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
}
/* leases have long values, so no dirty calls which would lock out
* a clean call, but the leases need to expire anyway, so we do it
* explicitly.
*/
// put this into another class?
try {
getDGCImpl.setAccessible(true);
// make sure the lease on this object has expired.
/* Get the lease table from the DGCImpl. */
reflectedLeaseTable.setAccessible(true);
// dont really need this synchronization...
synchronized (leaseTable) {
/* Get the notifySet in the leaseInfo object. */
notifySetField.setAccessible(true);
/* Get and set the expiration field from the info object. */
getDeclaredField("expiration");
expirationField.setAccessible(true);
}
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
// no interesting return value for this privileged action
return null;
}
});
}
}