@Override
    public void execute(@Nonnull final SessionData data, Element command) {
        final Locale preferredLocale = SessionManager.getInstance().getLocaleForSession(data.getOwner());

        DataForm form = new DataForm(DataForm.Type.result);

        FormField field = form.addField();
        field.setType(FormField.Type.hidden);
        field.setVariable("FORM_TYPE");
        field.addValue("http://jabber.org/protocol/admin");

        field = form.addField();
        field.setType(FormField.Type.text_single);
        field.setLabel(LocaleUtils.getLocalizedString("commands.admin.getnumberusersessions.form.field.onlineuserssessionsnum.label", preferredLocale));
        field.setVariable("onlineuserssessionsnum");
        SessionManager sessionManager = SessionManager.getInstance();
        field.addValue(sessionManager.getUserSessionsCount(false));

        command.add(form.getElement());
    }
Command that allows to retrieve the number of user sessions at any one moment. That means
that the result will include all connected resources of all users.

@author Gaston Dombiak
xmppserver/src/main/java/org/jivesoftware/openfire/commands/admin/GetNumberUserSessions.java