Skip to content

Commit

Permalink
ISPN-12490 CounterManager in HR docs
Browse files Browse the repository at this point in the history
  • Loading branch information
oraNod authored and pruivo committed Nov 19, 2020
1 parent 1d0e63a commit e9baa92
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ include::{topics}/ref_hotrod_remote_iterator.adoc[leveloffset=+1]
include::{topics}/proc_using_custom_filters.adoc[leveloffset=+2]
include::{topics}/ref_hotrod_versioned_api.adoc[leveloffset=+1]
include::{topics}/ref_hotrod_streaming_api.adoc[leveloffset=+1]
include::{topics}/ref_hotrod_countermanager.adoc[leveloffset=+1]
include::{topics}/ref_hotrod_listeners.adoc[leveloffset=+1]
include::{topics}/ref_hotrod_client_transactions.adoc[leveloffset=+1]


// Restore the parent context.
ifdef::parent-context[:context: {parent-context}]
ifndef::parent-context[:!context:]
16 changes: 9 additions & 7 deletions documentation/src/main/asciidoc/topics/counters.adoc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[[clustered_counters]]
[id='clustered_counters']
= Clustered Counters

_Clustered counters_ are counters which are distributed and shared among all nodes in the {brandname} cluster.
Expand Down Expand Up @@ -100,10 +100,13 @@ Its value *must be positive* and the default value is `16`.
To list all the counters defined, the method `CounterManager.getCounterNames()` returns a collection of all counter
names created cluster-wide.

== The `CounterManager` interface.
== `CounterManager` interface

The `CounterManager` interface is the entry point to define, retrieve and remove a counter.
It automatically listen to the creation of `EmbeddedCacheManager` and proceeds with the registration of an
The `CounterManager` interface is the entry point to define, retrieve and remove counters.

.Embedded deployments

`CounterManager` automatically listen to the creation of `EmbeddedCacheManager` and proceeds with the registration of an
instance of it per `EmbeddedCacheManager`.
It starts the caches needed to store the counter state and configures the default counters.

Expand All @@ -116,7 +119,8 @@ as shown in the example below:
include::code_examples/CounterManagerEmbedded.java[]
----

For Hot Rod client, the `CounterManager` is registered in the RemoteCacheManager and it can be retrieved like:
.Server deployments
For Hot Rod clients, the `CounterManager` is registered in the RemoteCacheManager and can be retrieved as follows:

[source,java]
----
Expand All @@ -125,8 +129,6 @@ include::code_examples/CounterManagerRemote.java[]

=== Remove a counter via CounterManager

WARNING: use with caution.

There is a difference between remove a counter via the `Strong/WeakCounter` interfaces and the `CounterManager`.
The `CounterManager.remove(String)` removes the counter value from the cluster and removes all the listeners registered
in the counter in the local counter instance.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[id='remotecache_countermanager-{context}']
= Counter API
The `CounterManager` interface is the entry point to define, retrieve and remove counters.

Hot Rod clients can retrieve the `CounterManager` interface as in the following example:

[source,java]
----
include::code_examples/CounterManagerRemote.java[]
----

.Reference

* link:{dev_docs}#clustered_counters[Clustered Counters]

0 comments on commit e9baa92

Please sign in to comment.