class SunManagementHeapAllocation extends HeapAllocation {

    @Override
    public long allocatedBytes( long threadId )
    {
        if ( !threadMXBean.isThreadAllocatedMemorySupported() )
        {
            return -1;
        }
        if ( !threadMXBean.isThreadAllocatedMemoryEnabled() )
        {
            threadMXBean.setThreadAllocatedMemoryEnabled( true );
        }
        return threadMXBean.getThreadAllocatedBytes( threadId );
    }

    private  SunManagementHeapAllocation( ThreadMXBean threadMXBean );

}