Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memcached client throwing NullPointerException #86

Open
tomersagi opened this issue Aug 9, 2016 · 0 comments
Open

Memcached client throwing NullPointerException #86

tomersagi opened this issue Aug 9, 2016 · 0 comments

Comments

@tomersagi
Copy link

After several successful retrievals I get the following:

java.lang.NullPointerException
    at com.schooner.MemCached.SchoonerSockIOPool.getConnection(Unknown Source)
    at com.schooner.MemCached.SchoonerSockIOPool.getSock(Unknown Source)
    at com.schooner.MemCached.AscIIClient.get(Unknown Source)
    at com.schooner.MemCached.AscIIClient.get(Unknown Source)
    at com.schooner.MemCached.AscIIClient.get(Unknown Source)
    at com.whalin.MemCached.MemCachedClient.get(Unknown Source)
    at com.hpe.labs.patchplanner.dm.indexer.IndexBasedRetriever$KVSRetriever.call(IndexBasedRetriever.java:199)

My code:

public Solution call(Long id) throws Exception {
                SockIOPool pool = IndexBasedSaver.initKVS(repoPath);
                MemCachedClient mmc = new MemCachedClient(IndexBasedSaver.POOL_NAME);
            try {
                Object res = mmc.get(id.toString());
                if (res == null) {
                    throw new Exception("Repository" + Arrays.toString(pool.getServers()) + " doesn't contain the solution key " + id);
                }
                return (Solution) res;
            }
                catch (Exception e) {
                    e.printStackTrace();
                    throw e;
                }
        }

The exception is thrown by the mmc.get(id.toString()); for id=25511.
Using telnet I'm able to retrieve a not null object for the same id.

init method code:

public static SockIOPool initKVS(String serverPath) {
        //initialize the SockIOPool that maintains the Memcached Server Connection Pool
        String[] servers = {serverPath};
        SockIOPool pool = SockIOPool.getInstance(POOL_NAME);
        pool.setServers(servers);
        pool.setFailover(true);
        pool.setInitConn(10);
        pool.setMinConn(5);
        pool.setMaxConn(250);
        pool.setMaintSleep(30);
        pool.setNagle(false);
        pool.setSocketTO(3000);
        pool.setAliveCheck(true);
        pool.initialize();
        return pool;
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant