Each resource is allowed to define its own executor. When a request arrives, the request will be handled by the resource's executor. If a resource does not define its own executor, the executor of its parent or transitively an ancestor will be used. If no ancestor up to the root defines its own executor, the thread that delivers the request will invoke the handling method.
ResourceBase supports CoAP's observe mechanism. Enable a ResourceBase to be observable by a CoAP client by marking it as observable with {@link #setObservable(boolean)}. Notify all CoAP observers by calling {@link #changed()}. The method changed() reprocesses the requests from the observing clients that have originally established the observe relation. If the resource or one of its ancestors define an executor, the reprocessing is done on the executor. A CoAP observe relation between this resource and a CoAP client is represented by an instance of {@link ObserveRelation}.
In contrast the class {@link ResourceObserver} has nothing to do with CoAP'sobserve mechanism but is an implementation of the general observe-pattern. A ResourceObserver is invoked whenever the name or path of a resource changes, when a child resource is added or removed or when a CoAP observe relation is added or canceled. // TODO: make example with createClient().get()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|