public abstract class BasicWorkspaceManager extends Object implements MemoryWorkspaceManager
| Modifier and Type | Field and Description |
|---|---|
protected ThreadLocal<Map<String,MemoryWorkspace>> |
backingMap |
protected AtomicLong |
counter |
protected SynchronizedObject<DebugMode> |
debugMode |
protected WorkspaceConfiguration |
defaultConfiguration |
static String |
WorkspaceDeallocatorThreadName
Deprecated.
|
| Constructor and Description |
|---|
BasicWorkspaceManager() |
BasicWorkspaceManager(@NonNull WorkspaceConfiguration defaultConfiguration) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
anyWorkspaceActiveForCurrentThread()
Determine if there are any workspaces open for the current thread.
|
boolean |
checkIfWorkspaceExists(@NonNull String id)
This method checks, if Workspace with a given Id was created before this call
|
boolean |
checkIfWorkspaceExistsAndActive(@NonNull String id)
This method checks, if Workspace with a given Id was created before this call, AND is active at the moment of 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() |
List<MemoryWorkspace> |
getAllWorkspacesForCurrentThread()
This method returns all workspaces for current thread
|
List<String> |
getAllWorkspacesIdsForCurrentThread()
This method returns list of workspace IDs for current thread
|
MemoryWorkspace |
getAndActivateWorkspace()
This method gets & activates default workspace
|
MemoryWorkspace |
getAndActivateWorkspace(@NonNull String id)
This method gets & activates workspace with a given Id
|
MemoryWorkspace |
getAndActivateWorkspace(@NonNull WorkspaceConfiguration configuration,
@NonNull String id)
This method gets & activates default with a given configuration and Id
|
DebugMode |
getDebugMode()
This method returns current debug mode active in this JVM
|
String |
getUUID()
Returns globally unique ID
|
MemoryWorkspace |
getWorkspaceForCurrentThread()
This method will return workspace with default configuration and default id.
|
MemoryWorkspace |
getWorkspaceForCurrentThread(@NonNull String id)
This method returns you Workspace for a given Id for current Thread
PLEASE NOTE: If Workspace wasn't defined, new Workspace will be created using current default configuration
|
protected abstract 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 |
setDebugMode(DebugMode mode)
This method allows to enable (and pick one) global debug mode for workspaces
Default value: DISABLED
|
void |
setDefaultWorkspaceConfiguration(@NonNull 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)
This method allows you to set given Workspace as default for current Thread
|
void |
setWorkspaceForCurrentThread(@NonNull MemoryWorkspace workspace,
@NonNull String id)
This method allows you to set given Workspace for spacific Id for current Thread
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcreateNewWorkspace, createNewWorkspace, createNewWorkspace, createNewWorkspace, getWorkspaceForCurrentThreadprotected AtomicLong counter
protected WorkspaceConfiguration defaultConfiguration
protected ThreadLocal<Map<String,MemoryWorkspace>> backingMap
protected SynchronizedObject<DebugMode> debugMode
@Deprecated public static final String WorkspaceDeallocatorThreadName
public BasicWorkspaceManager()
public BasicWorkspaceManager(@NonNull
@NonNull WorkspaceConfiguration defaultConfiguration)
public String getUUID()
getUUID in interface MemoryWorkspaceManagerpublic void setDefaultWorkspaceConfiguration(@NonNull
@NonNull WorkspaceConfiguration configuration)
setDefaultWorkspaceConfiguration in interface MemoryWorkspaceManagerconfiguration - public MemoryWorkspace getWorkspaceForCurrentThread()
getWorkspaceForCurrentThread in interface MemoryWorkspaceManagerpublic MemoryWorkspace getWorkspaceForCurrentThread(@NonNull @NonNull String id)
MemoryWorkspaceManagergetWorkspaceForCurrentThread in interface MemoryWorkspaceManagerpublic DebugMode getDebugMode()
MemoryWorkspaceManagergetDebugMode in interface MemoryWorkspaceManagerpublic void setDebugMode(DebugMode mode)
MemoryWorkspaceManagersetDebugMode in interface MemoryWorkspaceManagerprotected abstract void pickReference(MemoryWorkspace workspace)
public void setWorkspaceForCurrentThread(MemoryWorkspace workspace)
MemoryWorkspaceManagersetWorkspaceForCurrentThread in interface MemoryWorkspaceManagerpublic void setWorkspaceForCurrentThread(@NonNull
@NonNull MemoryWorkspace workspace,
@NonNull
@NonNull String id)
MemoryWorkspaceManagersetWorkspaceForCurrentThread in interface MemoryWorkspaceManagerpublic void destroyWorkspace(MemoryWorkspace workspace)
destroyWorkspace in interface MemoryWorkspaceManagerworkspace - public void destroyWorkspace()
destroyWorkspace in interface MemoryWorkspaceManagerpublic void destroyAllWorkspacesForCurrentThread()
destroyAllWorkspacesForCurrentThread in interface MemoryWorkspaceManagerprotected void ensureThreadExistense()
public MemoryWorkspace getAndActivateWorkspace()
getAndActivateWorkspace in interface MemoryWorkspaceManagerpublic MemoryWorkspace getAndActivateWorkspace(@NonNull @NonNull String id)
getAndActivateWorkspace in interface MemoryWorkspaceManagerid - public MemoryWorkspace getAndActivateWorkspace(@NonNull @NonNull WorkspaceConfiguration configuration, @NonNull @NonNull String id)
getAndActivateWorkspace in interface MemoryWorkspaceManagerconfiguration - id - public boolean checkIfWorkspaceExists(@NonNull
@NonNull String id)
checkIfWorkspaceExists in interface MemoryWorkspaceManagerid - public boolean checkIfWorkspaceExistsAndActive(@NonNull
@NonNull String id)
MemoryWorkspaceManagercheckIfWorkspaceExistsAndActive in interface MemoryWorkspaceManagerpublic MemoryWorkspace scopeOutOfWorkspaces()
PLEASE NOTE: Do not forget to close this block.
scopeOutOfWorkspaces in interface MemoryWorkspaceManagerpublic void printAllocationStatisticsForCurrentThread()
printAllocationStatisticsForCurrentThread in interface MemoryWorkspaceManagerpublic List<String> getAllWorkspacesIdsForCurrentThread()
MemoryWorkspaceManagergetAllWorkspacesIdsForCurrentThread in interface MemoryWorkspaceManagerpublic List<MemoryWorkspace> getAllWorkspacesForCurrentThread()
MemoryWorkspaceManagergetAllWorkspacesForCurrentThread in interface MemoryWorkspaceManagerpublic boolean anyWorkspaceActiveForCurrentThread()
MemoryWorkspaceManageranyWorkspaceActiveForCurrentThread in interface MemoryWorkspaceManagerCopyright © 2021. All rights reserved.