public class RocContext
extends java.lang.Object
Context contains memory pools and network worker threads, shared among objects attached to the context. It is allowed both to create a separate context for every object, or to create a single context shared between multiple objects.
RocContext() or
RocContext(RocContextConfig) and destroyed using
close(). RocContext class implements
AutoCloseable so if it is used in a try-with-resources
statement the object is closed automatically at the end of the statement.
Objects can be attached and detached to an opened context at any moment from
any thread. However, the user should ensure that the context is not closed
until there are no objects attached to the context.RocSender,
RocReceiver| Constructor and Description |
|---|
RocContext()
Open a new context.
|
RocContext(RocContextConfig config)
Open a new context.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the native object and unregister it from the
NativeObjectCleaner. |
public RocContext()
throws java.lang.IllegalArgumentException,
java.lang.Exception
Allocates and initializes a new context. May start some background threads.
java.lang.IllegalArgumentException - if the arguments are invalid.java.lang.Exception - if there are not enough resources.public RocContext(RocContextConfig config) throws java.lang.IllegalArgumentException, java.lang.Exception
Allocates and initializes a new context. May start some background threads.
config - should point to an initialized config.java.lang.IllegalArgumentException - if the arguments are invalid.java.lang.Exception - if there are not enough resources.