Top Description Fields Constructors Methods
org.jvnet.hk2.internal

public Class ServiceHandleImpl<T>

extends Object
implements ServiceHandle<T>
Class Inheritance
All Implemented Interfaces
org.glassfish.hk2.api.ServiceHandle, java.io.Closeable, java.lang.AutoCloseable
Type Parameters
<T>
The type of service to create
Imports
java.util.ArrayList, .LinkedList, .List, java.util.concurrent.locks.ReentrantLock, org.glassfish.hk2.api.ActiveDescriptor, .Context, .Injectee, .PerLookup, .ServiceHandle, org.glassfish.hk2.utilities.reflection.ReflectionHelper

This handle does the underlying work of getting the service. Only at the time that the getService call is made is the service gotten from the context. Once a service has been gotten, it is not looked up again.
Author
jwells

Field Summary

Modifier and TypeField and Description
private final LinkedList<Injectee>
private final ServiceLocatorImpl
private final ReentrantLock
private final ActiveDescriptor<T>
private T
private Object
private boolean
private boolean
private final LinkedList<ServiceHandleImpl<?>>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
addSubHandle(ServiceHandleImpl<?>
A handle to add for proper destruction
subHandle
)

Add a sub handle to this for proper destruction

public void
close()

Overrides default org.glassfish.hk2.api.ServiceHandle.close.

Will destroy this object and all PerLookup instances created because of this service

public ActiveDescriptor<T>
getActiveDescriptor()

Implements org.glassfish.hk2.api.ServiceHandle.getActiveDescriptor.

Returns the ActiveDescriptor associated with this service handle

private Injectee
public Injectee
public T
getService()

Implements org.glassfish.hk2.api.ServiceHandle.getService.

Gets the underlying service object

pack-priv T
public Object
getServiceData()

Implements org.glassfish.hk2.api.ServiceHandle.getServiceData.

Service data can be set on a service handle.

public List<ServiceHandle<?>>
getSubHandles()

Implements org.glassfish.hk2.api.ServiceHandle.getSubHandles.

Returns a list of subordinate subhandles to this root handle

public boolean
isActive()

Implements org.glassfish.hk2.api.ServiceHandle.isActive.

This returns true if the underlying service has already been created

public void
public void
public void
setServiceData(Object serviceData)

Implements org.glassfish.hk2.api.ServiceHandle.setServiceData.

Service data can be set on a service handle.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

injecteesback to summary
private final LinkedList<Injectee> injectees
locatorback to summary
private final ServiceLocatorImpl locator
lockback to summary
private final ReentrantLock lock
rootback to summary
private final ActiveDescriptor<T> root
serviceback to summary
private T service
serviceDataback to summary
private Object serviceData
serviceDestroyedback to summary
private boolean serviceDestroyed
serviceSetback to summary
private boolean serviceSet
subHandlesback to summary
private final LinkedList<ServiceHandleImpl<?>> subHandles

Constructor Detail

ServiceHandleImplback to summary
pack-priv ServiceHandleImpl(ServiceLocatorImpl locator, ActiveDescriptor<T> root, Injectee injectee)

Method Detail

addSubHandleback to summary
public void addSubHandle(ServiceHandleImpl<?> subHandle)

Add a sub handle to this for proper destruction

Parameters
subHandle:ServiceHandleImpl<?>

A handle to add for proper destruction

closeback to summary
public void close()

Overrides default org.glassfish.hk2.api.ServiceHandle.close.

Doc from org.glassfish.hk2.api.ServiceHandle.close.

Will destroy this object and all PerLookup instances created because of this service

Annotations
@Override
getActiveDescriptorback to summary
public ActiveDescriptor<T> getActiveDescriptor()

Implements org.glassfish.hk2.api.ServiceHandle.getActiveDescriptor.

Doc from org.glassfish.hk2.api.ServiceHandle.getActiveDescriptor.

Returns the ActiveDescriptor associated with this service handle

Annotations
@Override
getLastInjecteeback to summary
private Injectee getLastInjectee()
getOriginalRequestback to summary
public Injectee getOriginalRequest()
getServiceback to summary
public T getService()

Implements org.glassfish.hk2.api.ServiceHandle.getService.

Doc from org.glassfish.hk2.api.ServiceHandle.getService.

Gets the underlying service object

Annotations
@Override
getServiceback to summary
pack-priv T getService(ServiceHandle<T> handle)
getServiceDataback to summary
public Object getServiceData()

Implements org.glassfish.hk2.api.ServiceHandle.getServiceData.

Doc from org.glassfish.hk2.api.ServiceHandle.getServiceData.

Service data can be set on a service handle. If the service data is set prior to the services associated Context has created an instance then this service data can be used to influence the context's creation of the service. The service data is associated with a handle, not with the service itself

Annotations
@Override
getSubHandlesback to summary
public List<ServiceHandle<?>> getSubHandles()

Implements org.glassfish.hk2.api.ServiceHandle.getSubHandles.

Doc from org.glassfish.hk2.api.ServiceHandle.getSubHandles.

Returns a list of subordinate subhandles to this root handle

Annotations
@Override
isActiveback to summary
public boolean isActive()

Implements org.glassfish.hk2.api.ServiceHandle.isActive.

Doc from org.glassfish.hk2.api.ServiceHandle.isActive.

This returns true if the underlying service has already been created

Annotations
@Override
popInjecteeback to summary
public void popInjectee()
pushInjecteeback to summary
public void pushInjectee(Injectee push)
setServiceDataback to summary
public void setServiceData(Object serviceData)

Implements org.glassfish.hk2.api.ServiceHandle.setServiceData.

Doc from org.glassfish.hk2.api.ServiceHandle.setServiceData.

Service data can be set on a service handle. If the service data is set prior to the services associated Context has created an instance then this service data can be used to influence the context's creation of the service. The service data is associated with a handle, not with the service itself

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override