public final class Worker
extends java.lang.Object
initialize
methods, and can then use the singleton Worker instance to access Stores and
Objects.Modifier and Type | Class and Description |
---|---|
static interface |
Worker.Code<T> |
Modifier and Type | Field and Description |
---|---|
SubServerSocketFactory |
authFromAll
The subserversocket factory
|
SubSocketFactory<RemoteStore> |
authToStore
A subsocket factory for authenticated connections to stores.
|
SubSocketFactory<RemoteWorker> |
authToWorker
A subsocket factory for authenticated connections to workers
|
java.lang.String |
bootcp
The path for Fabric runtime classes
|
java.lang.String |
codeCache
The directory for dynamically compiled mobile code
|
ConfigProperties |
config |
protected FetchManager |
fetchManager
The manager to use for fetching objects from stores.
|
java.lang.String |
filsigcp
The path for FabIL signatures
|
InProcessRemoteWorker |
inProcessRemoteWorker |
protected static Worker |
instance
The singleton Worker instance.
|
LabelCache |
labelCache
The global label cache.
|
FabricClassLoader |
loader
The loader used by this worker for loading classes from fabric
|
protected LocalStore |
localStore |
boolean |
outputToLocalFS
Flag for indicating if worker needs to cache compiled code in local file system
|
protected NodePrincipal |
principal |
static java.util.Random |
RAND |
java.lang.String |
sigcp
The path for Fabric signatures
|
protected java.util.concurrent.ConcurrentMap<java.lang.String,RemoteStore> |
stores
A map from store hostnames to Store objects
|
SubSocketFactory<RemoteStore> |
unauthToStore
A subsocket factory for unauthenticated connections to stores.
|
Modifier and Type | Method and Description |
---|---|
void |
clearCache()
Clears out the worker cache (but leaves dissemination cache intact).
|
FetchManager |
fetchManager()
Returns the fetch manager.
|
java.util.List<java.lang.Long> |
findOnumsInCache(RemoteStore store,
java.util.List<java.lang.Long> onums)
Detemines which of a given set of onums are resident in cache.
|
FabricClassLoader |
getClassLoader() |
LocalStore |
getLocalStore() |
RemoteWorker |
getLocalWorker() |
java.lang.String |
getName()
convenience method for getting the node's name
|
NodePrincipal |
getPrincipal() |
RemoteStore |
getStore(java.lang.String name)
Returns a
Store object representing the given store. |
static Worker |
getWorker()
Returns the Singleton Worker instance.
|
RemoteWorker |
getWorker(java.lang.String name) |
static void |
initialize(ConfigProperties props) |
static void |
initialize(java.lang.String name) |
static void |
initializeForStore(java.lang.String name,
java.util.Map<java.lang.String,RemoteStore> initStoreSet) |
static boolean |
isInitialized() |
static void |
main(java.lang.String[] args) |
void |
runFabricApp(java.lang.String mainClassName,
java.lang.String[] args)
Runs the given Fabric program.
|
static <T> T |
runInSubTransaction(Worker.Code<T> code)
Executes the given code from within a Fabric subtransaction of the current
transaction.
|
static <T> T |
runInTopLevelTransaction(Worker.Code<T> code,
boolean autoRetry)
Executes the given code from within a new top-level Fabric transaction.
|
static <T> T |
runInTransaction(TransactionID tid,
Worker.Code<T> code)
Executes the given code from within a Fabric transaction.
|
void |
runJavaApp(java.lang.String mainClassName,
java.lang.String[] args)
Runs the given Java program.
|
void |
shutdown()
Shuts down and cleans up the worker.
|
boolean |
updateCache(RemoteStore store,
ObjectGroup group)
Updates the worker cache with the given object group, as follows:
If the cache contains a deserialized copy of an old version of any
object in the group, then that old version is replaced with a serialized
copy of the new version.
|
boolean |
updateCaches(RemoteStore store,
long onum,
AbstractGlob<?> update)
Updates the dissemination and worker caches with the given glob.
|
public final ConfigProperties config
public java.lang.String bootcp
public java.lang.String sigcp
public java.lang.String filsigcp
public java.lang.String codeCache
public boolean outputToLocalFS
public FabricClassLoader loader
protected final java.util.concurrent.ConcurrentMap<java.lang.String,RemoteStore> stores
protected final LocalStore localStore
public final SubSocketFactory<RemoteStore> unauthToStore
public final SubSocketFactory<RemoteStore> authToStore
public final SubSocketFactory<RemoteWorker> authToWorker
public final SubServerSocketFactory authFromAll
protected final FetchManager fetchManager
public final LabelCache labelCache
protected final NodePrincipal principal
public final InProcessRemoteWorker inProcessRemoteWorker
public static final java.util.Random RAND
protected static Worker instance
public static boolean isInitialized()
public java.lang.String getName()
public static Worker getWorker() throws java.lang.IllegalStateException
java.lang.IllegalStateException
- if the Fabric worker is uninitializedpublic RemoteStore getStore(java.lang.String name)
Store
object representing the given store.name
- The store's host name.Store
object.public RemoteWorker getWorker(java.lang.String name)
RemoteWorker
objectpublic LocalStore getLocalStore()
public RemoteWorker getLocalWorker()
public FetchManager fetchManager()
public boolean updateCaches(RemoteStore store, long onum, AbstractGlob<?> update)
public boolean updateCache(RemoteStore store, ObjectGroup group)
public java.util.List<java.lang.Long> findOnumsInCache(RemoteStore store, java.util.List<java.lang.Long> onums)
public NodePrincipal getPrincipal()
public void clearCache()
public void shutdown()
public static void initialize(java.lang.String name) throws java.lang.IllegalStateException, java.io.IOException, InternalError, UsageError, java.security.GeneralSecurityException
java.lang.IllegalStateException
java.io.IOException
InternalError
UsageError
java.security.GeneralSecurityException
public static void initialize(ConfigProperties props) throws java.lang.IllegalStateException, InternalError, UsageError, java.io.IOException, java.security.GeneralSecurityException
java.lang.IllegalStateException
InternalError
UsageError
java.io.IOException
java.security.GeneralSecurityException
public static void initializeForStore(java.lang.String name, java.util.Map<java.lang.String,RemoteStore> initStoreSet) throws java.io.IOException, java.lang.IllegalStateException, InternalError, UsageError, java.security.GeneralSecurityException
java.io.IOException
java.lang.IllegalStateException
InternalError
UsageError
java.security.GeneralSecurityException
public FabricClassLoader getClassLoader()
public static void main(java.lang.String[] args) throws java.lang.Throwable
java.lang.Throwable
public void runFabricApp(java.lang.String mainClassName, java.lang.String[] args) throws java.lang.Throwable
mainClassName
- the unmangled name of the application's main class.args
- arguments to be passed to the application.java.lang.Throwable
public void runJavaApp(java.lang.String mainClassName, java.lang.String[] args) throws java.lang.Throwable
mainClassName
- the application's main class.args
- arguments to be passed to the application.java.lang.Throwable
public static <T> T runInTopLevelTransaction(Worker.Code<T> code, boolean autoRetry)
autoRetry
- whether the transaction should be automatically retried if it
fails during commitpublic static <T> T runInTransaction(TransactionID tid, Worker.Code<T> code)
tid
- The parent transaction for the subtransaction that will be
created.public static <T> T runInSubTransaction(Worker.Code<T> code)