public class DummyWorkspace extends Object implements MemoryWorkspace
MemoryWorkspace.Type
Modifier and Type | Field and Description |
---|---|
protected MemoryWorkspace |
parentWorkspace |
DEFAULT_ID
Constructor and Description |
---|
DummyWorkspace() |
Modifier and Type | Method and Description |
---|---|
PagedPointer |
alloc(long requiredMemory,
DataType dataType,
boolean initialize)
This method does allocation from a given Workspace
|
PagedPointer |
alloc(long requiredMemory,
MemoryKind kind,
DataType dataType,
boolean initialize)
This method does allocation from a given Workspace
|
void |
close()
This method is for compatibility with "try-with-resources" java blocks.
|
Deallocator |
deallocator()
This method returns deallocator associated with this instance
|
void |
destroyWorkspace()
This method causes Workspace destruction: all memory allocations are released after this call.
|
void |
destroyWorkspace(boolean extended) |
void |
enableDebug(boolean reallyEnable)
This method enabled debugging mode for this workspace
|
long |
getCurrentOffset()
This mehtod returns current offset within buffer
|
long |
getCurrentSize()
This methos returns current allocated size of this workspace
|
int |
getDeviceId()
Returns deviceId for this workspace
|
long |
getGenerationId()
This method returns current generation Id
|
String |
getId()
This method returns Id of this workspace
|
long |
getLastCycleAllocations()
This method returns amount of memory consumed in last successful cycle, in bytes
|
long |
getMaxCycleAllocations()
This method returns amount of memory consumed by largest successful cycle, in bytes
|
MemoryWorkspace |
getParentWorkspace()
This method returns parent Workspace, if any.
|
long |
getPrimaryOffset() |
long |
getThisCycleAllocations()
This method returns amount of memory consumed in last successful cycle, in bytes
|
Long |
getThreadId()
This method returns threadId where this workspace was created
|
String |
getUniqueId()
This method returns unique ID for this instance
|
WorkspaceConfiguration |
getWorkspaceConfiguration()
This method returns WorkspaceConfiguration bean that was used for given Workspace instance
|
MemoryWorkspace.Type |
getWorkspaceType()
This method returns Type of this workspace
|
void |
initializeWorkspace()
This method causes Workspace initialization
|
boolean |
isScopeActive()
This method returns True if scope was opened, and not closed yet.
|
MemoryWorkspace |
notifyScopeBorrowed()
This method TEMPORARY enters this workspace, without reset applied
|
MemoryWorkspace |
notifyScopeEntered()
This method notifies given Workspace that new use cycle is starting now
|
MemoryWorkspace |
notifyScopeLeft()
This method notifies given Workspace that use cycle just ended
|
void |
setPreviousWorkspace(MemoryWorkspace memoryWorkspace)
Set the previous workspace, if any
NOTE: this method should only be used if you are fully aware of the consequences of doing so. |
MemoryWorkspace |
tagOutOfScopeUse()
This method temporary disables this workspace
|
int |
targetDevice()
This method returns deviceId it's affined with, so deallocator thread will be guaranteed to match it
|
void |
toggleWorkspaceUse(boolean isEnabled)
This method allows you to temporary disable/enable given Workspace use.
|
protected MemoryWorkspace parentWorkspace
public WorkspaceConfiguration getWorkspaceConfiguration()
getWorkspaceConfiguration
in interface MemoryWorkspace
public String getId()
getId
in interface MemoryWorkspace
public Long getThreadId()
MemoryWorkspace
getThreadId
in interface MemoryWorkspace
public int getDeviceId()
MemoryWorkspace
getDeviceId
in interface MemoryWorkspace
public MemoryWorkspace.Type getWorkspaceType()
MemoryWorkspace
getWorkspaceType
in interface MemoryWorkspace
public PagedPointer alloc(long requiredMemory, DataType dataType, boolean initialize)
alloc
in interface MemoryWorkspace
requiredMemory
- allocation size, in bytesdataType
- dataType that is going to be usedinitialize
- public PagedPointer alloc(long requiredMemory, MemoryKind kind, DataType dataType, boolean initialize)
alloc
in interface MemoryWorkspace
requiredMemory
- allocation size, in byteskind
- MemoryKind for allocationdataType
- dataType that is going to be usedinitialize
- public long getGenerationId()
MemoryWorkspace
getGenerationId
in interface MemoryWorkspace
public MemoryWorkspace notifyScopeEntered()
notifyScopeEntered
in interface MemoryWorkspace
public MemoryWorkspace notifyScopeBorrowed()
notifyScopeBorrowed
in interface MemoryWorkspace
public MemoryWorkspace notifyScopeLeft()
notifyScopeLeft
in interface MemoryWorkspace
public boolean isScopeActive()
isScopeActive
in interface MemoryWorkspace
public void initializeWorkspace()
PLEASE NOTE: This call will have no effect on previously initialized Workspace
initializeWorkspace
in interface MemoryWorkspace
public void destroyWorkspace()
destroyWorkspace
in interface MemoryWorkspace
public void destroyWorkspace(boolean extended)
destroyWorkspace
in interface MemoryWorkspace
public void toggleWorkspaceUse(boolean isEnabled)
toggleWorkspaceUse
in interface MemoryWorkspace
isEnabled
- public long getThisCycleAllocations()
getThisCycleAllocations
in interface MemoryWorkspace
public void enableDebug(boolean reallyEnable)
enableDebug
in interface MemoryWorkspace
reallyEnable
- public long getLastCycleAllocations()
getLastCycleAllocations
in interface MemoryWorkspace
public long getMaxCycleAllocations()
getMaxCycleAllocations
in interface MemoryWorkspace
public long getCurrentSize()
getCurrentSize
in interface MemoryWorkspace
public void close()
MemoryWorkspace
close
in interface AutoCloseable
close
in interface MemoryWorkspace
public MemoryWorkspace getParentWorkspace()
getParentWorkspace
in interface MemoryWorkspace
public MemoryWorkspace tagOutOfScopeUse()
MemoryWorkspace
tagOutOfScopeUse
in interface MemoryWorkspace
public void setPreviousWorkspace(MemoryWorkspace memoryWorkspace)
MemoryWorkspace
setPreviousWorkspace
in interface MemoryWorkspace
memoryWorkspace
- Workspace to set as the previous workspace. This is the workspace that will become active
when this workspace is closed.public long getCurrentOffset()
MemoryWorkspace
getCurrentOffset
in interface MemoryWorkspace
public String getUniqueId()
Deallocatable
getUniqueId
in interface Deallocatable
public Deallocator deallocator()
Deallocatable
deallocator
in interface Deallocatable
public int targetDevice()
Deallocatable
targetDevice
in interface Deallocatable
public long getPrimaryOffset()
getPrimaryOffset
in interface MemoryWorkspace
Copyright © 2020. All rights reserved.