public PEPService create(JID owner) {
        // Return an error if the packet is from an anonymous, unregistered user
        // or remote user
        if (!UserManager.getInstance().isRegisteredUser(owner, false)) {
            throw new IllegalArgumentException(
                    "Request must be initiated by a local, registered user, but is not: "
                            + owner);
        }

        PEPService pepService = null;
        final JID bareJID = owner.asBareJID();
        final Lock lock = pepServices.getLock(bareJID);
        lock.lock();
        try {

            if (pepServices.get(bareJID) != null) {
                pepService = pepServices.get(bareJID).get();
            }

            if (pepService == null) {
                pepService = new PEPService(XMPPServer.getInstance(), bareJID);
                pepServices.put(bareJID, CacheableOptional.of(pepService));
                pepService.initialize();

                Log.debug("PEPService created for: '{}'", bareJID);
            }
        } finally {
            lock.unlock();
        }

        return pepService;
    }
Retrieves a PEP service -- attempting first from memory, then from the
database.

This method can automatically create a PEP service if one does not exist.

@param jid
           the JID of the user that owns the PEP service.
@param autoCreate
           true if a PEP service that does not yet exist needs to be created.
@return the requested PEP service if found or null if not found.
xmppserver/src/main/java/org/jivesoftware/openfire/pep/PEPServiceManager.java