@Override protected boolean removeSession(final String idInCluster) { return deleteKey(idInCluster); }
/** * is the session id known to memcached, and is it valid */ public boolean idInUse(final String idInCluster) { return getKey(idInCluster) != null; // note "null" may also mean be caused by connection problem. Anyway: Treating this as "not in use" // do not check the validity of the session since // we do not save invalidated sessions anymore. }
protected boolean setKey(final String idInCluster, final ISerializableSession data) throws TranscoderException { byte[] raw = getSessionFactory().pack(data); if (raw == null) { return false; } else { return ((KeyValueStoreSessionIdManager) _sessionIdManager).setKey(mangleKey(idInCluster), raw, getMaxInactiveInterval()); } }
protected boolean addKey(final String idInCluster, final ISerializableSession data) throws TranscoderException { byte[] raw = getSessionFactory().pack(data); if (raw == null) { return false; } else { return ((KeyValueStoreSessionIdManager) _sessionIdManager).addKey(mangleKey(idInCluster), raw, getMaxInactiveInterval()); } }
protected ISerializableSession getKey(final String idInCluster) throws TranscoderException { byte[] raw = ((KeyValueStoreSessionIdManager) _sessionIdManager).getKey(mangleKey(idInCluster)); if (raw == null) { return null; } else { return getSessionFactory().unpack(raw); } }
protected boolean addKey(final String idInCluster, final byte[] raw) { return addKey(idInCluster, raw, getDefaultExpiry()); }
protected boolean setKey(final String idInCluster, final byte[] raw) { return setKey(idInCluster, raw, getDefaultExpiry()); }
public AbstractKeyValueStoreClient(String serverString) { setServerString(serverString); }
/** * Overridden to change the attribute (which sets the "dirty" state) only if the new attribute value * is not equal to the old attribute value. */ @Override public Object doPutOrRemove(String name, Object value) { Object oldValue = doGet(name); return (valueEquals(oldValue, value)) ? value : super.doPutOrRemove(name, value); }
protected boolean deleteKey(final String idInCluster) { log.debug("delete: id=" + idInCluster); boolean result = false; try { result = _client.delete(mangleKey(idInCluster)); } catch (KeyValueStoreClientException error) { log.warn("unable to delete key: id=" + idInCluster, error); } return result; }
protected boolean setKey(final String idInCluster, final byte[] raw, int expiry) { if (expiry < 0) { expiry = 0; // 0 means forever } log.debug("set: id=" + idInCluster + ", expiry=" + expiry); boolean result = false; try { result = _client.set(mangleKey(idInCluster), raw, expiry); } catch (KeyValueStoreClientException error) { log.warn("unable to set key: id=" + idInCluster, error); } return result; }
@Override public AbstractSession getSession(final String idInCluster) { AbstractSession session; return loadSession(idInCluster); }
public boolean shutdown() throws KeyValueStoreClientException { if (_client != null) { try { _client.shutdown(); } catch (IOException error) { throw(new KeyValueStoreClientException(error)); } finally { _client = null; } } return true; }
@Override public void doStop() throws Exception { log.info("stopping..."); super.doStop(); log.info("stopped."); } }
@Override protected void doStop() throws Exception { log.info("stopping..."); super.doStop(); log.info("stopped."); }
@Override public void doStart() throws Exception { log.info("starting..."); super.doStart(); log.info("started."); }
@Override protected void doStart() throws Exception { log.info("starting..."); super.doStart(); log.info("started."); }
@Override protected boolean remove(final NoSqlSession session) { if (session == null) { return false; } else { return deleteKey(session.getId()); } }