Tabnine Logo
SimpUserRegistry.getUserCount
Code IndexAdd Tabnine to your IDE (free)

How to use
getUserCount
method
in
org.springframework.messaging.simp.user.SimpUserRegistry

Best Java code snippets using org.springframework.messaging.simp.user.SimpUserRegistry.getUserCount (Showing top 7 results out of 315)

origin: spring-projects/spring-framework

@Override
public int getUserCount() {
  int userCount = 0;
  for (UserRegistrySnapshot registry : this.remoteRegistries.values()) {
    userCount += registry.getUserMap().size();
  }
  userCount += this.localRegistry.getUserCount();
  return userCount;
}
origin: spring-projects/spring-framework

@Test
public void getUserFromLocalRegistry() throws Exception {
  SimpUser user = Mockito.mock(SimpUser.class);
  Set<SimpUser> users = Collections.singleton(user);
  when(this.localRegistry.getUsers()).thenReturn(users);
  when(this.localRegistry.getUserCount()).thenReturn(1);
  when(this.localRegistry.getUser("joe")).thenReturn(user);
  assertEquals(1, this.registry.getUserCount());
  assertSame(user, this.registry.getUser("joe"));
}
origin: spring-projects/spring-framework

@Test
public void handleMessageFromOwnBroadcast() throws Exception {
  TestSimpUser simpUser = new TestSimpUser("joe");
  simpUser.addSessions(new TestSimpSession("123"));
  when(this.localRegistry.getUserCount()).thenReturn(1);
  when(this.localRegistry.getUsers()).thenReturn(Collections.singleton(simpUser));
  assertEquals(1, this.multiServerRegistry.getUserCount());
  Message<?> message = this.converter.toMessage(this.multiServerRegistry.getLocalRegistryDto(), null);
  this.multiServerRegistry.addRemoteRegistryDto(message, this.converter, 20000);
  assertEquals(1, this.multiServerRegistry.getUserCount());
}
origin: spring-projects/spring-framework

@Test
public void handleMessage() throws Exception {
  TestSimpUser simpUser1 = new TestSimpUser("joe");
  TestSimpUser simpUser2 = new TestSimpUser("jane");
  simpUser1.addSessions(new TestSimpSession("123"));
  simpUser2.addSessions(new TestSimpSession("456"));
  HashSet<SimpUser> simpUsers = new HashSet<>(Arrays.asList(simpUser1, simpUser2));
  SimpUserRegistry remoteUserRegistry = mock(SimpUserRegistry.class);
  when(remoteUserRegistry.getUserCount()).thenReturn(2);
  when(remoteUserRegistry.getUsers()).thenReturn(simpUsers);
  MultiServerUserRegistry remoteRegistry = new MultiServerUserRegistry(remoteUserRegistry);
  Message<?> message = this.converter.toMessage(remoteRegistry.getLocalRegistryDto(), null);
  this.handler.handleMessage(message);
  assertEquals(2, remoteRegistry.getUserCount());
  assertNotNull(this.multiServerRegistry.getUser("joe"));
  assertNotNull(this.multiServerRegistry.getUser("jane"));
}
origin: org.springframework/spring-messaging

@Override
public int getUserCount() {
  int userCount = 0;
  for (UserRegistrySnapshot registry : this.remoteRegistries.values()) {
    userCount += registry.getUserMap().size();
  }
  userCount += this.localRegistry.getUserCount();
  return userCount;
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-messaging

@Override
public int getUserCount() {
  int userCount = 0;
  for (UserRegistrySnapshot registry : this.remoteRegistries.values()) {
    userCount += registry.getUserMap().size();
  }
  userCount += this.localRegistry.getUserCount();
  return userCount;
}
origin: apache/servicemix-bundles

@Override
public int getUserCount() {
  int userCount = 0;
  for (UserRegistrySnapshot registry : this.remoteRegistries.values()) {
    userCount += registry.getUserMap().size();
  }
  userCount += this.localRegistry.getUserCount();
  return userCount;
}
org.springframework.messaging.simp.userSimpUserRegistrygetUserCount

Javadoc

Return the count of all connected users.

Popular methods of SimpUserRegistry

  • getUser
    Get the user for the given name.
  • getUsers
    Return a snapshot of all connected users.The returned set is a copy and will not reflect further cha
  • findSubscriptions
    Find subscriptions with the given matcher.

Popular in Java

  • Start an intent from android
  • getContentResolver (Context)
  • notifyDataSetChanged (ArrayAdapter)
  • setContentView (Activity)
  • OutputStream (java.io)
    A writable sink for bytes.Most clients will use output streams that write data to the file system (
  • Charset (java.nio.charset)
    A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • Executors (java.util.concurrent)
    Factory and utility methods for Executor, ExecutorService, ScheduledExecutorService, ThreadFactory,
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • BoxLayout (javax.swing)
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now