@Override public synchronized long getLong(String key, long defaultValue) { return this.preferences.getLong(key, defaultValue); }
/** * Determines if the last check was far enough in the past to justify a new check. * * @return if the enough time has passed since the last check. */ public boolean shouldCheckForUpdate() { long lastTime = getPreferences().getLong(LAST_UPDATE_CHECK, 0); long deltaTime = System.currentTimeMillis() - lastTime; return deltaTime > UPDATE_INTERVAL; }
public long getTotalUsage() { Preferences node = Preferences.userRoot().node(USAGE_PATH); return node.getLong(TASKS_EXECUTED_KEY, 0); }
private long getExpirationTimeFromPreferences(String key) { return prefs.getLong(getExpirationKey(key), 0); }
private void incrementTotalUsage() { Preferences node = Preferences.userRoot().node(USAGE_PATH); node.putLong(TASKS_EXECUTED_KEY, node.getLong(TASKS_EXECUTED_KEY, 0) + 1); }
@Override public synchronized long getLong(String key, long defaultValue) { return this.preferences.getLong(key, defaultValue); }
public long getLong(String key, long def) { return preferences.getLong(key, def); }
/** * Returns the connector's lease period, in milliseconds. When this period is greater than 0, it enables the * capability for the connector to detect when a client is no longer available. This is done by estabilishing a * lease with the remoting clients. * * @return the connector's lease period (<code>Long.MIN_VALUE</code> if not set in the preferences) */ public long getConnectorLeasePeriod() { long value = m_preferences.getLong(ServiceContainerConfigurationConstants.CONNECTOR_LEASE_PERIOD, Long.MIN_VALUE); return value; }
/** * Returns the multicast detector's heartbeat time delay. This is the amount of time to wait between sending (and * sometimes receiving) detection messages. This should be less than {@link #getMulticastDetectorDefaultTimeDelay()} * . * * @return the multicast detector heartbeat time delay (<code>Long.MIN_VALUE</code> if not set in the preferences) */ public long getMulticastDetectorHeartbeatTimeDelay() { long value = m_preferences.getLong( ServiceContainerConfigurationConstants.MULTICASTDETECTOR_HEARTBEAT_TIMEDELAY, Long.MIN_VALUE); return value; }
/** * Returns the connector's lease period, in milliseconds. When this period is greater than 0, it enables the * capability for the connector to detect when a client is no longer available. This is done by estabilishing a * lease with the remoting clients. * * @return the connector's lease period (<code>Long.MIN_VALUE</code> if not set in the preferences) */ public long getConnectorLeasePeriod() { long value = m_preferences.getLong(ServiceContainerConfigurationConstants.CONNECTOR_LEASE_PERIOD, Long.MIN_VALUE); return value; }
@Override // from Config public long getValue (String name, long defval) { return _prefs.getLong(name, super.getValue(name, defval)); }
/** * @return session id if already exists, or 0 if it doesn't */ private long loadSessionId() { Preferences prefs = Preferences.userNodeForPackage(WebCloudNameLookup.class); return prefs.getLong(KEY_APPENGINECLOUD_SESSION_ID, 0); }
/** @see java.util.prefs.Preferences#getLong(String, long) */ public long getLong(final String key, final long def) { return p.getLong(safeKey(key), def); }
/** * Returns when the services where last updated * @return long the time since last update in milliseconds from epoch */ long getStoredLastUpdated(){ return NbPreferences.forModule(this.getClass()).getLong(LAST_UPDATED_PROPERTY_NAME, DEFAULT_LAST_UPDATED_VALUE); }
/** * Gets this instance's preference value. * * @param prefs the {@linkplain Preferences} object to get the value from. * @param def the default preference value to return in case the preference is not defined. * @return the retrieved preference value. */ public long getLong(Preferences prefs, long def) { return prefs.getLong(key(), def); }
private long getRepositoryCreationTime (String repositoryUrl) { long time = getPreferences().getLong(PROP_REPOSITORY_CREATION_TIME + repositoryUrl, -1); if (time == -1) { time = System.currentTimeMillis(); setRepositoryCreationTime(repositoryUrl, time); } return time; }
/** * Gets this instance's preference value. * * @param prefs the {@linkplain Preferences} object to get the value from. * @return the retrieved preference value. */ public long getLong(Preferences prefs) { return prefs.getLong(key(), defaultValue().longValue()); }
public static Date getLastIndexUpdate(String repoId) { if(repoId.contains("//")) { repoId = repoId.replace("//", "_"); LOG.log(Level.FINE, "Getting last index update: Repo''s id contains consecutive slashes, replacing them with '_': {0}", repoId); } long old = getPreferences().getLong(PROP_LAST_INDEX_UPDATE + "." + repoId, 0); // compatibility if (old != 0) { // upgrade it getPreferences().remove(PROP_LAST_INDEX_UPDATE + "." + repoId); storage().node(repoId).putLong(PROP_LAST_INDEX_UPDATE, old); } return new Date(storage().node(repoId).getLong(PROP_LAST_INDEX_UPDATE, 0)); }
public static void main(String args[]) throws BackingStoreException { Preferences prefs = Preferences.userNodeForPackage(WebCloudNameLookup.class); System.out.println(prefs.getLong(WebCloudNameLookup.KEY_APPENGINECLOUD_SESSION_ID, 0)); WebCloudNameLookup.clearSavedSessionInformation(); prefs.flush(); prefs.clear(); prefs.flush(); }
@Override public void run() { try { final Preferences prefs = PreferencesManager.getInstance().getPreferences(); prefs.putLong(PROPERTY_TOTAL_UPSTART, prefs.getLong(PROPERTY_TOTAL_UPSTART, 0L) + (System.currentTimeMillis() - UPSTART)); PreferencesManager.getInstance().flush(); } finally { PlatformProvider.getPlatform().dispose(); } } });