< prev index next >
src/java.base/share/classes/java/lang/ref/Reference.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
@@ -28,10 +28,13 @@
import sun.misc.Cleaner;
import sun.misc.JavaLangRefAccess;
import sun.misc.ManagedLocalsThread;
import sun.misc.SharedSecrets;
+import java.util.function.Consumer;
+import java.util.function.Supplier;
+
/**
* Abstract base class for reference objects. This class defines the
* operations common to all reference objects. Because reference objects are
* implemented in close cooperation with the garbage collector, this class may
* not be subclassed directly.
@@ -236,10 +239,14 @@
SharedSecrets.setJavaLangRefAccess(new JavaLangRefAccess() {
@Override
public boolean tryHandlePendingReference() {
return tryHandlePending(false);
}
+ @Override
+ public <T> Reference<T> createFinalizator(T finalizee, Consumer<? super T> thunk) {
+ return new Finalizator<>(finalizee, thunk);
+ }
});
}
/* -- Referent accessor and setters -- */
< prev index next >