Comments (16)
Considering this implemented already, closing.
from jetty.project.
Over a thousand usages of System.currentTimeMillis()
around, so not done yet.
from jetty.project.
This issue has been automatically marked as stale because it has been a full year without activit. It will be closed if no further activity occurs. Thank you for your contributions.
from jetty.project.
Current list in jetty-9.4.x
(not including tests)
jetty-continuation/src/main/java/org/eclipse/jetty/continuation/FauxContinuation.java:404: long expireAt = System.currentTimeMillis() + _timeoutMs;
jetty-continuation/src/main/java/org/eclipse/jetty/continuation/FauxContinuation.java:416: wait = expireAt - System.currentTimeMillis();
jetty-deploy/src/main/java/org/eclipse/jetty/deploy/DeploymentManager.java:124: this.stateTimestamps.put(node, Long.valueOf(System.currentTimeMillis()));
jetty-gcloud/jetty-gcloud-session-manager/src/main/java/org/eclipse/jetty/gcloud/session/GCloudSessionDataStore.java:532: long now = System.currentTimeMillis();
jetty-gcloud/jetty-gcloud-session-manager/src/main/java/org/eclipse/jetty/gcloud/session/GCloudSessionDataStore.java:626: .setFilter(CompositeFilter.and(PropertyFilter.gt(_model.getExpiry(), 0), PropertyFilter.le(_model.getExpiry(), System.currentTimeMillis())))
jetty-gcloud/jetty-gcloud-session-manager/src/main/java/org/eclipse/jetty/gcloud/session/GCloudSessionDataStore.java:633: long start = System.currentTimeMillis();
jetty-gcloud/jetty-gcloud-session-manager/src/main/java/org/eclipse/jetty/gcloud/session/GCloudSessionDataStore.java:635: LOG.debug("Expiry query no index in {}ms", System.currentTimeMillis() - start);
jetty-gcloud/jetty-gcloud-session-manager/src/main/java/org/eclipse/jetty/gcloud/session/GCloudSessionDataStore.java:657: long now = System.currentTimeMillis();
jetty-gcloud/jetty-gcloud-session-manager/src/main/java/org/eclipse/jetty/gcloud/session/GCloudSessionDataStore.java:670: long start = System.currentTimeMillis();
jetty-gcloud/jetty-gcloud-session-manager/src/main/java/org/eclipse/jetty/gcloud/session/GCloudSessionDataStore.java:672: LOG.debug("Expiry query by index in {}ms", System.currentTimeMillis() - start);
jetty-gcloud/jetty-gcloud-session-manager/src/main/java/org/eclipse/jetty/gcloud/session/GCloudSessionDataStore.java:703: long start = System.currentTimeMillis();
jetty-gcloud/jetty-gcloud-session-manager/src/main/java/org/eclipse/jetty/gcloud/session/GCloudSessionDataStore.java:705: LOG.debug("Exists query by index in {}ms", System.currentTimeMillis() - start);
jetty-gcloud/jetty-gcloud-session-manager/src/main/java/org/eclipse/jetty/gcloud/session/GCloudSessionDataStore.java:731: long start = System.currentTimeMillis();
jetty-gcloud/jetty-gcloud-session-manager/src/main/java/org/eclipse/jetty/gcloud/session/GCloudSessionDataStore.java:733: LOG.debug("Exists query no index in {}ms", System.currentTimeMillis() - start);
jetty-gcloud/jetty-gcloud-session-manager/src/main/java/org/eclipse/jetty/gcloud/session/GCloudSessionDataStore.java:759: return timestamp < System.currentTimeMillis();
jetty-hazelcast/src/main/java/org/eclipse/jetty/hazelcast/session/HazelcastSessionDataStore.java:150: long now = System.currentTimeMillis();
jetty-hazelcast/src/main/java/org/eclipse/jetty/hazelcast/session/HazelcastSessionDataStore.java:272: return sd.getExpiry() > System.currentTimeMillis(); //not expired yet
jetty-http/src/main/java/org/eclipse/jetty/http/HttpCookie.java:349: DateGenerator.formatCookieDate(buf, System.currentTimeMillis() + 1000L * _maxAge);
jetty-http/src/main/java/org/eclipse/jetty/http/HttpCookie.java:405: DateGenerator.formatCookieDate(buf, System.currentTimeMillis() + 1000L * _maxAge);
jetty-infinispan/infinispan-common/src/main/java/org/eclipse/jetty/session/infinispan/InfinispanSessionDataStore.java:145: long now = System.currentTimeMillis();
jetty-infinispan/infinispan-common/src/main/java/org/eclipse/jetty/session/infinispan/InfinispanSessionDataStore.java:288: reference.set(sd.getExpiry() > System.currentTimeMillis()); //not expired yet
jetty-infinispan/infinispan-embedded-query/src/main/java/org/eclipse/jetty/session/infinispan/EmbeddedQueryManager.java:40: return queryExpiredSessions(System.currentTimeMillis());
jetty-infinispan/infinispan-remote-query/src/main/java/org/eclipse/jetty/session/infinispan/RemoteQueryManager.java:65: return queryExpiredSessions(System.currentTimeMillis());
jetty-io/src/main/java/org/eclipse/jetty/io/AbstractConnection.java:44: private final long _created = System.currentTimeMillis();
jetty-io/src/main/java/org/eclipse/jetty/io/AbstractEndPoint.java:37: private final long _created = System.currentTimeMillis();
jetty-io/src/main/java/org/eclipse/jetty/io/ConnectionStatistics.java:93: long elapsed = System.currentTimeMillis() - connection.getCreatedTimeStamp();
jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/DigestAuthModule.java:51: protected long nonceSecret = this.hashCode() ^ System.currentTimeMillis();
jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/DigestAuthModule.java:91: long timestamp = System.currentTimeMillis();
jetty-jmh/src/main/java/org/eclipse/jetty/util/jmh/DateCacheBenchmark.java:68: dateCache.formatNow(System.currentTimeMillis());
jetty-jmh/src/main/java/org/eclipse/jetty/util/jmh/DateCacheNoTick.java:183: return formatNow(System.currentTimeMillis());
jetty-jmh/src/main/java/org/eclipse/jetty/util/jmh/DateCacheNoTickBenchmark.java:67: dateCache.formatNow(System.currentTimeMillis());
jetty-jmh/src/main/java/org/eclipse/jetty/util/jmh/DateCacheSimpleDateFormat.java:231: return formatNow(System.currentTimeMillis());
jetty-jmh/src/main/java/org/eclipse/jetty/util/jmh/DateCacheSimpleDateFormat.java:236: return formatTick(System.currentTimeMillis());
jetty-jmh/src/main/java/org/eclipse/jetty/util/jmh/DateCacheSimpleDateFormatBenchmark.java:67: dateCache.formatNow(System.currentTimeMillis());
jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyRunDistro.java:574: return Long.toString(random.nextLong() ^ System.currentTimeMillis(), 36).toUpperCase(Locale.ENGLISH);
jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyRunForkedMojo.java:516: return Long.toString(random.nextLong() ^ System.currentTimeMillis(), 36).toUpperCase(Locale.ENGLISH);
jetty-nosql/src/main/java/org/eclipse/jetty/nosql/mongodb/MongoSessionDataStore.java:342: if (expiry.longValue() > 0 && expiry.longValue() < System.currentTimeMillis())
jetty-nosql/src/main/java/org/eclipse/jetty/nosql/mongodb/MongoSessionDataStore.java:353: long now = System.currentTimeMillis();
jetty-openid/src/main/java/org/eclipse/jetty/security/openid/OpenIdCredentials.java:160: long currentTimeSeconds = (long)(System.currentTimeMillis() / 1000F);
jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/utils/EventSender.java:77: props.put("timestamp", System.currentTimeMillis());
jetty-overlay-deployer/src/main/java/org/eclipse/jetty/overlays/OverlayedAppProvider.java:824: _loading = System.currentTimeMillis();
jetty-server/src/main/java/org/eclipse/jetty/server/AbstractNCSARequestLog.java:210: long now = System.currentTimeMillis();
jetty-server/src/main/java/org/eclipse/jetty/server/CachedContentFactory.java:427: _lastAccessed = System.currentTimeMillis();
jetty-server/src/main/java/org/eclipse/jetty/server/CachedContentFactory.java:477: _lastAccessed = System.currentTimeMillis();
jetty-server/src/main/java/org/eclipse/jetty/server/ConnectorStatistics.java:83: _connectionDurationStats.record(System.currentTimeMillis() - connection.getCreatedTimeStamp());
jetty-server/src/main/java/org/eclipse/jetty/server/ConnectorStatistics.java:196: return start < 0 ? 0 : System.currentTimeMillis() - start;
jetty-server/src/main/java/org/eclipse/jetty/server/ConnectorStatistics.java:228: _startMillis.set(System.currentTimeMillis());
jetty-server/src/main/java/org/eclipse/jetty/server/CustomRequestLog.java:1149: long currentTime = System.currentTimeMillis();
jetty-server/src/main/java/org/eclipse/jetty/server/CustomRequestLog.java:1160: long latency = System.currentTimeMillis() - request.getTimeStamp();
jetty-server/src/main/java/org/eclipse/jetty/server/CustomRequestLog.java:1166: long latency = System.currentTimeMillis() - request.getTimeStamp();
jetty-server/src/main/java/org/eclipse/jetty/server/DebugListener.java:190: long now = System.currentTimeMillis();
jetty-server/src/main/java/org/eclipse/jetty/server/HttpChannel.java:658: timeStamp == 0 ? 0 : System.currentTimeMillis() - timeStamp);
jetty-server/src/main/java/org/eclipse/jetty/server/HttpChannel.java:664: _request.setTimeStamp(System.currentTimeMillis());
jetty-server/src/main/java/org/eclipse/jetty/server/LowResourceMonitor.java:351: setLowResourcesStarted(System.currentTimeMillis());
jetty-server/src/main/java/org/eclipse/jetty/server/LowResourceMonitor.java:356: if (getMaxLowResourcesTime() > 0 && (System.currentTimeMillis() - getLowResourcesStarted()) > getMaxLowResourcesTime())
jetty-server/src/main/java/org/eclipse/jetty/server/ResourceService.java:752: response.addDateHeader(HttpHeader.DATE.asString(), System.currentTimeMillis());
jetty-server/src/main/java/org/eclipse/jetty/server/ResourceService.java:770: response.addDateHeader(HttpHeader.DATE.asString(), System.currentTimeMillis());
jetty-server/src/main/java/org/eclipse/jetty/server/Server.java:312: long now = System.currentTimeMillis();
jetty-server/src/main/java/org/eclipse/jetty/server/ShutdownMonitor.java:285: key = Long.toString((long)(Long.MAX_VALUE * Math.random() + this.hashCode() + System.currentTimeMillis()), 36);
jetty-server/src/main/java/org/eclipse/jetty/server/handler/AbstractHandlerContainer.java:165: long stopBy = System.currentTimeMillis() + stopTimeout;
jetty-server/src/main/java/org/eclipse/jetty/server/handler/AbstractHandlerContainer.java:175: future.get(Math.max(1L, stopBy - System.currentTimeMillis()), TimeUnit.MILLISECONDS);
jetty-server/src/main/java/org/eclipse/jetty/server/handler/DebugHandler.java:119: long now = System.currentTimeMillis();
jetty-server/src/main/java/org/eclipse/jetty/server/handler/DefaultHandler.java:57: final long _faviconModified = (System.currentTimeMillis() / 1000) * 1000L;
jetty-server/src/main/java/org/eclipse/jetty/server/handler/StatisticsHandler.java:106: final long elapsed = System.currentTimeMillis() - request.getTimeStamp();
jetty-server/src/main/java/org/eclipse/jetty/server/handler/StatisticsHandler.java:131: _statsStartedAt.set(System.currentTimeMillis());
jetty-server/src/main/java/org/eclipse/jetty/server/handler/StatisticsHandler.java:165: start = System.currentTimeMillis();
jetty-server/src/main/java/org/eclipse/jetty/server/handler/StatisticsHandler.java:186: final long now = System.currentTimeMillis();
jetty-server/src/main/java/org/eclipse/jetty/server/handler/StatisticsHandler.java:526: return System.currentTimeMillis() - _statsStartedAt.get();
jetty-server/src/main/java/org/eclipse/jetty/server/jmx/ServerMBean.java:40: startupTime = System.currentTimeMillis();
jetty-server/src/main/java/org/eclipse/jetty/server/session/AbstractSessionDataStore.java:130: data.isDirty(), data.getLastSaved(), savePeriodMs, (System.currentTimeMillis() - lastSave));
jetty-server/src/main/java/org/eclipse/jetty/server/session/AbstractSessionDataStore.java:135: (data.isMetaDataDirty() && ((System.currentTimeMillis() - lastSave) >= savePeriodMs)))
jetty-server/src/main/java/org/eclipse/jetty/server/session/AbstractSessionDataStore.java:138: data.setLastSaved(System.currentTimeMillis());
jetty-server/src/main/java/org/eclipse/jetty/server/session/AbstractSessionDataStore.java:172: _lastExpiryCheckTime = System.currentTimeMillis();
jetty-server/src/main/java/org/eclipse/jetty/server/session/DefaultSessionIdManager.java:256: _random.setSeed(_random.nextLong() ^ System.currentTimeMillis() ^ seedTerm ^ Runtime.getRuntime().freeMemory());
jetty-server/src/main/java/org/eclipse/jetty/server/session/DefaultSessionIdManager.java:383: _random.setSeed(_random.nextLong() ^ System.currentTimeMillis() ^ hashCode() ^ Runtime.getRuntime().freeMemory());
jetty-server/src/main/java/org/eclipse/jetty/server/session/FileSessionDataStore.java:155: final long now = System.currentTimeMillis();
jetty-server/src/main/java/org/eclipse/jetty/server/session/FileSessionDataStore.java:206: long now = System.currentTimeMillis();
jetty-server/src/main/java/org/eclipse/jetty/server/session/FileSessionDataStore.java:364: long now = System.currentTimeMillis();
jetty-server/src/main/java/org/eclipse/jetty/server/session/FileSessionDataStore.java:454: return (expiry > System.currentTimeMillis()); //hasn't yet expired
jetty-server/src/main/java/org/eclipse/jetty/server/session/HouseKeeper.java:210: if ((System.currentTimeMillis() % 2) == 0)
jetty-server/src/main/java/org/eclipse/jetty/server/session/JDBCSessionDataStore.java:762: LOG.debug("Getting expired sessions at time {}", System.currentTimeMillis());
jetty-server/src/main/java/org/eclipse/jetty/server/session/JDBCSessionDataStore.java:764: long now = System.currentTimeMillis();
jetty-server/src/main/java/org/eclipse/jetty/server/session/JDBCSessionDataStore.java:913: return (expiry > System.currentTimeMillis()); //hasn't already expired
jetty-server/src/main/java/org/eclipse/jetty/server/session/Session.java:124: long now = System.currentTimeMillis();
jetty-server/src/main/java/org/eclipse/jetty/server/session/Session.java:150: schedule(calculateInactivityTimeout(System.currentTimeMillis()));
jetty-server/src/main/java/org/eclipse/jetty/server/session/Session.java:289: long now = System.currentTimeMillis();
jetty-server/src/main/java/org/eclipse/jetty/server/session/Session.java:318: long now = System.currentTimeMillis();
jetty-server/src/main/java/org/eclipse/jetty/server/session/SessionData.java:384: return calcExpiry(System.currentTimeMillis());
jetty-server/src/main/java/org/eclipse/jetty/server/session/SessionHandler.java:231: long now = System.currentTimeMillis();
jetty-server/src/main/java/org/eclipse/jetty/server/session/SessionHandler.java:761: long created = System.currentTimeMillis();
jetty-server/src/main/java/org/eclipse/jetty/server/session/SessionHandler.java:910: if (session.isExpiredAt(System.currentTimeMillis()))
jetty-server/src/main/java/org/eclipse/jetty/server/session/SessionHandler.java:1179: _sessionTimeStats.record(round((System.currentTimeMillis() - session.getSessionData().getCreated()) / 1000.0));
jetty-server/src/main/java/org/eclipse/jetty/server/session/SessionHandler.java:1282: sessionInactivityTimerExpired(session, System.currentTimeMillis());
jetty-servlets/src/main/java/org/eclipse/jetty/servlets/ConcatServlet.java:72: _lastModified = System.currentTimeMillis();
jetty-servlets/src/main/java/org/eclipse/jetty/servlets/DoSFilter.java:318: final boolean overRateLimit = tracker.isRateExceeded(System.currentTimeMillis());
jetty-servlets/src/main/java/org/eclipse/jetty/servlets/DoSFilter.java:1280: boolean hasRecentRequest = last != 0 && (System.currentTimeMillis() - last) < 1000L;
jetty-servlets/src/main/java/org/eclipse/jetty/servlets/HeaderFilter.java:93: long headerValue = System.currentTimeMillis() + header.getMsOffset();
jetty-servlets/src/main/java/org/eclipse/jetty/servlets/PushSessionCacheFilter.java:103: if (last != null && (System.currentTimeMillis() - last) < _associateDelay)
jetty-servlets/src/main/java/org/eclipse/jetty/servlets/PushSessionCacheFilter.java:152: timestamps.put(uri, System.currentTimeMillis());
jetty-start/src/main/java/org/eclipse/jetty/start/FS.java:163: FileTime now = FileTime.fromMillis(System.currentTimeMillis());
jetty-util/src/main/java/org/eclipse/jetty/util/DateCache.java:226: return formatNow(System.currentTimeMillis());
jetty-util/src/main/java/org/eclipse/jetty/util/DateCache.java:231: return formatTick(System.currentTimeMillis());
jetty-util/src/main/java/org/eclipse/jetty/util/MultiPartOutputStream.java:49: Long.toString(System.currentTimeMillis(), 36);
jetty-util/src/main/java/org/eclipse/jetty/util/MultiPartWriter.java:46: Long.toString(System.currentTimeMillis(), 36);
jetty-util/src/main/java/org/eclipse/jetty/util/log/StdErrLog.java:439: long now = System.currentTimeMillis();
from jetty.project.
happy to work on that.
Should we use a pattern such (each change need to be reviewed)
System.currentTimeMillis()
->
TimeUnit.MILLISECONDS.convert(System.currentTimeMillis(), TimeUnit.NANOSECONDS)
?
from jetty.project.
This can't be automatic.... a lot of these probably can be changed to use nanotime as they are just intervals, but we also do have real need for wall clock time. For example sessions that are persisted and/or migrated between nodes cannot use nanotime for expiry and have to use a real wall clock.
from jetty.project.
We should also consider for Jetty 10 to use java.time
rather than long
to express GMT times.
from jetty.project.
A PMD rule to check for System.currentTimeMillis()
could be created.
Each occurrence would need to be vetted. Either changed or PMD tagged as appropriate (via a comment before its use).
from jetty.project.
This issue has been automatically marked as stale because it has been a full year without activity. It will be closed if no further activity occurs. Thank you for your contributions.
from jetty.project.
This issue has been automatically marked as stale because it has been a
full year without activity. It will be closed if no further activity occurs.
Thank you for your contributions.
from jetty.project.
This is being progressively fixed (see #8067), but will leave open to track progress
from jetty.project.
Checking if you're fine to accept a contribution to change from System.currentTimeMillis() to System.nanoTime() in the HttpChannel class
In the jvm/application instrumentation library dropwizard metrics, System.nanoTime is used in all scenarios. The only exception where we use System.currentTimeMillis() is to measure jetty request times as the start time is set by jetty.
If we can change setting the request time to use System.nanoTime(), we can be consistent in all scenarios.
Suggested implementations
- Use existing _timeStamp field, leverage System.nanoTime() and convert to milliseconds
- Add a new field in the Request class and set it to System.nanoTime() (Should be a backwards compatible change)
from jetty.project.
@dennyac Request.setTimeStamp()
should remain an epoch time, because it is used for example in request logs (so it must be a meaningful date).
It's not clear to me what the problem is?
from jetty.project.
Perhaps it need to be a separately tracked metric?
You could use an HttpChannel.Listener.onRequestBegin() to set a Request.attribute with the nanotime as well.
Finally, are you sure you want nanotime in the raw like that?
Are you handling the nanotime gotchas yourself?
from jetty.project.
This issue has been automatically marked as stale because it has been a
full year without activity. It will be closed if no further activity occurs.
Thank you for your contributions.
from jetty.project.
Work completed
from jetty.project.
Related Issues (20)
- Move jetty maven plugin integration tests out to tests module
- Maven "relativePath" usage HOT 4
- NPE Cannot invoke "org.eclipse.jetty.server.Request.getSession(boolean)" because the return value of "org.eclipse.jetty.ee10.servlet.ServletApiRequest.getRequest()" is null HOT 6
- Access logs ignore time out exceptions HOT 1
- getHeaderNames should return header name once also when request has it in different case HOT 3
- Servlet Spec 6.1 issue 159 HOT 1
- Servlet spec 6.1 issue 164 HOT 2
- Servlet spec 6.1 issue 273
- Servlet spec 6.1 issue 300 HOT 1
- Servlet spec 6.1 issue 316 HOT 1
- Servlet spec 6.1 issue 325 HOT 1
- Servlet spec 6.1 issue 431 HOT 1
- Servlet spec 6.1 issue 453 HOT 1
- Servlet spec 6.1 issue 571 HOT 1
- h2 server responses exceeding SETTINGS_MAX_HEADER_LIST_SIZE do not result in RST_STREAM or GOAWAY
- NativeHelper triggers JDK warning HOT 6
- HTTP requests with large headers are not fully processes and timeout HOT 1
- Cannot invoke "org.eclipse.jetty.client.transport.HttpExchange.getRequest()" because "exchange" is null HOT 1
- replacement for GlobalWebappConfigBinding HOT 3
- Consider adding @NotNull or similar to the code base HOT 11
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jetty.project.