public abstract class BasicWorkspaceManager extends Object implements MemoryWorkspaceManager
Modifier and Type | Class and Description |
---|---|
protected class |
BasicWorkspaceManager.WorkspaceDeallocatorThread |
Modifier and Type | Field and Description |
---|---|
protected ThreadLocal<Map<String,MemoryWorkspace>> |
backingMap |
protected WorkspaceConfiguration |
defaultConfiguration |
Constructor and Description |
---|
BasicWorkspaceManager() |
BasicWorkspaceManager(WorkspaceConfiguration defaultConfiguration) |
Modifier and Type | Method and Description |
---|---|
boolean |
checkIfWorkspaceExists(String id)
This method checks, if Workspace with a given Id was created before this call
|
void |
destroyAllWorkspacesForCurrentThread()
This method destroys all workspaces allocated in current thread
|
void |
destroyWorkspace()
This method destroy default workspace, if any
|
void |
destroyWorkspace(MemoryWorkspace workspace)
This method destroys given workspace
|
protected void |
ensureThreadExistense() |
MemoryWorkspace |
getAndActivateWorkspace()
This method gets & activates default workspace
|
MemoryWorkspace |
getAndActivateWorkspace(String id)
This method gets & activates workspace with a given Id
|
MemoryWorkspace |
getAndActivateWorkspace(WorkspaceConfiguration configuration,
String id)
This method gets & activates default with a given configuration and Id
|
MemoryWorkspace |
getWorkspaceForCurrentThread()
This method will return workspace with default configuration and default id.
|
MemoryWorkspace |
getWorkspaceForCurrentThread(String id) |
protected void |
pickReference(MemoryWorkspace workspace) |
void |
printAllocationStatisticsForCurrentThread()
This method prints out basic statistics for workspaces allocated in current thread
|
MemoryWorkspace |
scopeOutOfWorkspaces()
This method temporary opens block out of any workspace scope.
|
void |
setDefaultWorkspaceConfiguration(WorkspaceConfiguration configuration)
This method allows to specify "Default" configuration, that will be used in signatures which do not have WorkspaceConfiguration argument
|
void |
setWorkspaceForCurrentThread(MemoryWorkspace workspace) |
void |
setWorkspaceForCurrentThread(MemoryWorkspace workspace,
String id) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
createNewWorkspace, createNewWorkspace, createNewWorkspace, createNewWorkspace, getWorkspaceForCurrentThread
protected WorkspaceConfiguration defaultConfiguration
protected ThreadLocal<Map<String,MemoryWorkspace>> backingMap
public BasicWorkspaceManager()
public BasicWorkspaceManager(@NonNull WorkspaceConfiguration defaultConfiguration)
public void setDefaultWorkspaceConfiguration(@NonNull WorkspaceConfiguration configuration)
setDefaultWorkspaceConfiguration
in interface MemoryWorkspaceManager
configuration
- public MemoryWorkspace getWorkspaceForCurrentThread()
getWorkspaceForCurrentThread
in interface MemoryWorkspaceManager
public MemoryWorkspace getWorkspaceForCurrentThread(@NonNull String id)
getWorkspaceForCurrentThread
in interface MemoryWorkspaceManager
protected void pickReference(MemoryWorkspace workspace)
public void setWorkspaceForCurrentThread(MemoryWorkspace workspace)
setWorkspaceForCurrentThread
in interface MemoryWorkspaceManager
public void setWorkspaceForCurrentThread(@NonNull MemoryWorkspace workspace, @NonNull String id)
setWorkspaceForCurrentThread
in interface MemoryWorkspaceManager
public void destroyWorkspace(MemoryWorkspace workspace)
destroyWorkspace
in interface MemoryWorkspaceManager
workspace
- public void destroyWorkspace()
destroyWorkspace
in interface MemoryWorkspaceManager
public void destroyAllWorkspacesForCurrentThread()
destroyAllWorkspacesForCurrentThread
in interface MemoryWorkspaceManager
protected void ensureThreadExistense()
public MemoryWorkspace getAndActivateWorkspace()
getAndActivateWorkspace
in interface MemoryWorkspaceManager
public MemoryWorkspace getAndActivateWorkspace(@NonNull String id)
getAndActivateWorkspace
in interface MemoryWorkspaceManager
id
- public MemoryWorkspace getAndActivateWorkspace(@NonNull WorkspaceConfiguration configuration, @NonNull String id)
getAndActivateWorkspace
in interface MemoryWorkspaceManager
configuration
- id
- public boolean checkIfWorkspaceExists(@NonNull String id)
checkIfWorkspaceExists
in interface MemoryWorkspaceManager
id
- public MemoryWorkspace scopeOutOfWorkspaces()
PLEASE NOTE: Do not forget to close this block.
scopeOutOfWorkspaces
in interface MemoryWorkspaceManager
public void printAllocationStatisticsForCurrentThread()
printAllocationStatisticsForCurrentThread
in interface MemoryWorkspaceManager
Copyright © 2017. All rights reserved.