Class Unmanaged<T>

  • Type Parameters:
    T - the type of the CDI instance to create

    public class Unmanaged<T>
    extends java.lang.Object
    Helper class for manually maintaining CDI created instances which are not managed by the CDI container. Be aware that instances created that way are not managed by the CDI container and thus need to be cleaned up manually to not create memory leaks!. Normal code shall use Instance if possible. The reason for using UnmanagedInstance is for @Dependent scoped instances which should not pollute the CreationalContext of the containing instance. Note that the methods of UnmanagedInstance needs to be called in a well defined order. Please note that this classes are not thread safe!
    Since:
    1.1