Cleaner.Create Method

Definition

Overloads

Create()

Returns a new Cleaner.

Create(IThreadFactory)

Returns a new Cleaner using a Thread from the ThreadFactory.

Create()

Returns a new Cleaner.

[Android.Runtime.Register("create", "()Ljava/lang/ref/Cleaner;", "", ApiSince=33)]
public static Java.Lang.Ref.Cleaner? Create ();
[<Android.Runtime.Register("create", "()Ljava/lang/ref/Cleaner;", "", ApiSince=33)>]
static member Create : unit -> Java.Lang.Ref.Cleaner

Returns

a new Cleaner

Attributes

Remarks

Returns a new Cleaner.

The cleaner creates a Thread#setDaemon(boolean) daemon thread to process the phantom reachable objects and to invoke cleaning actions. The java.lang.Thread#getContextClassLoader context class loader of the thread is set to the ClassLoader#getSystemClassLoader() system class loader. The thread has no permissions, enforced only if a java.lang.System#setSecurityManager(SecurityManager) SecurityManager is set.

The cleaner terminates when it is phantom reachable and all of the registered cleaning actions are complete.

Java documentation for java.lang.ref.Cleaner.create().

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Create(IThreadFactory)

Returns a new Cleaner using a Thread from the ThreadFactory.

[Android.Runtime.Register("create", "(Ljava/util/concurrent/ThreadFactory;)Ljava/lang/ref/Cleaner;", "", ApiSince=33)]
public static Java.Lang.Ref.Cleaner? Create (Java.Util.Concurrent.IThreadFactory? threadFactory);
[<Android.Runtime.Register("create", "(Ljava/util/concurrent/ThreadFactory;)Ljava/lang/ref/Cleaner;", "", ApiSince=33)>]
static member Create : Java.Util.Concurrent.IThreadFactory -> Java.Lang.Ref.Cleaner

Parameters

threadFactory
IThreadFactory

a ThreadFactory to return a new Thread to process cleaning actions

Returns

a new Cleaner

Attributes

Remarks

Returns a new Cleaner using a Thread from the ThreadFactory.

A thread from the thread factory's ThreadFactory#newThread(Runnable) newThread method is set to be a Thread#setDaemon(boolean) daemon thread and started to process phantom reachable objects and invoke cleaning actions. On each call the ThreadFactory#newThread(Runnable) thread factory must provide a Thread that is suitable for performing the cleaning actions.

The cleaner terminates when it is phantom reachable and all of the registered cleaning actions are complete.

Java documentation for java.lang.ref.Cleaner.create(java.util.concurrent.ThreadFactory).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to