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 AtomicLong |
counter |
protected org.nd4j.linalg.primitives.SynchronizedObject<DebugMode> |
debugMode |
protected WorkspaceConfiguration |
defaultConfiguration |
static String |
WorkspaceDeallocatorThreadName
Deprecated.
|
| Constructor and Description |
|---|
BasicWorkspaceManager() |
BasicWorkspaceManager(WorkspaceConfiguration defaultConfiguration) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
anyWorkspaceActiveForCurrentThread() |
boolean |
checkIfWorkspaceExists(String id)
This method checks, if Workspace with a given Id was created before this call
|
boolean |
checkIfWorkspaceExistsAndActive(String id) |
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() |
List<String> |
getAllWorkspacesIdsForCurrentThread() |
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
|
DebugMode |
getDebugMode() |
String |
getUUID()
Returns globally unique 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 |
setDebugMode(DebugMode mode) |
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, waitcreateNewWorkspace, createNewWorkspace, createNewWorkspace, createNewWorkspace, getWorkspaceForCurrentThreadprotected AtomicLong counter
protected WorkspaceConfiguration defaultConfiguration
protected ThreadLocal<Map<String,MemoryWorkspace>> backingMap
protected org.nd4j.linalg.primitives.SynchronizedObject<DebugMode> debugMode
@Deprecated public static final String WorkspaceDeallocatorThreadName
public BasicWorkspaceManager()
public BasicWorkspaceManager(@NonNull
WorkspaceConfiguration defaultConfiguration)
public String getUUID()
getUUID in interface MemoryWorkspaceManagerpublic void setDefaultWorkspaceConfiguration(@NonNull
WorkspaceConfiguration configuration)
setDefaultWorkspaceConfiguration in interface MemoryWorkspaceManagerconfiguration - public MemoryWorkspace getWorkspaceForCurrentThread()
getWorkspaceForCurrentThread in interface MemoryWorkspaceManagerpublic MemoryWorkspace getWorkspaceForCurrentThread(@NonNull String id)
getWorkspaceForCurrentThread in interface MemoryWorkspaceManagerpublic DebugMode getDebugMode()
getDebugMode in interface MemoryWorkspaceManagerpublic void setDebugMode(DebugMode mode)
setDebugMode in interface MemoryWorkspaceManagerprotected void pickReference(MemoryWorkspace workspace)
public void setWorkspaceForCurrentThread(MemoryWorkspace workspace)
setWorkspaceForCurrentThread in interface MemoryWorkspaceManagerpublic void setWorkspaceForCurrentThread(@NonNull
MemoryWorkspace workspace,
@NonNull
String id)
setWorkspaceForCurrentThread 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 String id)
getAndActivateWorkspace in interface MemoryWorkspaceManagerid - public MemoryWorkspace getAndActivateWorkspace(@NonNull WorkspaceConfiguration configuration, @NonNull String id)
getAndActivateWorkspace in interface MemoryWorkspaceManagerconfiguration - id - public boolean checkIfWorkspaceExists(@NonNull
String id)
checkIfWorkspaceExists in interface MemoryWorkspaceManagerid - public boolean checkIfWorkspaceExistsAndActive(@NonNull
String id)
checkIfWorkspaceExistsAndActive 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()
getAllWorkspacesIdsForCurrentThread in interface MemoryWorkspaceManagerpublic List<MemoryWorkspace> getAllWorkspacesForCurrentThread()
getAllWorkspacesForCurrentThread in interface MemoryWorkspaceManagerpublic boolean anyWorkspaceActiveForCurrentThread()
anyWorkspaceActiveForCurrentThread in interface MemoryWorkspaceManagerCopyright © 2018. All rights reserved.